I have a problem in the definition of a new command in LaTeX for lstlisting
. The result is that the compilation hangs without error message, just a *
.
This hangs the LaTeX compilation:
\documentclass[10pt,a4paper,ssfamily]{exam}
\usepackage{listings}
\newcommand{\cs}{\begin{lstlisting}}
\newcommand{\ce}{\end{lstlisting}}
\begin{document}
\cs
program test
! This is a commentary
end program test
\ce
\end{document}
But this one does not:
\documentclass[10pt,a4paper,ssfamily]{exam}
\usepackage{listings}
\begin{document}
\begin{lstlisting}
program test
! This is a commentary
end program test
\end{lstlisting}
\end{document}
The only difference is that the beginning and end of endmargin and of lstlisting
are defined in a new command in the first place. The problem occurs for lstlisting
, but not for \begin{center}
, for example.