TeXstudio, SumatraPDF and synctex

Dec 09, 2020 12:31



Pro tip: if you're using TeXstudio and SumatraPDF - which you probably are, since TeXstudio is the best TeX environment by far, and SumatraPDF is the best PDF reader -, you may be happy to learn that SumatraPDF actually supports synctex files; simply go to Settings > Options, and set the ,,inverse search command line`` to something along the lines of C:\Program Files (x86)\TeXstudio\texstudio.exe "%f" -line %l (the quotes will ensure that this works as intended if your filename contains spaces):



Then simply double-click anywhere in a PDF to go back to the corresponding line of the TeX document - very useful for quickly fixing typos, say.

Conversely, TeXstudio allows you to jump to specific points in the PDF as well using ,,Go to PDF`` in the context menu. In order to make use of this, go to Options > Configure TeXstudio > Commands, and set the External PDF Viewer to something along the lines of "C:/Program Files/SumatraPDF/SumatraPDF.exe" -forward-search "?c:am.tex" @ "?am.pdf":



Side note: the SumatraPDF documentation actually suggests using "C:/Program Files/SumatraPDF/SumatraPDF.exe" -forward-search "?c:am.tex" @ -inverse-search "\"C:/Program Files (x86)/TeXstudio/texstudio.exe\" \"%%f\" -line %%l" "?am.pdf" there to automatically set the relevant SumatraPDF config option, but this does not work for me, so it's better to just set it once by hand.

useful stuff, latex, software, pdf

Previous post Next post
Up