TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I gave my code in the exam class like

\begin{parts}
\part \begin{lstlisting} 
echo The date is $date 
\end{lstlisting}
\part \begin{lstlisting} 
echo The date is $(date) 
\end{lstlisting}
\end{parts}

I want is the line starting with echo in (a) and (b) respectively. Instead that only \part displays only (a)

share|improve this question
    
Add a blank line or a \par between \end{lstlisting} and \part. – clemens Mar 6 '13 at 8:20
up vote 1 down vote accepted

Putting it in \lstinline solved my problem

\begin{parts}
\part \lstinline{echo The date is $date}
\part \lstinline{echo The date is $(date)}
\end{parts}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.