TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

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

The second is:

"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

"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
share|improve this question
up vote 7 down vote accepted

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.

share|improve this answer
How would I do this? – Brian Fitzpatrick May 21 '13 at 6:20
I have no idea... As I said I'm not familiar with Notepad++. Probably something like NPP_RUN -reuse-instance $(NAME_PART).pdf? – karlkoeller May 21 '13 at 6:25
Thanks. I'll tinker around with this. – Brian Fitzpatrick May 21 '13 at 6:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.