考試課程:學生的答案空間與列印答案的空間相同

考試課程:學生的答案空間與列印答案的空間相同

我是一名教授,我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比較):

在此輸入影像描述

相關內容