
Я профессор и 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[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
для сравнения):