[Tex/LaTex] Notepad++ With MiKTeX and Sumatrapdf

editorssumatrapdfviewers

I've seen similar posts to this one, but none have addressed my specific problem (I think!).

I currently use Notepad++ with MikTeX on my Windows 7 desktop. My default pdf viewer is Sumatrapdf.

I have two nppexec commands that compile my current file.

The first is:

npp_saveall
CD $(CURRENT_DIRECTORY)
"C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe" "$(FULL_CURRENT_PATH)" -output-directory "$(CURRENT_DIRECTORY)"
NPP_RUN $(NAME_PART).pdf

The second is:

npp_saveall
CD $(CURRENT_DIRECTORY)
"C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe" "$(FULL_CURRENT_PATH)" -output-directory "$(CURRENT_DIRECTORY)"

Of course, I run the first command when I want to open a new pdf window and I run the second when I already have a pdf window open and I just want to update the file.

My problem is that my first command always opens a new window. I'd like to just have one command that either opens a new window (if one isn't open already) or brings the updated open window to the front. Does anyone know how to alter my code to do this?

Update: I got it to work! My new code is

npp_saveall
CD $(CURRENT_DIRECTORY)
"C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe" "$(FULL_CURRENT_PATH)" -output-directory "$(CURRENT_DIRECTORY)"
"C:\Program Files (x86)\SumatraPDF\SumatraPDF.exe" "$(NAME_PART).pdf" -reuse-instance

Best Answer

I'm not familiar with Notepad++, but I can tell you that you can pass the option -reuse-instance to SumatraPDF command line to achieve what you want.

For more info see this page.

Related Question