How can I setup SyncTex with qpdfview + auctex?

Asked by Pablo Ferrari on 2015-10-21

I followed the instructions for okular in http://mathieu.3maisons.org/wordpress/how-to-configure-emacs-and-auctex-to-work-with-a-pdf-viewer, substituting okular by qpdfview where necessary but qpdfview gives the error message

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

Any hint?

Question information

Language:
English Edit question
Status:
Solved
For:
qpdfview Edit question
Assignee:
No assignee Edit question
Solved by:
Adam Reichold
Solved:
2015-10-21
Last query:
2015-10-21
Last reply:
2015-10-21
Adam Reichold (adamreichold) said : #1

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.

Pablo Ferrari (pagfrr) said : #2

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
or
emacsclient %1

On the other hand, if I declare

emacs
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,

Pablo

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

Best Adam Reichold (adamreichold) said : #3

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.

Pablo Ferrari (pagfrr) said : #4

Thanks Adam Reichold, that solved my question.