我目前正在写一份多项选择题考试:问题编号有一个枚举列表,每个多项选择题中选项有一个嵌套列表:
1. 问题 1
a)
b)
c)
d)
2. 问题 2
a)
b)
c)
d) ...
如果问题列表很长,则某个问题的选项通常会在各个页面之间分离。解决此问题最直接的方法就是在出现分离的地方写下来\newpage
。我想知道有没有更好的方法?是否可以更改(或创建一个新的)环境,使选项始终分组,这样它们就不会在各个页面之间分离?
答案1
一个选择是将列表包装在minipage
(minipage
不允许分页符) 中:
\documentclass{exam}
\begin{document}
\noindent\begin{minipage}{\linewidth}
\begin{questions}
\question
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{choices}
\choice John
\choice Paul
\choice George
\choice Ringo
\choice Socrates
\end{choices}
\end{questions}
\end{minipage}
\end{document}
当然,你可以定义一个新的环境来减轻工作量:
\documentclass{exam}
\newenvironment{nbchoices}[1]
{\par\noindent\begin{minipage}{\linewidth}\begin{questions}\question#1\begin{choices}}
{\end{choices}\end{questions}\end{minipage}\par}
\begin{document}
\begin{nbchoices}{One of these things is not like the others; one of these things is not
the same. Which one is different?}
\choice John
\choice Paul
\choice George
\choice Ringo
\choice Socrates
\end{nbchoices}
\end{document}
使用article
标准enumerate
环境,同样的想法适用:
\documentclass{article}
\newenvironment{nbchoices}[1]
{\item#1\par\begin{minipage}{\linewidth}\begin{enumerate}}
{\end{enumerate}\end{minipage}\par}
\begin{document}
\begin{enumerate}
\begin{nbchoices}{One of these things is not like the others; one of these things is not
the same. Which one is different?}
\item John
\item Paul
\item George
\item Ringo
\item Socrates
\end{nbchoices}
\begin{nbchoices}{One of these things is not like the others; one of these things is not
the same. Which one is different?}
\item John
\item Paul
\item George
\item Ringo
\item Socrates
\end{nbchoices}
\end{enumerate}
\end{document}
选择之间不会出现分页符。