2

I would like to write something in a box with \makeemptybox{1.8in}? I am using the \documentclass[addpoints]{exam}.

Thank you.

ryuk
  • 2,257
  • 2
    You're posting a lot of questions but hardly accept any answers to them. This leaves the impression of disregarding the users willing to help you –  May 08 '16 at 10:41
  • I read with attention the answers and I appreciate anyone who wants help me. – ryuk May 08 '16 at 10:45
  • 1
    That's not really how TeX.SX works: Appreciating is giving feedback, upvoting and accepting. –  May 08 '16 at 10:47

1 Answers1

5

You could define a \makenonemptybox macro:

\documentclass[addpoints]{exam}

\newcommand{\makenonemptybox}[2]{%
  \par\nobreak\vspace{\ht\strutbox}\noindent
  \fbox{%
    \parbox[c][\dimexpr#1-2\fboxsep][t]{\dimexpr\linewidth-2\fboxsep}{
      \hrule width \hsize height 0pt
      #2
    }%
  }%
  \par\vspace{\ht\strutbox}
}
\makeatother

\begin{document}

\begin{questions}
\question
  In no more than one paragraph, explain why the earth is round.
  \makeemptybox{1in}

\question
  \begin{parts}
  \part
    What changes to the van Allen radiation belt are needed to make
    the earth into a regular icosahedron?
    \makenonemptybox{1in}{(Hint: try splitting hairs)}
  \part
    Where should the field generator be constructed if you want one of
    the vertices to be located at the Royal Observatory at Greenwich?
    \makeemptybox{1in}
  \end{parts}
\end{questions}

\end{document}

enter image description here

egreg
  • 1,121,712