In the last several years, the common workflow for using LaTeX has changed
since I first learned it. In particular, bibtex has been to a large degree
superseded by biblatex-biber.
Additionally, while I used to use
pdftex to build pdfs, it doesn’t
support unicode. After reading Joel Spolsky’s article about
unicode, I decided this
is a hard requirement, so pdftex was out. While both
XeTeX and LuaTeX
projects have addressed this issue, it seems like XeTeX is more mainstream.
Finally, for the build process, I used things like
Vim-LaTeX or
AucTeX (or sometimes a manually written
Makefile
). The latexmk package (not to be
confused with the LaTeX-Mk package, which
hasn’t seen an update since 2010-12-28 and is not part of the MikTeX
distribution) now does an excellent job of managing the building of your pdf.
This post outlines my new work flow that takes advantage of the latest tools in
the TeX/LaTeX world.
First, install TeX Live (use your package
manager if you can so you automatically will get updates). The first thing to
set up is latexmk. latexmk has a few options that are worth configuring (man
latexmk
will give you all the gory details). I put the following in my
~/.config/latexmk/latexmkrc
:
|
|
Open up your favorite editor and create example.tex
with the following contents
|
|
and references.bib
with
|
|
Now to have latexmk build example.tex
into the pdf enter this into your terminal
latexmk -pvc -pdf ./example.tex
This should immediately build your pdf and open it up using evince
. In
another terminal, start editing the .tex file or the .bib file. As soon as you
save example.tex
, example.pdf
should automatically be
rebuilt and the updated result shown in evince. This can sometimes be
problematic if there are build errors, but the -interaction=nonstopmode
will
prevent the build from hanging so once you fix the problem it should
automatically get fixed. latexmk automatically determines dependencies, so if
you have files included/input into your main .tex file, it will update the
build appropriately as soon as it detects a change to the file (not just a time
stamp change, but an actual content change).
I haven’t yet gotten synctex to work with vim, but that option is enabled above so it should just be a matter of figuring out how to configure vim correctly. I’ll leave that for another day. Also, there is another TeX build automation tool called arara that looks pretty promising. It looked like a bit more work and it didn’t come bundled with TeXLive, so I stuck with latexmk, but I’ll keep an eye on arara down the road.