Write Managing Rendering of LaTeX

main
Elnu 2 years ago
parent efdbb52b15
commit fa4b7186e2

@ -0,0 +1,15 @@
---
title: "Managing Rendering of LaTeX"
date: 2022-10-25
tags:
- programming
---
Previously Ive used `pdflatex` to render my LaTeX documents, but Ive just come across `latexmk`, which provides much more powerful options. Heres 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>` (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 theres a standardized spec to refer to is nice. For example, I didnt realize until now that square brackets `[]` are used when arguments are optional, rather than the standard `<>`. The more you know.
Loading…
Cancel
Save