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 am trying to float a figure using wrapfigure within an exam document using minipage. If I don't use a minipage, then the exam questions do not wrap around the figure. When I use minipage as in the example below, everything wraps, but if the minipage (or the longer form with solutions included with \printanswers) is longer than one page, then the typesetting runs off the bottom.

My simple question is this: what's the correct way to include figures in an exam? My example questions block follows:

\documentclass{exam}
\usepackage{amsmath}
\usepackage{graphics}
\usepackage{wrapfig}
\begin{document}
\begin{questions}
\begin{minipage}{\linewidth}
\begin{wrapfigure}{r}{9cm}
\includegraphics[width=8cm]{./20x20grid-axes.png}
\end{wrapfigure}

\question Answer all parts below: 

\begin{parts}

\part[1] 1 + 1 = \answerline

\fullwidth{\begin{solution}\begin{align*} \boxed{ 2 } \end{align*}\end{solution}}

\part[1] 2 + 2 = \answerline

\fullwidth{\begin{solution}\begin{align*} \boxed{ 4 } \end{align*}\end{solution}}

\part[1] 3 + 3 = \answerline

\fullwidth{\begin{solution}\begin{align*} \boxed{ 6 } \end{align*}\end{solution}}

\end{parts}
\end{minipage}
\end{questions}
\end{document}
share|improve this question
    
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  doncherry Dec 3 '12 at 19:45
    
Did I get the class and packages right? Otherwise please edit your question into a minimal working example (MWE). –  Stephen Dec 3 '12 at 19:54
add comment

1 Answer

One possibility would be to move the minipage inside the parts environment, and ending it as soon as enough material has been wrapped, as the following example illustrates:

\documentclass{exam}
\usepackage[demo]{graphicx}
\usepackage{wrapfig}
\usepackage{amsmath}

\begin{document}

\begin{questions}
\question Answer all parts below: 

\begin{parts}
\begin{minipage}{\linewidth} 
\begin{wrapfigure}{r}{9cm}
\hfill
\includegraphics[width=8cm]{./20x20grid-axes.png}
\end{wrapfigure}
\part[1] 1 + 1 = \answerline

\fullwidth{\begin{solution}\begin{align*} \boxed{ 2 } \end{align*}\end{solution}}

\part[1] 2 + 2 = \answerline

\fullwidth{\begin{solution}\begin{align*} \boxed{ 4 } \end{align*}\end{solution}}

\part[1] 3 + 3 = \answerline

\fullwidth{\begin{solution}\begin{align*} \boxed{ 4 } \end{align*}\end{solution}}
\end{minipage}

\part[1] 3 + 6 = \answerline

\fullwidth{\begin{solution}\begin{align*} \boxed{ 6 } \end{align*}\end{solution}}

\end{parts}
\end{questions}

\end{document}

enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

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.