While typesetting an article I had some code highlighting issues with the standard LaTeX listing package, so I departed on an epic journey in search of a better alternative. Seriously though, I found Minted, which is pretty awesome because it uses the Python library Pygments for highlighting, and is therefore a lot more powerful than the standard LaTeX stuff:
After some twisting and tweaking, and with the help of the Minted documentation and some awesome people on Stackoverflow, I came up with the following code listing style, which I deem acceptable:
Here’s a little excerpt from my LateX:
\usepackage{minted}
\usepackage{caption}
\floatsetup[listing]{style=Plaintop}
\DeclareCaptionFont{white}{\scriptsize\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\linewidth-2\fboxsep}{#1#2#3}}}
\captionsetup[listing]{format=listing,labelfont=white,textfont=white}
\newmintedfile{javascript}{numbersep=5pt, linenos, fontsize=\footnotesize, frame=bottomline, framesep=3mm}
% This is how a listing is created, in this case for JavaScript
\begin{listing}
\javascriptfile{../code/design/agent-directory-entry.json}
\caption{Example of an agent directory entry in JSON representation}
\label{code:design:agent-directory-entry}
\end{listing}



