Using Notepad++ with MiKTeX on Windows
I'm using MiKTeX 2.9 on Windows. So far I've been using LeD to compile my PDFs (using pdflatex). I want to start using Notepad++ to compile my LaTeX PDFs as I've lately become very fond of this editor.
Would anyone be able to point me to a way to configure Notepad++ with shortcuts to compile bibtex and pdflatex?
miktex windows editors
add a comment |
I'm using MiKTeX 2.9 on Windows. So far I've been using LeD to compile my PDFs (using pdflatex). I want to start using Notepad++ to compile my LaTeX PDFs as I've lately become very fond of this editor.
Would anyone be able to point me to a way to configure Notepad++ with shortcuts to compile bibtex and pdflatex?
miktex windows editors
see the manual of notepad: Doc on command and shortcuts
– zeroth
Feb 9 '12 at 18:42
add a comment |
I'm using MiKTeX 2.9 on Windows. So far I've been using LeD to compile my PDFs (using pdflatex). I want to start using Notepad++ to compile my LaTeX PDFs as I've lately become very fond of this editor.
Would anyone be able to point me to a way to configure Notepad++ with shortcuts to compile bibtex and pdflatex?
miktex windows editors
I'm using MiKTeX 2.9 on Windows. So far I've been using LeD to compile my PDFs (using pdflatex). I want to start using Notepad++ to compile my LaTeX PDFs as I've lately become very fond of this editor.
Would anyone be able to point me to a way to configure Notepad++ with shortcuts to compile bibtex and pdflatex?
miktex windows editors
miktex windows editors
edited 14 mins ago
Henri Menke
71.5k8158266
71.5k8158266
asked Feb 9 '12 at 18:04
prraoprrao
1,09321012
1,09321012
see the manual of notepad: Doc on command and shortcuts
– zeroth
Feb 9 '12 at 18:42
add a comment |
see the manual of notepad: Doc on command and shortcuts
– zeroth
Feb 9 '12 at 18:42
see the manual of notepad: Doc on command and shortcuts
– zeroth
Feb 9 '12 at 18:42
see the manual of notepad: Doc on command and shortcuts
– zeroth
Feb 9 '12 at 18:42
add a comment |
4 Answers
4
active
oldest
votes
I managed to find the perfect solution! For some reason, this didn't show up on my previous Google searches. I tailored my version of this solution: http://nimal.info/blog/2010/latex-on-windows-with-miktex-and-notepad/
My version (on a 64-bit Windows 7 machine) is as follows:
- Download and install Basic MiKTeX 2.9 (32-bit)
- Download and install SumatraPDF
- Create a batch file
miktex_to_latex.batand place it anywhere
- For easy location, place the batch file in the [Notepad++ installation Path]
Copy-paste the following into the batch file and save it
:: Called from Notepad++ Run
:: [path_to_bat_file] "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
:: Change Drive and to File Directory
%~d1
cd %1
:: Run Cleanup
call:cleanup
:: Run pdflatex -> bibtex -> pdflatex -> pdflatex
pdflatex %2
bibtex %2
:: If you are using multibib the following will run bibtex on all aux files
:: FOR /R . %%G IN (*.aux) DO bibtex %%G
pdflatex %2
pdflatex %2
:: Run Cleanup
call:cleanup
:: Open PDF
START "" "C:Progra~2SumatraPDFSumatraPDF.exe" %3 -reuse-instance
:: Cleanup Function
:cleanup
del *.dvi
del *.out
:: del *.log
:: del *.aux
:: del *.bbl
:: del *.blg
:: del *.brf
goto:eof
Take care of the following:
- All lines beginning with double colon
::are comments - the
STARTcommand should have the installation path of SumatraPDF - Make sure there are NO spaces in the path (Use
Progra~2, notProgram Files (X86)) - The
-reuse-instanceallows us to edit and recompile without quitting the PDF
- All lines beginning with double colon
Download (if it does not already exist) the NppExec plugin and place the
.dllfile in [Notepad++ installation path]pluginsOpen a
.texfile in Notepad++, click on F6 to execute
Type the following lines in the window that pops up:
NPP_SAVE
"<Path_to_bat_file>" "$(CURRENT_DIRECTORY)" "$(NAME_PART)" "$(NAME_PART).pdf"
In my case, this is:
NPP_SAVE
"C:Progra~2Notepad++miktex_to_latex.bat" "$(CURRENT_DIRECTORY)" "$(NAME_PART)" "$(NAME_PART).pdf"
The above lines basically tell NppExec to "save the current
.texfile, run the batch file, store results in current directory and name it the same as the.texfile"
Click on "Save" and type in a recognizable name such as 'PDFLaTex'
Go to the menubar, Plugins -> NppExec -> Advanced Options.. Under 'Menu item', choose the script we just created above, and 'Add/Modify' it to the Menu items with a suitable name. This allows us to assign shortcut keys through Settings -> Shortcut Mapper -> Plugin commands
Navigate to the script name and choose any shortcut key like Shift+F7
Press the shortcut key Shift+F7 to save and compile the
.texfile. The SumatraPDF window should pop up and show the compiled PDF. Changes can be made and the file recompiled without having to close the PDF.
The BEST parts about this method are:
- There is no need to keep pressing Ctrl+S to save and then compile to PDF. Everything is done in one key press!
- There is no need to keep closing the opened PDF and reopening it on recompiling (as in the case with Adobe Reader)
- It is very easy to cleanup all the junk files generated
- It is completely open-source and can be easily integrated with an existing Notepad++ installation
Thanks Nimal, Jonas, Bert and the others who contributed to this awesome solution!
16
be careful using the cleanup! any document that uses the information in the .aux will struggle if it is deleted every time. just try putting in one ref to a label and you'll see what i mean. Personally, I would recommend creating thecleanupfile as a separate batch file, and calling it separately
– cmhughes
Feb 10 '12 at 0:57
@cmhughes Thanks a lot, I'll keep that in mind. Is it only the .aux that I should be worried about? I'm pretty sure that PDFLaTex doesn't use the dvi file as that is an intermediate file. I'm guessing the .out file and the likes are also not that useful. Would it make sense to keep the .aux and delete the rest instead of calling the cleanup batch file separately?
– prrao
Feb 10 '12 at 2:32
4
The.bblfiles and friends are used bybiblatex; you are correct about the.dvifiles. I would seriously consider not deleting any of them until the document is finished, and just run yourcleanupfile at the end. Thedelcommand can be made to work recursively through your home directory, so you only need to run it once
– cmhughes
Feb 10 '12 at 3:23
Sure, that sounds fine. Thanks for the tip.
– prrao
Feb 10 '12 at 13:06
2
I updated the steps to include an autosave option. Much more convenient!
– prrao
Feb 14 '12 at 15:14
|
show 10 more comments
I've stumbled through a bunch of different IDE's and honestly I think that notepad++ is one of the most underrated options available to anyone doing TeX stuff.
Along that line, I think that most of these other options, which I started with, are overly complicated when we have tools like arara and latexmk. They all work fabulously well, and I greatly appreciate the help they have given me, but I think we should use all the tools available to us. I personally love arara and I have my way that I now use every day that leans on arara more than notepad++.
This is my notepad++ set up in NppExec
NPP_SAVEALL
cd $(CURRENT_DIRECTORY)
arara $(NAME_PART)
No batch files necessary. In my documents, I usually use a variation on this set of rules.
% arara: pdflatex: { synctex: on, shell: off }
% arara: biber
% arara: pdflatex: { synctex: on, shell: off }
% arara: pdflatex: { synctex: on, shell: off }
% arara: clean: { files: [ foo.log, foo.aux, foo.bbl, foo.blg, foo.log, foo.run.xml, foo-blx.bib, foo.bcf, foo.out ] }
% arara: sumatrapdf
The pdflatex,biber and clean are all included in arara. sumatrapdf is mine, but is exceedingly simple. arara also supplies a bibtex rule which is just as simple to call, but I prefer biber.
sumatrapdf.yaml
!config
# SumatraPDF rule for arara
# Author: Mr Komandez
identifier: sumatrapdf
name: SumatraPDF
commands:
- <arara> DIRECTORY/sumatra.bat "@{getBasename(file)}.pdf" "@{options}"
arguments:
- identifier: options
flag: <arara> @{parameters.options}
sumatra.bat
START /b "C:Progra~2SumatraPDFSumatraPDF.exe" %1 -reuse-instance %2
EXIT
This way, from the source code you can change your compilation options on the fly, but your actual compilation can stay key-bound the same way.
add a comment |
This would be a comment, but for length. I contributed to the batch file above, but here's my latest version:
:: Called from Notepad++ Run
:: [path_to_bat_file] "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
:: Change Drive and to File Directory
%~d1
cd %1
:: Run Cleanup
call:cleanup
:: Run pdflatex -> bibtex -> pdflatex -> pdflatex
pdflatex %2
bibtex %2
:: If you are using multibib the following will run bibtex on all aux files
:: FOR /R . %%G IN (*.aux) DO bibtex %%G
pdflatex %2
pdflatex %2
:: Open PDF (Script updated based on comments by 'menfeser'
:: START "" "C:Program FilesAdobeReader 9.0ReaderAcroRd32.exe" %2.pdf
if (%3)==() goto cleanup
::START "" %2.pdf
set str=%date%_%time%
set str=%str:/=-%
set str=%str::=-%
set str=%str: =_%
ren %2.pdf %2_%str%.pdf
"C:Program FilesFoxit SoftwareFoxit ReaderFoxit Reader.exe" %2_%str%.pdf
:: Cleanup Function
if %3==noclean goto eof
:cleanup
del *.log
del *.dvi
del *.aux
del *.bbl
del *.blg
del *.brf
del *.out
:eof
It's called with 3 parameters - directory, filename, and a third, which can be "noclean" to keep temp files, blank to clean up but not view pdf, and anything else to show the pdf. I map [shift]+F5 to view and clean, and [ctrl]+F5 to view without cleaning.
As there's currently no windows pdf viewer that doesn't lock the file on opening (my original reason for preferring foxit) the batch file renames the output pdf to put a date/time stamp in the file name before opening, allowing the next build to be opened without errors.
Another macro to call ASpell is handy as well.
Doesn't SumatraPDF have a 32-bit Windows version? It doesn't lock the PDF on opening so LaTeX can definitely update it dynamically
– prrao
Aug 2 '13 at 21:54
I think there is, I rather liked the way foxit reopens in a new tab, keeping the previous copy open, so I fixed the batch file rather than installing something else.
– Chris H
Aug 4 '13 at 10:39
add a comment |
As mr-komandez mentioned, there is also latexmk. It can completely automate the process for you. One of the coolest features of this package is the -pvc-switch, which provides a continuous mode. So every time you save a file in the workspace, latexmk will run the necessary toolchain to compile. It has a lot of options, but for bibtex/pdflatex you can do this (assuming you have the NppExec plugin set up):
Setup Notepad++ with NppExec
- Open Notepad++
- Go to Plugins -> NppExec -> Execute... (or press F6).
- Type the following in the
Commands(s)textfield:
NppExec Command (with -pvc switch)
NPP_SAVE
cd $(CURRENT_DIRECTORY)
latexmk -pvc -pdf -latex=pdflatex -latexoption="-synctex=1 -interaction=nonstopmode -file-line-error -recorder" -bibtex main.tex
- Press the save button and give it a good name.
- NppExec will immediately execute and if you have the console open (toggle it with
ctrl+~), you can see any errors in the compile log.
NppExec Command (without -pvc switch)
If you want more control over things like cleaning directories on some runs, use different engines (such as xelatex) or for some reason you do not like to have -pvc doing its thing. You can also setup NppExec with hotkeys and amend the above with anything specified in the latexmk manual, there are quite the repertoire of options and switches you can use. If you follow the steps above, remove the -pvc and make any changes you see fit, you can then use the saved commands in the following way:
- In Notepad++, go to Plugins -> NppExec -> Advanced Options.
- In the window that pops up, you can see `Associated Scripts" at the bottom left.
- Select the saved script, from here you can add hotkeys to different runs for ease of access.

A last note
Since you are using MiKTeX, you can also use the -aux-dir= & -outdir=-switches, which will put all auxiliary files/compiled files in subfolders as specified.
add a comment |
protected by Community♦ Dec 16 '13 at 21:23
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
I managed to find the perfect solution! For some reason, this didn't show up on my previous Google searches. I tailored my version of this solution: http://nimal.info/blog/2010/latex-on-windows-with-miktex-and-notepad/
My version (on a 64-bit Windows 7 machine) is as follows:
- Download and install Basic MiKTeX 2.9 (32-bit)
- Download and install SumatraPDF
- Create a batch file
miktex_to_latex.batand place it anywhere
- For easy location, place the batch file in the [Notepad++ installation Path]
Copy-paste the following into the batch file and save it
:: Called from Notepad++ Run
:: [path_to_bat_file] "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
:: Change Drive and to File Directory
%~d1
cd %1
:: Run Cleanup
call:cleanup
:: Run pdflatex -> bibtex -> pdflatex -> pdflatex
pdflatex %2
bibtex %2
:: If you are using multibib the following will run bibtex on all aux files
:: FOR /R . %%G IN (*.aux) DO bibtex %%G
pdflatex %2
pdflatex %2
:: Run Cleanup
call:cleanup
:: Open PDF
START "" "C:Progra~2SumatraPDFSumatraPDF.exe" %3 -reuse-instance
:: Cleanup Function
:cleanup
del *.dvi
del *.out
:: del *.log
:: del *.aux
:: del *.bbl
:: del *.blg
:: del *.brf
goto:eof
Take care of the following:
- All lines beginning with double colon
::are comments - the
STARTcommand should have the installation path of SumatraPDF - Make sure there are NO spaces in the path (Use
Progra~2, notProgram Files (X86)) - The
-reuse-instanceallows us to edit and recompile without quitting the PDF
- All lines beginning with double colon
Download (if it does not already exist) the NppExec plugin and place the
.dllfile in [Notepad++ installation path]pluginsOpen a
.texfile in Notepad++, click on F6 to execute
Type the following lines in the window that pops up:
NPP_SAVE
"<Path_to_bat_file>" "$(CURRENT_DIRECTORY)" "$(NAME_PART)" "$(NAME_PART).pdf"
In my case, this is:
NPP_SAVE
"C:Progra~2Notepad++miktex_to_latex.bat" "$(CURRENT_DIRECTORY)" "$(NAME_PART)" "$(NAME_PART).pdf"
The above lines basically tell NppExec to "save the current
.texfile, run the batch file, store results in current directory and name it the same as the.texfile"
Click on "Save" and type in a recognizable name such as 'PDFLaTex'
Go to the menubar, Plugins -> NppExec -> Advanced Options.. Under 'Menu item', choose the script we just created above, and 'Add/Modify' it to the Menu items with a suitable name. This allows us to assign shortcut keys through Settings -> Shortcut Mapper -> Plugin commands
Navigate to the script name and choose any shortcut key like Shift+F7
Press the shortcut key Shift+F7 to save and compile the
.texfile. The SumatraPDF window should pop up and show the compiled PDF. Changes can be made and the file recompiled without having to close the PDF.
The BEST parts about this method are:
- There is no need to keep pressing Ctrl+S to save and then compile to PDF. Everything is done in one key press!
- There is no need to keep closing the opened PDF and reopening it on recompiling (as in the case with Adobe Reader)
- It is very easy to cleanup all the junk files generated
- It is completely open-source and can be easily integrated with an existing Notepad++ installation
Thanks Nimal, Jonas, Bert and the others who contributed to this awesome solution!
16
be careful using the cleanup! any document that uses the information in the .aux will struggle if it is deleted every time. just try putting in one ref to a label and you'll see what i mean. Personally, I would recommend creating thecleanupfile as a separate batch file, and calling it separately
– cmhughes
Feb 10 '12 at 0:57
@cmhughes Thanks a lot, I'll keep that in mind. Is it only the .aux that I should be worried about? I'm pretty sure that PDFLaTex doesn't use the dvi file as that is an intermediate file. I'm guessing the .out file and the likes are also not that useful. Would it make sense to keep the .aux and delete the rest instead of calling the cleanup batch file separately?
– prrao
Feb 10 '12 at 2:32
4
The.bblfiles and friends are used bybiblatex; you are correct about the.dvifiles. I would seriously consider not deleting any of them until the document is finished, and just run yourcleanupfile at the end. Thedelcommand can be made to work recursively through your home directory, so you only need to run it once
– cmhughes
Feb 10 '12 at 3:23
Sure, that sounds fine. Thanks for the tip.
– prrao
Feb 10 '12 at 13:06
2
I updated the steps to include an autosave option. Much more convenient!
– prrao
Feb 14 '12 at 15:14
|
show 10 more comments
I managed to find the perfect solution! For some reason, this didn't show up on my previous Google searches. I tailored my version of this solution: http://nimal.info/blog/2010/latex-on-windows-with-miktex-and-notepad/
My version (on a 64-bit Windows 7 machine) is as follows:
- Download and install Basic MiKTeX 2.9 (32-bit)
- Download and install SumatraPDF
- Create a batch file
miktex_to_latex.batand place it anywhere
- For easy location, place the batch file in the [Notepad++ installation Path]
Copy-paste the following into the batch file and save it
:: Called from Notepad++ Run
:: [path_to_bat_file] "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
:: Change Drive and to File Directory
%~d1
cd %1
:: Run Cleanup
call:cleanup
:: Run pdflatex -> bibtex -> pdflatex -> pdflatex
pdflatex %2
bibtex %2
:: If you are using multibib the following will run bibtex on all aux files
:: FOR /R . %%G IN (*.aux) DO bibtex %%G
pdflatex %2
pdflatex %2
:: Run Cleanup
call:cleanup
:: Open PDF
START "" "C:Progra~2SumatraPDFSumatraPDF.exe" %3 -reuse-instance
:: Cleanup Function
:cleanup
del *.dvi
del *.out
:: del *.log
:: del *.aux
:: del *.bbl
:: del *.blg
:: del *.brf
goto:eof
Take care of the following:
- All lines beginning with double colon
::are comments - the
STARTcommand should have the installation path of SumatraPDF - Make sure there are NO spaces in the path (Use
Progra~2, notProgram Files (X86)) - The
-reuse-instanceallows us to edit and recompile without quitting the PDF
- All lines beginning with double colon
Download (if it does not already exist) the NppExec plugin and place the
.dllfile in [Notepad++ installation path]pluginsOpen a
.texfile in Notepad++, click on F6 to execute
Type the following lines in the window that pops up:
NPP_SAVE
"<Path_to_bat_file>" "$(CURRENT_DIRECTORY)" "$(NAME_PART)" "$(NAME_PART).pdf"
In my case, this is:
NPP_SAVE
"C:Progra~2Notepad++miktex_to_latex.bat" "$(CURRENT_DIRECTORY)" "$(NAME_PART)" "$(NAME_PART).pdf"
The above lines basically tell NppExec to "save the current
.texfile, run the batch file, store results in current directory and name it the same as the.texfile"
Click on "Save" and type in a recognizable name such as 'PDFLaTex'
Go to the menubar, Plugins -> NppExec -> Advanced Options.. Under 'Menu item', choose the script we just created above, and 'Add/Modify' it to the Menu items with a suitable name. This allows us to assign shortcut keys through Settings -> Shortcut Mapper -> Plugin commands
Navigate to the script name and choose any shortcut key like Shift+F7
Press the shortcut key Shift+F7 to save and compile the
.texfile. The SumatraPDF window should pop up and show the compiled PDF. Changes can be made and the file recompiled without having to close the PDF.
The BEST parts about this method are:
- There is no need to keep pressing Ctrl+S to save and then compile to PDF. Everything is done in one key press!
- There is no need to keep closing the opened PDF and reopening it on recompiling (as in the case with Adobe Reader)
- It is very easy to cleanup all the junk files generated
- It is completely open-source and can be easily integrated with an existing Notepad++ installation
Thanks Nimal, Jonas, Bert and the others who contributed to this awesome solution!
16
be careful using the cleanup! any document that uses the information in the .aux will struggle if it is deleted every time. just try putting in one ref to a label and you'll see what i mean. Personally, I would recommend creating thecleanupfile as a separate batch file, and calling it separately
– cmhughes
Feb 10 '12 at 0:57
@cmhughes Thanks a lot, I'll keep that in mind. Is it only the .aux that I should be worried about? I'm pretty sure that PDFLaTex doesn't use the dvi file as that is an intermediate file. I'm guessing the .out file and the likes are also not that useful. Would it make sense to keep the .aux and delete the rest instead of calling the cleanup batch file separately?
– prrao
Feb 10 '12 at 2:32
4
The.bblfiles and friends are used bybiblatex; you are correct about the.dvifiles. I would seriously consider not deleting any of them until the document is finished, and just run yourcleanupfile at the end. Thedelcommand can be made to work recursively through your home directory, so you only need to run it once
– cmhughes
Feb 10 '12 at 3:23
Sure, that sounds fine. Thanks for the tip.
– prrao
Feb 10 '12 at 13:06
2
I updated the steps to include an autosave option. Much more convenient!
– prrao
Feb 14 '12 at 15:14
|
show 10 more comments
I managed to find the perfect solution! For some reason, this didn't show up on my previous Google searches. I tailored my version of this solution: http://nimal.info/blog/2010/latex-on-windows-with-miktex-and-notepad/
My version (on a 64-bit Windows 7 machine) is as follows:
- Download and install Basic MiKTeX 2.9 (32-bit)
- Download and install SumatraPDF
- Create a batch file
miktex_to_latex.batand place it anywhere
- For easy location, place the batch file in the [Notepad++ installation Path]
Copy-paste the following into the batch file and save it
:: Called from Notepad++ Run
:: [path_to_bat_file] "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
:: Change Drive and to File Directory
%~d1
cd %1
:: Run Cleanup
call:cleanup
:: Run pdflatex -> bibtex -> pdflatex -> pdflatex
pdflatex %2
bibtex %2
:: If you are using multibib the following will run bibtex on all aux files
:: FOR /R . %%G IN (*.aux) DO bibtex %%G
pdflatex %2
pdflatex %2
:: Run Cleanup
call:cleanup
:: Open PDF
START "" "C:Progra~2SumatraPDFSumatraPDF.exe" %3 -reuse-instance
:: Cleanup Function
:cleanup
del *.dvi
del *.out
:: del *.log
:: del *.aux
:: del *.bbl
:: del *.blg
:: del *.brf
goto:eof
Take care of the following:
- All lines beginning with double colon
::are comments - the
STARTcommand should have the installation path of SumatraPDF - Make sure there are NO spaces in the path (Use
Progra~2, notProgram Files (X86)) - The
-reuse-instanceallows us to edit and recompile without quitting the PDF
- All lines beginning with double colon
Download (if it does not already exist) the NppExec plugin and place the
.dllfile in [Notepad++ installation path]pluginsOpen a
.texfile in Notepad++, click on F6 to execute
Type the following lines in the window that pops up:
NPP_SAVE
"<Path_to_bat_file>" "$(CURRENT_DIRECTORY)" "$(NAME_PART)" "$(NAME_PART).pdf"
In my case, this is:
NPP_SAVE
"C:Progra~2Notepad++miktex_to_latex.bat" "$(CURRENT_DIRECTORY)" "$(NAME_PART)" "$(NAME_PART).pdf"
The above lines basically tell NppExec to "save the current
.texfile, run the batch file, store results in current directory and name it the same as the.texfile"
Click on "Save" and type in a recognizable name such as 'PDFLaTex'
Go to the menubar, Plugins -> NppExec -> Advanced Options.. Under 'Menu item', choose the script we just created above, and 'Add/Modify' it to the Menu items with a suitable name. This allows us to assign shortcut keys through Settings -> Shortcut Mapper -> Plugin commands
Navigate to the script name and choose any shortcut key like Shift+F7
Press the shortcut key Shift+F7 to save and compile the
.texfile. The SumatraPDF window should pop up and show the compiled PDF. Changes can be made and the file recompiled without having to close the PDF.
The BEST parts about this method are:
- There is no need to keep pressing Ctrl+S to save and then compile to PDF. Everything is done in one key press!
- There is no need to keep closing the opened PDF and reopening it on recompiling (as in the case with Adobe Reader)
- It is very easy to cleanup all the junk files generated
- It is completely open-source and can be easily integrated with an existing Notepad++ installation
Thanks Nimal, Jonas, Bert and the others who contributed to this awesome solution!
I managed to find the perfect solution! For some reason, this didn't show up on my previous Google searches. I tailored my version of this solution: http://nimal.info/blog/2010/latex-on-windows-with-miktex-and-notepad/
My version (on a 64-bit Windows 7 machine) is as follows:
- Download and install Basic MiKTeX 2.9 (32-bit)
- Download and install SumatraPDF
- Create a batch file
miktex_to_latex.batand place it anywhere
- For easy location, place the batch file in the [Notepad++ installation Path]
Copy-paste the following into the batch file and save it
:: Called from Notepad++ Run
:: [path_to_bat_file] "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
:: Change Drive and to File Directory
%~d1
cd %1
:: Run Cleanup
call:cleanup
:: Run pdflatex -> bibtex -> pdflatex -> pdflatex
pdflatex %2
bibtex %2
:: If you are using multibib the following will run bibtex on all aux files
:: FOR /R . %%G IN (*.aux) DO bibtex %%G
pdflatex %2
pdflatex %2
:: Run Cleanup
call:cleanup
:: Open PDF
START "" "C:Progra~2SumatraPDFSumatraPDF.exe" %3 -reuse-instance
:: Cleanup Function
:cleanup
del *.dvi
del *.out
:: del *.log
:: del *.aux
:: del *.bbl
:: del *.blg
:: del *.brf
goto:eof
Take care of the following:
- All lines beginning with double colon
::are comments - the
STARTcommand should have the installation path of SumatraPDF - Make sure there are NO spaces in the path (Use
Progra~2, notProgram Files (X86)) - The
-reuse-instanceallows us to edit and recompile without quitting the PDF
- All lines beginning with double colon
Download (if it does not already exist) the NppExec plugin and place the
.dllfile in [Notepad++ installation path]pluginsOpen a
.texfile in Notepad++, click on F6 to execute
Type the following lines in the window that pops up:
NPP_SAVE
"<Path_to_bat_file>" "$(CURRENT_DIRECTORY)" "$(NAME_PART)" "$(NAME_PART).pdf"
In my case, this is:
NPP_SAVE
"C:Progra~2Notepad++miktex_to_latex.bat" "$(CURRENT_DIRECTORY)" "$(NAME_PART)" "$(NAME_PART).pdf"
The above lines basically tell NppExec to "save the current
.texfile, run the batch file, store results in current directory and name it the same as the.texfile"
Click on "Save" and type in a recognizable name such as 'PDFLaTex'
Go to the menubar, Plugins -> NppExec -> Advanced Options.. Under 'Menu item', choose the script we just created above, and 'Add/Modify' it to the Menu items with a suitable name. This allows us to assign shortcut keys through Settings -> Shortcut Mapper -> Plugin commands
Navigate to the script name and choose any shortcut key like Shift+F7
Press the shortcut key Shift+F7 to save and compile the
.texfile. The SumatraPDF window should pop up and show the compiled PDF. Changes can be made and the file recompiled without having to close the PDF.
The BEST parts about this method are:
- There is no need to keep pressing Ctrl+S to save and then compile to PDF. Everything is done in one key press!
- There is no need to keep closing the opened PDF and reopening it on recompiling (as in the case with Adobe Reader)
- It is very easy to cleanup all the junk files generated
- It is completely open-source and can be easily integrated with an existing Notepad++ installation
Thanks Nimal, Jonas, Bert and the others who contributed to this awesome solution!
edited Mar 6 '13 at 21:56
Speravir
14.3k1061120
14.3k1061120
answered Feb 10 '12 at 0:31
prraoprrao
1,09321012
1,09321012
16
be careful using the cleanup! any document that uses the information in the .aux will struggle if it is deleted every time. just try putting in one ref to a label and you'll see what i mean. Personally, I would recommend creating thecleanupfile as a separate batch file, and calling it separately
– cmhughes
Feb 10 '12 at 0:57
@cmhughes Thanks a lot, I'll keep that in mind. Is it only the .aux that I should be worried about? I'm pretty sure that PDFLaTex doesn't use the dvi file as that is an intermediate file. I'm guessing the .out file and the likes are also not that useful. Would it make sense to keep the .aux and delete the rest instead of calling the cleanup batch file separately?
– prrao
Feb 10 '12 at 2:32
4
The.bblfiles and friends are used bybiblatex; you are correct about the.dvifiles. I would seriously consider not deleting any of them until the document is finished, and just run yourcleanupfile at the end. Thedelcommand can be made to work recursively through your home directory, so you only need to run it once
– cmhughes
Feb 10 '12 at 3:23
Sure, that sounds fine. Thanks for the tip.
– prrao
Feb 10 '12 at 13:06
2
I updated the steps to include an autosave option. Much more convenient!
– prrao
Feb 14 '12 at 15:14
|
show 10 more comments
16
be careful using the cleanup! any document that uses the information in the .aux will struggle if it is deleted every time. just try putting in one ref to a label and you'll see what i mean. Personally, I would recommend creating thecleanupfile as a separate batch file, and calling it separately
– cmhughes
Feb 10 '12 at 0:57
@cmhughes Thanks a lot, I'll keep that in mind. Is it only the .aux that I should be worried about? I'm pretty sure that PDFLaTex doesn't use the dvi file as that is an intermediate file. I'm guessing the .out file and the likes are also not that useful. Would it make sense to keep the .aux and delete the rest instead of calling the cleanup batch file separately?
– prrao
Feb 10 '12 at 2:32
4
The.bblfiles and friends are used bybiblatex; you are correct about the.dvifiles. I would seriously consider not deleting any of them until the document is finished, and just run yourcleanupfile at the end. Thedelcommand can be made to work recursively through your home directory, so you only need to run it once
– cmhughes
Feb 10 '12 at 3:23
Sure, that sounds fine. Thanks for the tip.
– prrao
Feb 10 '12 at 13:06
2
I updated the steps to include an autosave option. Much more convenient!
– prrao
Feb 14 '12 at 15:14
16
16
be careful using the cleanup! any document that uses the information in the .aux will struggle if it is deleted every time. just try putting in one ref to a label and you'll see what i mean. Personally, I would recommend creating the
cleanup file as a separate batch file, and calling it separately– cmhughes
Feb 10 '12 at 0:57
be careful using the cleanup! any document that uses the information in the .aux will struggle if it is deleted every time. just try putting in one ref to a label and you'll see what i mean. Personally, I would recommend creating the
cleanup file as a separate batch file, and calling it separately– cmhughes
Feb 10 '12 at 0:57
@cmhughes Thanks a lot, I'll keep that in mind. Is it only the .aux that I should be worried about? I'm pretty sure that PDFLaTex doesn't use the dvi file as that is an intermediate file. I'm guessing the .out file and the likes are also not that useful. Would it make sense to keep the .aux and delete the rest instead of calling the cleanup batch file separately?
– prrao
Feb 10 '12 at 2:32
@cmhughes Thanks a lot, I'll keep that in mind. Is it only the .aux that I should be worried about? I'm pretty sure that PDFLaTex doesn't use the dvi file as that is an intermediate file. I'm guessing the .out file and the likes are also not that useful. Would it make sense to keep the .aux and delete the rest instead of calling the cleanup batch file separately?
– prrao
Feb 10 '12 at 2:32
4
4
The
.bbl files and friends are used by biblatex; you are correct about the .dvi files. I would seriously consider not deleting any of them until the document is finished, and just run your cleanup file at the end. The del command can be made to work recursively through your home directory, so you only need to run it once– cmhughes
Feb 10 '12 at 3:23
The
.bbl files and friends are used by biblatex; you are correct about the .dvi files. I would seriously consider not deleting any of them until the document is finished, and just run your cleanup file at the end. The del command can be made to work recursively through your home directory, so you only need to run it once– cmhughes
Feb 10 '12 at 3:23
Sure, that sounds fine. Thanks for the tip.
– prrao
Feb 10 '12 at 13:06
Sure, that sounds fine. Thanks for the tip.
– prrao
Feb 10 '12 at 13:06
2
2
I updated the steps to include an autosave option. Much more convenient!
– prrao
Feb 14 '12 at 15:14
I updated the steps to include an autosave option. Much more convenient!
– prrao
Feb 14 '12 at 15:14
|
show 10 more comments
I've stumbled through a bunch of different IDE's and honestly I think that notepad++ is one of the most underrated options available to anyone doing TeX stuff.
Along that line, I think that most of these other options, which I started with, are overly complicated when we have tools like arara and latexmk. They all work fabulously well, and I greatly appreciate the help they have given me, but I think we should use all the tools available to us. I personally love arara and I have my way that I now use every day that leans on arara more than notepad++.
This is my notepad++ set up in NppExec
NPP_SAVEALL
cd $(CURRENT_DIRECTORY)
arara $(NAME_PART)
No batch files necessary. In my documents, I usually use a variation on this set of rules.
% arara: pdflatex: { synctex: on, shell: off }
% arara: biber
% arara: pdflatex: { synctex: on, shell: off }
% arara: pdflatex: { synctex: on, shell: off }
% arara: clean: { files: [ foo.log, foo.aux, foo.bbl, foo.blg, foo.log, foo.run.xml, foo-blx.bib, foo.bcf, foo.out ] }
% arara: sumatrapdf
The pdflatex,biber and clean are all included in arara. sumatrapdf is mine, but is exceedingly simple. arara also supplies a bibtex rule which is just as simple to call, but I prefer biber.
sumatrapdf.yaml
!config
# SumatraPDF rule for arara
# Author: Mr Komandez
identifier: sumatrapdf
name: SumatraPDF
commands:
- <arara> DIRECTORY/sumatra.bat "@{getBasename(file)}.pdf" "@{options}"
arguments:
- identifier: options
flag: <arara> @{parameters.options}
sumatra.bat
START /b "C:Progra~2SumatraPDFSumatraPDF.exe" %1 -reuse-instance %2
EXIT
This way, from the source code you can change your compilation options on the fly, but your actual compilation can stay key-bound the same way.
add a comment |
I've stumbled through a bunch of different IDE's and honestly I think that notepad++ is one of the most underrated options available to anyone doing TeX stuff.
Along that line, I think that most of these other options, which I started with, are overly complicated when we have tools like arara and latexmk. They all work fabulously well, and I greatly appreciate the help they have given me, but I think we should use all the tools available to us. I personally love arara and I have my way that I now use every day that leans on arara more than notepad++.
This is my notepad++ set up in NppExec
NPP_SAVEALL
cd $(CURRENT_DIRECTORY)
arara $(NAME_PART)
No batch files necessary. In my documents, I usually use a variation on this set of rules.
% arara: pdflatex: { synctex: on, shell: off }
% arara: biber
% arara: pdflatex: { synctex: on, shell: off }
% arara: pdflatex: { synctex: on, shell: off }
% arara: clean: { files: [ foo.log, foo.aux, foo.bbl, foo.blg, foo.log, foo.run.xml, foo-blx.bib, foo.bcf, foo.out ] }
% arara: sumatrapdf
The pdflatex,biber and clean are all included in arara. sumatrapdf is mine, but is exceedingly simple. arara also supplies a bibtex rule which is just as simple to call, but I prefer biber.
sumatrapdf.yaml
!config
# SumatraPDF rule for arara
# Author: Mr Komandez
identifier: sumatrapdf
name: SumatraPDF
commands:
- <arara> DIRECTORY/sumatra.bat "@{getBasename(file)}.pdf" "@{options}"
arguments:
- identifier: options
flag: <arara> @{parameters.options}
sumatra.bat
START /b "C:Progra~2SumatraPDFSumatraPDF.exe" %1 -reuse-instance %2
EXIT
This way, from the source code you can change your compilation options on the fly, but your actual compilation can stay key-bound the same way.
add a comment |
I've stumbled through a bunch of different IDE's and honestly I think that notepad++ is one of the most underrated options available to anyone doing TeX stuff.
Along that line, I think that most of these other options, which I started with, are overly complicated when we have tools like arara and latexmk. They all work fabulously well, and I greatly appreciate the help they have given me, but I think we should use all the tools available to us. I personally love arara and I have my way that I now use every day that leans on arara more than notepad++.
This is my notepad++ set up in NppExec
NPP_SAVEALL
cd $(CURRENT_DIRECTORY)
arara $(NAME_PART)
No batch files necessary. In my documents, I usually use a variation on this set of rules.
% arara: pdflatex: { synctex: on, shell: off }
% arara: biber
% arara: pdflatex: { synctex: on, shell: off }
% arara: pdflatex: { synctex: on, shell: off }
% arara: clean: { files: [ foo.log, foo.aux, foo.bbl, foo.blg, foo.log, foo.run.xml, foo-blx.bib, foo.bcf, foo.out ] }
% arara: sumatrapdf
The pdflatex,biber and clean are all included in arara. sumatrapdf is mine, but is exceedingly simple. arara also supplies a bibtex rule which is just as simple to call, but I prefer biber.
sumatrapdf.yaml
!config
# SumatraPDF rule for arara
# Author: Mr Komandez
identifier: sumatrapdf
name: SumatraPDF
commands:
- <arara> DIRECTORY/sumatra.bat "@{getBasename(file)}.pdf" "@{options}"
arguments:
- identifier: options
flag: <arara> @{parameters.options}
sumatra.bat
START /b "C:Progra~2SumatraPDFSumatraPDF.exe" %1 -reuse-instance %2
EXIT
This way, from the source code you can change your compilation options on the fly, but your actual compilation can stay key-bound the same way.
I've stumbled through a bunch of different IDE's and honestly I think that notepad++ is one of the most underrated options available to anyone doing TeX stuff.
Along that line, I think that most of these other options, which I started with, are overly complicated when we have tools like arara and latexmk. They all work fabulously well, and I greatly appreciate the help they have given me, but I think we should use all the tools available to us. I personally love arara and I have my way that I now use every day that leans on arara more than notepad++.
This is my notepad++ set up in NppExec
NPP_SAVEALL
cd $(CURRENT_DIRECTORY)
arara $(NAME_PART)
No batch files necessary. In my documents, I usually use a variation on this set of rules.
% arara: pdflatex: { synctex: on, shell: off }
% arara: biber
% arara: pdflatex: { synctex: on, shell: off }
% arara: pdflatex: { synctex: on, shell: off }
% arara: clean: { files: [ foo.log, foo.aux, foo.bbl, foo.blg, foo.log, foo.run.xml, foo-blx.bib, foo.bcf, foo.out ] }
% arara: sumatrapdf
The pdflatex,biber and clean are all included in arara. sumatrapdf is mine, but is exceedingly simple. arara also supplies a bibtex rule which is just as simple to call, but I prefer biber.
sumatrapdf.yaml
!config
# SumatraPDF rule for arara
# Author: Mr Komandez
identifier: sumatrapdf
name: SumatraPDF
commands:
- <arara> DIRECTORY/sumatra.bat "@{getBasename(file)}.pdf" "@{options}"
arguments:
- identifier: options
flag: <arara> @{parameters.options}
sumatra.bat
START /b "C:Progra~2SumatraPDFSumatraPDF.exe" %1 -reuse-instance %2
EXIT
This way, from the source code you can change your compilation options on the fly, but your actual compilation can stay key-bound the same way.
answered Oct 16 '13 at 0:42
Mr KomandezMr Komandez
17318
17318
add a comment |
add a comment |
This would be a comment, but for length. I contributed to the batch file above, but here's my latest version:
:: Called from Notepad++ Run
:: [path_to_bat_file] "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
:: Change Drive and to File Directory
%~d1
cd %1
:: Run Cleanup
call:cleanup
:: Run pdflatex -> bibtex -> pdflatex -> pdflatex
pdflatex %2
bibtex %2
:: If you are using multibib the following will run bibtex on all aux files
:: FOR /R . %%G IN (*.aux) DO bibtex %%G
pdflatex %2
pdflatex %2
:: Open PDF (Script updated based on comments by 'menfeser'
:: START "" "C:Program FilesAdobeReader 9.0ReaderAcroRd32.exe" %2.pdf
if (%3)==() goto cleanup
::START "" %2.pdf
set str=%date%_%time%
set str=%str:/=-%
set str=%str::=-%
set str=%str: =_%
ren %2.pdf %2_%str%.pdf
"C:Program FilesFoxit SoftwareFoxit ReaderFoxit Reader.exe" %2_%str%.pdf
:: Cleanup Function
if %3==noclean goto eof
:cleanup
del *.log
del *.dvi
del *.aux
del *.bbl
del *.blg
del *.brf
del *.out
:eof
It's called with 3 parameters - directory, filename, and a third, which can be "noclean" to keep temp files, blank to clean up but not view pdf, and anything else to show the pdf. I map [shift]+F5 to view and clean, and [ctrl]+F5 to view without cleaning.
As there's currently no windows pdf viewer that doesn't lock the file on opening (my original reason for preferring foxit) the batch file renames the output pdf to put a date/time stamp in the file name before opening, allowing the next build to be opened without errors.
Another macro to call ASpell is handy as well.
Doesn't SumatraPDF have a 32-bit Windows version? It doesn't lock the PDF on opening so LaTeX can definitely update it dynamically
– prrao
Aug 2 '13 at 21:54
I think there is, I rather liked the way foxit reopens in a new tab, keeping the previous copy open, so I fixed the batch file rather than installing something else.
– Chris H
Aug 4 '13 at 10:39
add a comment |
This would be a comment, but for length. I contributed to the batch file above, but here's my latest version:
:: Called from Notepad++ Run
:: [path_to_bat_file] "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
:: Change Drive and to File Directory
%~d1
cd %1
:: Run Cleanup
call:cleanup
:: Run pdflatex -> bibtex -> pdflatex -> pdflatex
pdflatex %2
bibtex %2
:: If you are using multibib the following will run bibtex on all aux files
:: FOR /R . %%G IN (*.aux) DO bibtex %%G
pdflatex %2
pdflatex %2
:: Open PDF (Script updated based on comments by 'menfeser'
:: START "" "C:Program FilesAdobeReader 9.0ReaderAcroRd32.exe" %2.pdf
if (%3)==() goto cleanup
::START "" %2.pdf
set str=%date%_%time%
set str=%str:/=-%
set str=%str::=-%
set str=%str: =_%
ren %2.pdf %2_%str%.pdf
"C:Program FilesFoxit SoftwareFoxit ReaderFoxit Reader.exe" %2_%str%.pdf
:: Cleanup Function
if %3==noclean goto eof
:cleanup
del *.log
del *.dvi
del *.aux
del *.bbl
del *.blg
del *.brf
del *.out
:eof
It's called with 3 parameters - directory, filename, and a third, which can be "noclean" to keep temp files, blank to clean up but not view pdf, and anything else to show the pdf. I map [shift]+F5 to view and clean, and [ctrl]+F5 to view without cleaning.
As there's currently no windows pdf viewer that doesn't lock the file on opening (my original reason for preferring foxit) the batch file renames the output pdf to put a date/time stamp in the file name before opening, allowing the next build to be opened without errors.
Another macro to call ASpell is handy as well.
Doesn't SumatraPDF have a 32-bit Windows version? It doesn't lock the PDF on opening so LaTeX can definitely update it dynamically
– prrao
Aug 2 '13 at 21:54
I think there is, I rather liked the way foxit reopens in a new tab, keeping the previous copy open, so I fixed the batch file rather than installing something else.
– Chris H
Aug 4 '13 at 10:39
add a comment |
This would be a comment, but for length. I contributed to the batch file above, but here's my latest version:
:: Called from Notepad++ Run
:: [path_to_bat_file] "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
:: Change Drive and to File Directory
%~d1
cd %1
:: Run Cleanup
call:cleanup
:: Run pdflatex -> bibtex -> pdflatex -> pdflatex
pdflatex %2
bibtex %2
:: If you are using multibib the following will run bibtex on all aux files
:: FOR /R . %%G IN (*.aux) DO bibtex %%G
pdflatex %2
pdflatex %2
:: Open PDF (Script updated based on comments by 'menfeser'
:: START "" "C:Program FilesAdobeReader 9.0ReaderAcroRd32.exe" %2.pdf
if (%3)==() goto cleanup
::START "" %2.pdf
set str=%date%_%time%
set str=%str:/=-%
set str=%str::=-%
set str=%str: =_%
ren %2.pdf %2_%str%.pdf
"C:Program FilesFoxit SoftwareFoxit ReaderFoxit Reader.exe" %2_%str%.pdf
:: Cleanup Function
if %3==noclean goto eof
:cleanup
del *.log
del *.dvi
del *.aux
del *.bbl
del *.blg
del *.brf
del *.out
:eof
It's called with 3 parameters - directory, filename, and a third, which can be "noclean" to keep temp files, blank to clean up but not view pdf, and anything else to show the pdf. I map [shift]+F5 to view and clean, and [ctrl]+F5 to view without cleaning.
As there's currently no windows pdf viewer that doesn't lock the file on opening (my original reason for preferring foxit) the batch file renames the output pdf to put a date/time stamp in the file name before opening, allowing the next build to be opened without errors.
Another macro to call ASpell is handy as well.
This would be a comment, but for length. I contributed to the batch file above, but here's my latest version:
:: Called from Notepad++ Run
:: [path_to_bat_file] "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
:: Change Drive and to File Directory
%~d1
cd %1
:: Run Cleanup
call:cleanup
:: Run pdflatex -> bibtex -> pdflatex -> pdflatex
pdflatex %2
bibtex %2
:: If you are using multibib the following will run bibtex on all aux files
:: FOR /R . %%G IN (*.aux) DO bibtex %%G
pdflatex %2
pdflatex %2
:: Open PDF (Script updated based on comments by 'menfeser'
:: START "" "C:Program FilesAdobeReader 9.0ReaderAcroRd32.exe" %2.pdf
if (%3)==() goto cleanup
::START "" %2.pdf
set str=%date%_%time%
set str=%str:/=-%
set str=%str::=-%
set str=%str: =_%
ren %2.pdf %2_%str%.pdf
"C:Program FilesFoxit SoftwareFoxit ReaderFoxit Reader.exe" %2_%str%.pdf
:: Cleanup Function
if %3==noclean goto eof
:cleanup
del *.log
del *.dvi
del *.aux
del *.bbl
del *.blg
del *.brf
del *.out
:eof
It's called with 3 parameters - directory, filename, and a third, which can be "noclean" to keep temp files, blank to clean up but not view pdf, and anything else to show the pdf. I map [shift]+F5 to view and clean, and [ctrl]+F5 to view without cleaning.
As there's currently no windows pdf viewer that doesn't lock the file on opening (my original reason for preferring foxit) the batch file renames the output pdf to put a date/time stamp in the file name before opening, allowing the next build to be opened without errors.
Another macro to call ASpell is handy as well.
answered Jul 31 '13 at 13:47
Chris HChris H
6,31622051
6,31622051
Doesn't SumatraPDF have a 32-bit Windows version? It doesn't lock the PDF on opening so LaTeX can definitely update it dynamically
– prrao
Aug 2 '13 at 21:54
I think there is, I rather liked the way foxit reopens in a new tab, keeping the previous copy open, so I fixed the batch file rather than installing something else.
– Chris H
Aug 4 '13 at 10:39
add a comment |
Doesn't SumatraPDF have a 32-bit Windows version? It doesn't lock the PDF on opening so LaTeX can definitely update it dynamically
– prrao
Aug 2 '13 at 21:54
I think there is, I rather liked the way foxit reopens in a new tab, keeping the previous copy open, so I fixed the batch file rather than installing something else.
– Chris H
Aug 4 '13 at 10:39
Doesn't SumatraPDF have a 32-bit Windows version? It doesn't lock the PDF on opening so LaTeX can definitely update it dynamically
– prrao
Aug 2 '13 at 21:54
Doesn't SumatraPDF have a 32-bit Windows version? It doesn't lock the PDF on opening so LaTeX can definitely update it dynamically
– prrao
Aug 2 '13 at 21:54
I think there is, I rather liked the way foxit reopens in a new tab, keeping the previous copy open, so I fixed the batch file rather than installing something else.
– Chris H
Aug 4 '13 at 10:39
I think there is, I rather liked the way foxit reopens in a new tab, keeping the previous copy open, so I fixed the batch file rather than installing something else.
– Chris H
Aug 4 '13 at 10:39
add a comment |
As mr-komandez mentioned, there is also latexmk. It can completely automate the process for you. One of the coolest features of this package is the -pvc-switch, which provides a continuous mode. So every time you save a file in the workspace, latexmk will run the necessary toolchain to compile. It has a lot of options, but for bibtex/pdflatex you can do this (assuming you have the NppExec plugin set up):
Setup Notepad++ with NppExec
- Open Notepad++
- Go to Plugins -> NppExec -> Execute... (or press F6).
- Type the following in the
Commands(s)textfield:
NppExec Command (with -pvc switch)
NPP_SAVE
cd $(CURRENT_DIRECTORY)
latexmk -pvc -pdf -latex=pdflatex -latexoption="-synctex=1 -interaction=nonstopmode -file-line-error -recorder" -bibtex main.tex
- Press the save button and give it a good name.
- NppExec will immediately execute and if you have the console open (toggle it with
ctrl+~), you can see any errors in the compile log.
NppExec Command (without -pvc switch)
If you want more control over things like cleaning directories on some runs, use different engines (such as xelatex) or for some reason you do not like to have -pvc doing its thing. You can also setup NppExec with hotkeys and amend the above with anything specified in the latexmk manual, there are quite the repertoire of options and switches you can use. If you follow the steps above, remove the -pvc and make any changes you see fit, you can then use the saved commands in the following way:
- In Notepad++, go to Plugins -> NppExec -> Advanced Options.
- In the window that pops up, you can see `Associated Scripts" at the bottom left.
- Select the saved script, from here you can add hotkeys to different runs for ease of access.

A last note
Since you are using MiKTeX, you can also use the -aux-dir= & -outdir=-switches, which will put all auxiliary files/compiled files in subfolders as specified.
add a comment |
As mr-komandez mentioned, there is also latexmk. It can completely automate the process for you. One of the coolest features of this package is the -pvc-switch, which provides a continuous mode. So every time you save a file in the workspace, latexmk will run the necessary toolchain to compile. It has a lot of options, but for bibtex/pdflatex you can do this (assuming you have the NppExec plugin set up):
Setup Notepad++ with NppExec
- Open Notepad++
- Go to Plugins -> NppExec -> Execute... (or press F6).
- Type the following in the
Commands(s)textfield:
NppExec Command (with -pvc switch)
NPP_SAVE
cd $(CURRENT_DIRECTORY)
latexmk -pvc -pdf -latex=pdflatex -latexoption="-synctex=1 -interaction=nonstopmode -file-line-error -recorder" -bibtex main.tex
- Press the save button and give it a good name.
- NppExec will immediately execute and if you have the console open (toggle it with
ctrl+~), you can see any errors in the compile log.
NppExec Command (without -pvc switch)
If you want more control over things like cleaning directories on some runs, use different engines (such as xelatex) or for some reason you do not like to have -pvc doing its thing. You can also setup NppExec with hotkeys and amend the above with anything specified in the latexmk manual, there are quite the repertoire of options and switches you can use. If you follow the steps above, remove the -pvc and make any changes you see fit, you can then use the saved commands in the following way:
- In Notepad++, go to Plugins -> NppExec -> Advanced Options.
- In the window that pops up, you can see `Associated Scripts" at the bottom left.
- Select the saved script, from here you can add hotkeys to different runs for ease of access.

A last note
Since you are using MiKTeX, you can also use the -aux-dir= & -outdir=-switches, which will put all auxiliary files/compiled files in subfolders as specified.
add a comment |
As mr-komandez mentioned, there is also latexmk. It can completely automate the process for you. One of the coolest features of this package is the -pvc-switch, which provides a continuous mode. So every time you save a file in the workspace, latexmk will run the necessary toolchain to compile. It has a lot of options, but for bibtex/pdflatex you can do this (assuming you have the NppExec plugin set up):
Setup Notepad++ with NppExec
- Open Notepad++
- Go to Plugins -> NppExec -> Execute... (or press F6).
- Type the following in the
Commands(s)textfield:
NppExec Command (with -pvc switch)
NPP_SAVE
cd $(CURRENT_DIRECTORY)
latexmk -pvc -pdf -latex=pdflatex -latexoption="-synctex=1 -interaction=nonstopmode -file-line-error -recorder" -bibtex main.tex
- Press the save button and give it a good name.
- NppExec will immediately execute and if you have the console open (toggle it with
ctrl+~), you can see any errors in the compile log.
NppExec Command (without -pvc switch)
If you want more control over things like cleaning directories on some runs, use different engines (such as xelatex) or for some reason you do not like to have -pvc doing its thing. You can also setup NppExec with hotkeys and amend the above with anything specified in the latexmk manual, there are quite the repertoire of options and switches you can use. If you follow the steps above, remove the -pvc and make any changes you see fit, you can then use the saved commands in the following way:
- In Notepad++, go to Plugins -> NppExec -> Advanced Options.
- In the window that pops up, you can see `Associated Scripts" at the bottom left.
- Select the saved script, from here you can add hotkeys to different runs for ease of access.

A last note
Since you are using MiKTeX, you can also use the -aux-dir= & -outdir=-switches, which will put all auxiliary files/compiled files in subfolders as specified.
As mr-komandez mentioned, there is also latexmk. It can completely automate the process for you. One of the coolest features of this package is the -pvc-switch, which provides a continuous mode. So every time you save a file in the workspace, latexmk will run the necessary toolchain to compile. It has a lot of options, but for bibtex/pdflatex you can do this (assuming you have the NppExec plugin set up):
Setup Notepad++ with NppExec
- Open Notepad++
- Go to Plugins -> NppExec -> Execute... (or press F6).
- Type the following in the
Commands(s)textfield:
NppExec Command (with -pvc switch)
NPP_SAVE
cd $(CURRENT_DIRECTORY)
latexmk -pvc -pdf -latex=pdflatex -latexoption="-synctex=1 -interaction=nonstopmode -file-line-error -recorder" -bibtex main.tex
- Press the save button and give it a good name.
- NppExec will immediately execute and if you have the console open (toggle it with
ctrl+~), you can see any errors in the compile log.
NppExec Command (without -pvc switch)
If you want more control over things like cleaning directories on some runs, use different engines (such as xelatex) or for some reason you do not like to have -pvc doing its thing. You can also setup NppExec with hotkeys and amend the above with anything specified in the latexmk manual, there are quite the repertoire of options and switches you can use. If you follow the steps above, remove the -pvc and make any changes you see fit, you can then use the saved commands in the following way:
- In Notepad++, go to Plugins -> NppExec -> Advanced Options.
- In the window that pops up, you can see `Associated Scripts" at the bottom left.
- Select the saved script, from here you can add hotkeys to different runs for ease of access.

A last note
Since you are using MiKTeX, you can also use the -aux-dir= & -outdir=-switches, which will put all auxiliary files/compiled files in subfolders as specified.
answered Nov 12 '18 at 14:36
Ole AndersOle Anders
341112
341112
add a comment |
add a comment |
protected by Community♦ Dec 16 '13 at 21:23
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
see the manual of notepad: Doc on command and shortcuts
– zeroth
Feb 9 '12 at 18:42