Solarized LaTeX Listings

Out of the box, LaTeX listings are pretty bad. With a bit of work, you can ascribe some colors to the code, but you’re still stuck with choosing a theme. Given that I recently just switched to the Solarized colorscheme in Vim and iTerm2, I made a LaTeX package that styles code listings with the predefined Solarized light colors.

Source

The source for this theme is on GitHub, and the README has pretty good documentation. Here’s an example of the final result:

After you install them in the right place, you can include \usepackage{solarized-light} to turn source code listings light (as in above), \usepackage{solarized-dark} to have listings styled with the dark Solarized theme, and just \usepackage{solarized} to have access to the raw Solarized color codes (see the source for their names).

Once you’ve done this, you just have to include your code in your LaTeX file using the listings packages. You might want to check out the LaTeX wiki for more information on how to get started quickly with code listings, or the official documentation for a more comprehensive reference.