LaTeX on Windows Subsystem for Linux in Sublime Text

Duplicating the whole TeX distribution on both Windows and Windows Subsystem for Linux (WSL) is not only a waste of disk space, it is also a maintainability nightmare. Now to build LaTeX documents from Sublime Text 3 as Windows application is quite easy if you have WSL with texlive up and running. Select “Tools”->”Build System”->”New Build System” and paste the following

  "cmd" : ["bash", "-c", "latexmk -xelatex -pdf ${file_name}"],
  "shell": true,
  "working_dir": "${file_path}",

Save as WSLLatex.sublime-build in the folder Sublime Text suggests (should be C:\Users\USERNAME\AppData\Roaming\Sublime Text 3\Packages\User). Now install latexmk on WSL

apt-get install latexmk

which automatically runs the LaTeX compilers and BibTeX the required number of times so resolve all references and finalise the layout. Now in Sublime Text Ctrl+B will run the LaTeX build in the WSL environment.

Leave a comment

Your email address will not be published.