
在考試課堂上,透過為學生插入與答案行相同大小的固定小頁,您可以在列印答案或不列印答案時創建相同的空間。怎麼深度還是不一樣?不要告訴我要使用 \vspace。
\documentclass[11pt,a4paper,addpoints]{exam}
\unframedsolutions
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{calc}
\usepackage[skins]{tcolorbox}
\usepackage{calc}
\newgeometry{left=2cm,top=2cm,right=2cm,bottom=2cm}
\newtcolorbox{greenbox}[1][]{%
size=fbox,
arc=5mm,
boxsep=0.7cm,
colframe=green,
colback=green!8,
beforeafter skip=5mm,% <--- Space setting before and after
#1%
}
%\printanswers
\begin{document}
\begin{questions}
\begin{greenbox}
\question[2] What is the first question?
\begin{solutionorlines}[4cm] %heidht no answers=4cm
\begin{minipage}[t][4cm]{\textwidth-1.4cm} %height answers =4cm
The depth of this box is larger when answers are printed compared to answers not printed. How do I make "answers" and "no answers" the same dimension?
\end{minipage}
\end{solutionorlines}
\end{greenbox}%
\end{questions}
\end{document}
答案1
我認為exam
該類別本身應該為該問題提供解決方案,但我對它不夠熟悉,不知道這是否是配置問題。
為了規避這個問題,您可以將解決方案部分嵌入到另一個minipage
.以下程式碼始終為答案和行使用相同的空間量:
\documentclass[11pt,a4paper,addpoints]{exam}
\unframedsolutions
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{calc}
\usepackage[skins]{tcolorbox}
\usepackage{calc}
\newgeometry{left=2cm,top=2cm,right=2cm,bottom=2cm}
\newtcolorbox{greenbox}[1][]{%
size=fbox,
arc=5mm,
boxsep=0.7cm,
colframe=green,
colback=green!8,
beforeafter skip=5mm,% <--- Space setting before and after
#1%
}
%\printanswers
\begin{document}
\begin{questions}
\begin{greenbox}
\question[2] What is the first question?
\par\begin{minipage}[t][4cm]{\linewidth} %height answers =4cm
\begin{solutionorlines}[4cm] %heidht no answers=4cm
\begin{minipage}[t][4cm]{\linewidth-1.9cm} %height answers =4cm
The depth of this box is larger when answers are printed compared to answers not printed. How do I make "answers" and "no answers" the same dimension?
\end{minipage}%
\end{solutionorlines}
\end{minipage}
\end{greenbox}%
\end{questions}
\end{document}