How can I setup SyncTex with qpdfview + auctex?

Asked by Pablo Ferrari

I followed the instructions for okular in, substituting okular by qpdfview where necessary but qpdfview gives the error message

Could not open '%o#src:%n%b'.

Any hint?

Question information

English Edit question
qpdfview Edit question
No assignee Edit question
Solved by:
Adam Reichold
Last query:
Last reply:
Revision history for this message
Adam Reichold (adamreichold) said :

Hello Pablo,

the error message displayed would indicate that AUCTeX did not send the file name and source reference to qpdfview but instead literally requested it it open a file called "%o#src:%n%b", i.e. it did not replace the placeholders at all. Since I do not known AUCTeX, I am sorry that I cannot really help on how to diagnose that issue. On the other hand, if the placeholders are replaced, your template should probably look more like "%o#src:%n:%b:0" to fit qpdfview's command line syntax "file#src:name:line:column" as described in the manual page.

Best regards, Adam.

Revision history for this message
Pablo Ferrari (pagfrr) said :

Many thanks Adam. It works with this command "qpdfview --unique %o#src:%b:%n:0" (and does not work with b and n interchanged!). Direct search is solved.

On the other hand, I cannot make reverse search work. It seems that the source editor is emacsclient. In qpdfview settings/Behavior/source editor I declared

emacsclient %1 %2 %3

closed both emacs and qpdfview. Open the file bfy.tex in emacs, compile and ask for view, then the qpdfview opens the file bfy.pdf at the place corresponding to the position of the cursor in the tex file. Great so far.

Then I click twice in any point of the pdf file and instead of going to the right place in the tex file, a new buffer called bfy.tex<2> but blank, opens and a message "when done with a buffer, type C-x #.

The same happens if I declare

emacsclient %1 %2
emacsclient %1

On the other hand, if I declare

emacs %1
emacs %1 %2
emacs %1 %2 %3

a new instance of emacs is open with the opening screen.

I am using emacs 24.3.1 with auctex installed using apt-get.

Many thanks again for your time and dedication.

Best regards,


ps: should I declare solved the original problem and open a new question with the reverse search issue?

Revision history for this message
Best Adam Reichold (adamreichold) said :

Hello again,

I think the invocation syntax for emacsclient is "+line:column file", i.e. qpdfview should probably use 'emacsclient +%2:%3 "%1"' as a source editor. (But only found this through search in some Emacs wiki. It does not seem to be documented in the info page of emacsclient?)

Best regards, Adam.

Revision history for this message
Pablo Ferrari (pagfrr) said :

Thanks Adam Reichold, that solved my question.