Notepad++ is a versatile text editor and source code editor for Windows. I use it as my default text editor on Windows. For convenience of compiling .tex files while editing we can simply add a run command to Notepad++.
This is a simple “how to” for conveniently using Notepad++ as the editor for LaTex (using MiKTex) on Windows.
- Install MiKTeX
- Install Notepad++. (This comes with syntax highlighting for LaTeX, but for BibTex add the user style.)
- (Optional) Install Sumatra PDF
- Create a .bat file with the following code:
:: 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 (Script updated based on comments by 'menfeser' :: START "" "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe" %2.pdf START "" %2.pdf :: (Alternative) Open PDF with Sumatra PDF :: START "" "C:\Progra~2\SumatraPDF\SumatraPDF.exe" %2.pdf -reuse-instance :: Cleanup Function :cleanup :: del *.log del *.dvi del *.aux del *.bbl del *.blg del *.brf del *.out goto:eof
- Add the batch file as a run command:
- Notepad++ -> Run -> <PATH_TO_BAT_FILE> “$(CURRENT_DIRECTORY)” “$(NAME_PART)”
- (Note the surrounded ” before and after CURRENT_DIRECTOR and NAME_PART)
- Create a keyboard shortcut for this.
- Now create a LaTeX file in Notepad++, Save and Run (using the short key defined).
- MiKTex should be added automatically to Windows “path” when it is installed, if not add “WHERE_MIKTEX_INSTALLED\miktex\bin” to path manually.
- This is just a work flow that works for me, you can modify it to suit yours.
- Plagiarised from various sources on the Internet. 🙂