Solarized LaTeX Listings

October 04, 2014

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.



Jake on the Web

If you cared enough to read that far, you should consider following me on GitHub or paying a visit to my homepage. If this post was about one of my open source projects, make sure to star it on GitHub! I love hearing what people think, so feel free to comment, open an issue, or send me an email.

Reach for Markdown, not LaTeX

Writing should be a pleasant experience. With the right tools, it can be. LaTeX is powerful but cumbersome to use. With Markdown, we can focus on our writing, and worry about the presentation later. Pandoc can take care of the presentation for us, so the only thing left to do is start. Continue reading

Vim and Haskell in 2016 on OS X

Published on August 03, 2016

Let’s Have a Chat about Encryption

Published on April 17, 2016