SumatraPDF is my favourite pdf reader and TeXstudio is my favourite LaTeX editor. Here’s how to get them to work nicely together.
Go to Options/Configure TeXstudio and click on “Commands”. Beside Pdf Viewer, untick “Internal viewer” and add the following command:
"c:/Program Files/SumatraPDF/SumatraPDF.exe" -reuse-instance %.pdf
|
(If you have SumatraPDF stored somewhere other than the specified paths, you will need to edit this accordingly.)
Then you need to tell SumatraPDF how to jump to the correct line in TeXstudio. From within SumatraPDF, go to Settings/Options and set the inverse search command to
"C:\Program Files\TeXstudio\texstudio.exe" "%f" -line %l |
Change the path to TeXstudio if necessary.
In order to go from the tex file to the corresponding location in the pdf, you can add a ForwardSearch command within TeXstudio. Select “User” from the main menu, then “User commands” and “Edit User commands”. Then add a command with the following definition:
dde://"C:/Program Files/SumatraPDF/SumatraPDF.exe":SUMATRA/control/ [ForwardSearch("?am.pdf","?c:am.tex",@,0,0,1)] |
(That should all be on one line with no space before
[ForwardSearch
. Again, edit the path for SumatraPDF as necessary. Give the command a name such as “ForwardSearch” and click “OK”. Now you should be able to jump to the corresponding part of the pdf file using “Alt-Shift-F1” (or whatever key-combination is associated with your new command).
Being lazy, I prefer a simple function key. To map F2 to your new command, select “Options/Configure TeXstudio” and choose “Shortcuts”. Find your new command under the User menu, double click to the right of it and select “F2” from the drop-down box. Previously F2 was mapped to LaTeX, but I never use LaTeX directly, so losing this function is no problem.
Now you can double click on any part of the pdf from within SumatraPDF and it should take you to the corresponding place in your tex file in TeXstudio. And then F2 will take you back again.