我是一名教授,我exam
经常使用 LaTeX 课堂。
\begin{solutionorlines}[4cm]
为学生回答留出 4 厘米的空间。当我输入时,\printanswers
它会显示答案,但它不会保留与不打印答案时相同的空间。我如何才能为问题和解决方案环境保留相同的空间?我希望答案打印在相同的解决方案行上。有,
\fillin[fill this in][12cm]
但是这不会换行。也尝试了censor
包(\xblackout
),但这不会生成最后一行hfill
,而且它与为学生提供的解决方案行实际上并不相同。- 解决方案的字符是否可以计算并留下更多适合手写的空间(即,将解决方案的字符数转换为行数以供学生回答)?
这是一个例子。
\documentclass[11pt,a4paper,addpoints]{exam}
\unframedsolutions
%\printanswers
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{calc}
\newgeometry{left=2cm,top=2cm,right=2cm,bottom=2cm}
%----------blanks----------------------
\usepackage{censor}
\censorruledepth=-.2ex
\censorruleheight=.1ex
%\StopCensoring %text xblackout comes visible or not
%--------------------------------------
\begin{document}
\begin{questions}
\begin{figure*}[h]
\begin{tikzpicture}[rounded corners=5mm]
\path node[rectangle,draw=green,fill=green!8,inner sep=.70cm] {\parbox{\textwidth-1.4cm-\fboxrule}{
\question[2] What is the first question?
\begin{solutionorlines}[4cm]
This box is smaller than when the solutions are not printed. How do I make this the same dimension as when answers are not printed?
\end{solutionorlines}
}};
\end{tikzpicture}
\end{figure*}
\xblackout{This solutionline doesn't fill untill the right margin = bad}
\end{questions}
\end{document}
答案1
您可以指定 parbox 的高度,以便将其固定,就像
\parbox[t][4.5cm]{\textwidth-1.4cm-\fboxrule}{...}
而不是简单地
\parbox{\textwidth-1.4cm-\fboxrule}{...}
这样,无论答案是否打印出来,您总是拥有相同的空间。
梅威瑟:
\documentclass[11pt,a4paper,addpoints]{exam}
\unframedsolutions
%\printanswers
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{calc}
\newgeometry{left=2cm,top=2cm,right=2cm,bottom=2cm}
\begin{document}
\begin{questions}
\begin{figure*}[h]
\begin{tikzpicture}[rounded corners=5mm]
\path node[rectangle,draw=green,fill=green!8,inner sep=.70cm] {\parbox[t][4.5cm]{\textwidth-1.4cm-\fboxrule}{
\question[2] What is the first question?
\begin{solutionorlines}[4cm]
This box is smaller than when the solutions are not printed. How do I make this the same dimension as when answers are not printed?
\end{solutionorlines}
}};
\end{tikzpicture}
\end{figure*}
\end{questions}
\end{document}
输出(左边是\printanswersfalse
,右边是 ,\printanswerstrue
用于比较):