TexStudio, MiKTeX and Sumatra; Compilation Issue

The shortcut F6 in TeXstudio is 'Compile', and F5 is 'Compile and view', or F1 prior to version 2.12.2. That is, if you press F5, TeXstudio will compile the TeX source file and then (if no error occurs) open the PDF viewer. If you want to open the generated PDF file automatically, use F5 rather than F6.

In order to use SumatraPDF as the default PDF viewer, you have to use the external PDF viewer and set it to SumutraPDF. Here is a step-by-step guidance.

  1. Options (in the menu bar) -> Configure TeXstudio ... -> The Commands Label
  2. Modify the value of External PDF Viewer to "path\to\SumatraPDF.exe" -reuse-instance -forward-search "?am.tex" @ -fwdsearch-permanent 1 "?am.pdf"
  3. The Build Label
  4. Select External PDF Viewer for PDF Viewer in Meta Command area.
  5. Click OK at the bottom of the window

That's it.

Enjoy TeX and TeX.SX. : )


If you want both forward and inverse search in one command it can also be done.

  1. Options (in the menu bar) -> Configure TeXstudio ... -> Commands (tab on the left)
  2. Set "External PDF Viewer" to "C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe" -reuse-instance -inverse-search "\"C:/Program Files (x86)/TeXstudio/texstudio.exe\" \"%%f\" -line %%l" -forward-search "?c:am.tex" @ "?am.pdf"

Remember to change the paths to Sumatra and Texlive.

Sources: https://github.com/sumatrapdfreader/sumatrapdf/wiki/Command-line-arguments http://texstudio.sourceforge.net/manual/current/usermanual_en.html#SECTION37