My local LaTeX workflow

In this post, I’ll document the workflow that I use to compose LaTeX documents locally on Mac OS. Back in college I used this workflow to live-TeX lecture notes.

Here’s an example that shows it all together:

Personal stylesheet #

One of the most basic but powerful features of LaTeX is being able to define your own macros in a stylesheet. I recommend defining your own, which you can then import with \usepackage{stylesheetname}.

The contents of mine are pretty simple – I’ve attached it here.

latexmk: Auto-compilation #

Overleaf has this nice feature where it will recompile the document regularly as you edit. There is a convenient Perl script that replicates this locally, called latexmk. With the following command:

latexmk -pvc

the script will continuously check input files for changes and recompile the document if needed.

vim-latex: Macros for LaTeX commands #

I’m a longtime user of vim. One of my favorite packages is vim-latex, which provides a handy set of macros.

You can find the full reference card here, but I’ll highlight a few features that I find especially nice.

The package provides one-character macros for symbols. For example, typing `6 will type out \partial.

There’s also a handy feature for commands like \frac that require arguments. Typing `/ will type out \frac{<++>}{<++>}{<++>}. Each of the <++> are placeholders that can be “jumped” to with the command Ctrl-J. This is probably a lot more clear in the GIF above :)

Skim: Auto-reloading PDF viewer #

On Mac OS, Skim is a PDF reader which a key feature: it reloads when the PDF changes contents. I find this nicer than Preview, which requires me to click on the window to get it to reload.

When I used to use a similar workflow on Linux, I used zathura, a lightweight document viewer with vim-like keybindings.

tmux #

I typically open a tmux session with latexmk in one pane, and my vim editor in a different pane.

inkscape-figures #

While it’s possible to use TikZ to generate beautiful images, I personally like creating vector graphics in inkscape, and then using the inkscape figures package to import them into my doc. For more information on this package, check out the docs.

Thanks to Joan Creus-Costa and Andy Chen for reading drafts of this post.