1

I am trying to include a LaTeX code within an lstlisting. But the problem is that the LaTeX code includes an lstlisting, so the \end{lstlisting} within the included code is terminating the actual lstlisting. Is there some way to make the compiler not take that as the actual environment end.

\lstset {
    basicstyle=\small\ttfamily,
    language=TeX,
    frame=single,
    backgroundcolor=\color{grey},
    columns=fullflexible
}
..
\begin{document}
    ..
    \begin{lstlisting}
        % The lstlisting can be used as follows
        \begin{lstlisting}
            % Your code goes here
        \end{lstlisting} % This example end-statement is terminating the actual listing
    \end{lstlisting}
    ..
\end{document}

Any help is appreciated.

1

0

Browse other questions tagged .