Take the 2-minute tour ×
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.

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. –  cgnieder Mar 6 '13 at 8:20
add comment

1 Answer 1

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
add comment

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.