[OS X TeX] Listings package

Michael Sharpe msharpe at ucsd.edu
Sun Nov 7 12:43:20 EST 2010


On Nov 7, 2010, at 9:20 AM, David Arnold wrote:

I'm trying to get the 2in in the line \begin{solution}[2in] to show up in red. But I'm having no success. Can someone suggest how I might do this using the listings package?

> \begin{lstlisting}
> \begin{solution}[2in]

You can define an escapeinside environment:

\begin{lstlisting}[escapeinside=!~]
\begin{solution}[!\color{red}2in~]

Michael


More information about the MacOSX-TeX mailing list