1

I am trying to create an environment specifically for C-code, but when I compile the document below, LaTeX just hangs. I'm running MiKTeX 2.9 if that matters. Is lstlistings one of those environments (as explained here, here and here) for which this is impossible?

\documentclass{article}
    \usepackage{listings}

    \newenvironment{ccode}{\begin{lstlisting}[language = C]}{\end{lstlisting}}

\begin{document}

\begin{lstlisting}[language = C]
printf("Hello, world!\n");
\end{lstlisting}

%\begin{ccode}
%printf("Hello, world!\n");
%\end{ccode}

\end{document}
Stirling
  • 1,419

0 Answers0