# Show solution to each part of a multipart question right after that part in exam package

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}

\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}

-
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

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}


-
Many thanks for the super fast solution. –  Ali Mehrizi Nov 28 '11 at 4:12