Using SyncTex with geany and qpdfview

Asked by Martin Spacek

This is more an answer than a question. I couldn't find much out there on getting geany (http://geany.org) and qpdfview to work together using SyncTex, so I spent some time figuring it out. The problem is (or was) that the build commands you can set up in geany's build menu don't give you a line variable for you to pass on to your build (& view) commands. I created a pull request that fixes that:

https://github.com/geany/geany/pull/289

Now, to view the generated pdf in qpdfview at the spot corresponding to the current line in geany, I can use this as a build or execute command in geany:

qpdfview --unique %e.pdf#src:%f:%l:0

Or for a multifile latex project:

qpdfview --unique main.pdf#src:%f:%l:0

Where main.tex is the main file in the document hierarchy. Of course, for this to work, -synctex=1 has to be invoked when calling pdflatex so that the .synctex.gz file is generated. Here's my build command in geany:

pdflatex -synctex=1 --file-line-error "%f"

Or for a multifile latex project:

pdflatex -synctex=1 --file-line-error "main.tex"

Going in the other direction is simpler: just set this in qpdfview's "Source editor" setting:

geany %1:%2:%3

Now, double-clicking a spot in the pdf will pop open geany at the corresponding line in the source. Hooray!

Question information

Language:
English Edit question
Status:
Solved
For:
qpdfview Edit question
Assignee:
No assignee Edit question
Solved by:
Martin Spacek
Solved:
Last query:
Last reply:
Revision history for this message
Martin Spacek (mspacek) said :
#1

Hm, maybe this should be converted to a FAQ somehow.

Revision history for this message
Martin Spacek (mspacek) said :
#2

Closing this question.

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

Hello,

if you have the time and motivation to create an FAQ, please volunteer to become an answer contact as described in [1]. Thanks.

Best regards, Adam.

[1] https://help.launchpad.net/Answers/OfferingHelp