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.

I use the great exam package to write my exams as a teacher. It lets me typeset solutions too, but for multipart questions, I want the solution to each part printed right after that part. By default, exam writes the solution to the parts of a multipart question together.

Here's a minimum example:

\documentclass{exam}

\begin{document}
\printanswers

\begin{questions}
\question Below is the data for an ``E-core.''
\begin{parts}
    \part Describe what an E is.
    \part Describe what a core is.
\end{parts}

\begin{solution}
\begin{parts}
    \part E usually comes before F.
    \part Core is usually inside a crust.
\end{parts}
\end{solution}

\end{questions}

\end{document}
share|improve this question
1  
Please provide a minimal working example (MWE) showing what you have done thus far - this way it would easy to work from an existing platform. –  Werner Nov 28 '11 at 2:42
    
@Werner, thanks for the hint. Off to edit. Thanks to superb StackExchange, my question is already answered! –  Ali Mehrizi Nov 28 '11 at 4:01
    
Instead of posting a “Thank you”, you should thank @Gonzalo by upvoting his answer (with the upward pointing arrow to the left of it; you need 15 reputation points before you can upvote) and accepting it (by clicking on the checkmark). –  Werner Nov 28 '11 at 4:03
    
I accepted his answer. I will certainly upvote too once I have enough points. :) –  Ali Mehrizi Nov 28 '11 at 4:23

1 Answer 1

up vote 7 down vote accepted

Here's an example using the solution environment to print the solutions right after their corresponding part:

\documentclass[answers]{exam}
\usepackage{lipsum}

\begin{document}

\begin{questions}
\question
What if there were no air?
\begin{parts}
  \part[5]
  Describe the effect on the balloon industry.
  \begin{solution}
    \lipsum[1]
  \end{solution}
  \part[5]
  Describe the effect on the aircraft industry.
  \begin{solution}
    \lipsum[2]
  \end{solution}
\end{parts}
\end{questions}

\end{document}

enter image description here

share|improve this answer
    
Many thanks for the super fast solution. –  Ali Mehrizi Nov 28 '11 at 4:12

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.