Managing Rendering of LaTeX
Posted by Elnu on#programming
Previously I’ve used pdflatex
to render my LaTeX
documents, but I’ve just come across latexmk
, which
provides much more powerful options. Here’s a list of the commands
I make use of, taken from this guide by Matthias
Geier (mgeier).
latexmk -pdf [file]
Generate a PDF file from a TeX file. The-pdf
option prevents the additional generation of DVI files, the machine-readable version of TeX. Omitting the file name will generate all of the files in the current directory.latexmk -c [file]
Delete all extra temporary files created in the rendering process.latexmk -C [file]
Delete all generated files, only leaving the original TeX files. (Clean directory.)latexmk -pvc <file>
(File parameter only optional if there is only one TeX file in the directory.) Open up a previewer that automatically refreshes as you are editing your file! Previously, I was using the xuhdev/vim-latex-live-preview extension for Vim using the:LLPStartPreview
command, but it was randomlyFailed to compile
errors, so it made debugging your markup difficult. By default (at least on my system),-pvc
opens up the xdvik previewer. You can change this by updating~/.latexmkrc
.
Also a side note, when writing this up I came across docopt, a standard for writing CLI
documentation. I had a general idea of the syntax already from
seeing it used all over the place, but knowing that there’s a
standardized spec to refer to is nice. For example, I didn’t
realize until now that square brackets []
are used
when arguments are optional, rather than the standard
<>
. The more you know.