### 9 Comments

1. Hi tom!
Thanks for your code examples. Have you seen that white lines/stripes between the lines of code? – Do you know a solution for disabling them?

Best regards!

• Hi Kai,

Thanks for your comment. I am aware of the problem. I found the following solution on stackoverflow and modified it slightly adding line numbers:

\documentclass{minimal}
\usepackage[pdftex]{xcolor}
\usepackage[a4paper,hmargin=6cm]{geometry}
\usepackage{listings}
\usepackage{framed}
\lstset{numbers=left,
stepnumber=1,
numbersep=1pt,
numberstyle=\color{black},
basicstyle=\ttfamily}
\begin{document}
\definecolor{shadecolor}{named}{gray}
\begin{shaded}
\begin{lstlisting}
if (a &lt; b)
{
printf(&quot;A is smaller than  B!\n&quot;);
}
a = b;
\end{lstlisting}
\end{shaded}
\end{document}

Best, Tom.

• Thanks, Tom! – I have seen this on so, too. But the shaded box is (a little bit) ugly…

I have seen some examples that use “backgroundcolor” for the listings _without_ the white lines. Also I found an answer on tex.sx… But my listings are always striped…

2. I like the Java theme… could you create one for xml :-)? The existing is not very nice :-/

• Hi Christian,
This question and the answers on stackexchange about XML syntax highlighting may be what you are looking for. The result looks really nice.
Cheers, Tom.

3. Reblogged this on KRIPTUSA´s Blog and commented:
Para presentar algoritmos, códigos en nuestros artículos. Esperar que todo se vea bien.

4. Thank you.

5. Awesome

Thank you!