如何使用 \makeemptybox{1.8in} 在框中写字?

如何使用 \makeemptybox{1.8in} 在框中写字?

我想在带有 的方框中写些内容\makeemptybox{1.8in},我正在使用\documentclass[addpoints]{exam}

谢谢。

答案1

您可以定义一个\makenonemptybox宏:

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

在此处输入图片描述

相关内容