Monday, May 27, 2013

How To build your TeX file using LaTeX on Sublime Text


How To build your TeX file using LaTeX on Sublime Text
LaTeX and Sublime Text
Sublime Text 2 (the 3rd release is about to come) is one of the smarter and most elegant editors on the scene nowadays. It comes with a lot of interesting functions, and it can easily be enriched with plugins using its awesome Package Control function.

While I was writing my thesis about Kurt Gödel I discovered LaTeX, an incredible markup language which I felt in love with; it passed just a short time before I desired to use it with Sublime Text, but when I installed the LatexTools package via Package Control I had to face a little problem in order to make it work.

First of all: I think you already installed TexLive (a LaTeX distribution with many LaTeX tools) but if you did not, you can do so by typing this in your terminal:

sudo apt-get install texlive

Now you can try (as I did) to build your .tex file in Sublime Text by pressing Ctrl+B. Unfortunately, all I got at this point was this error message:

COULD NOT COMPILE!
Attempted command:latexmk -cd -e $pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 %S' -f -pdf <your-tex-file-path>


Read carefully these lines: what Sublime Text is trying to tell you is that it needs the latexmk package to build your file, and you didn't previously install it.
If you're encountering the same problem, the solution is trivial: you just have to install the latexmk package. Write this you your terminal:

sudo apt-get install latexmk

Now try again: you'll find that Sublime is now correctly building your tex file.

No comments:

Post a Comment