diff --git a/content/posts/managing-rendering-of-latex.md b/content/posts/managing-rendering-of-latex.md new file mode 100644 index 0000000..70cd5a5 --- /dev/null +++ b/content/posts/managing-rendering-of-latex.md @@ -0,0 +1,15 @@ +--- +title: "Managing Rendering of LaTeX" +date: 2022-10-25 +tags: + - 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](https://mg.readthedocs.io/latexmk.html) 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](https://en.wikipedia.org/wiki/Device_independent_file_format), 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 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](https://github.com/xuhdev/vim-latex-live-preview#usage) extension for Vim using the `:LLPStartPreview` command, but it was randomly `Failed 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`](https://mg.readthedocs.io/latexmk.html#configuration-files). + +Also a side note, when writing this up I came across [docopt](http://docopt.org/), 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.