我有一个简单的多项选择题,我想确保问题和所有选项都出现在同一页上。我之前看到过建议将问题嵌入到小页面中,但这会影响问题之间的间距。还有其他想法可以实现这一点吗?
1. What is the time?
A) 1o'clock
B) 1o'clock
C) 1o'clock
D) 1o'clock
下面是使用 minipage 修复垂直间距问题的一个例子,需要 vspace 来修复垂直间距问题。
\documentclass[a4paper,12pt,addpoints]{exam}
\usepackage{graphicx}
\usepackage{anyfontsize}
\makeatother
\graphicspath{{\subfix{../images/}}}
\begin{document}
\sffamily
\newpage
{\Large\textbf{Section I - Multiple Choice}}
\textbf{Total Marks}
\textbf{Attempt All Questions}
\textbf{Allow About 12 Minutes for these questions}
Use the multiple choice answer sheet
Select the alternative A, B, C or D that best answers the question.
\vspace{0.4cm}\hrule\vspace{1cm}
\begin{questions}
\begin{minipage}{\linewidth}
\question What time is it?\hfill
\vspace*{0.5cm}
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\vspace*{0.5cm}
\end{minipage}
\begin{minipage}{\linewidth}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\end{minipage}
\begin{minipage}{\linewidth}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\end{minipage}
\begin{minipage}{\linewidth}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\end{minipage}
\begin{minipage}{\linewidth}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\end{minipage}
\begin{minipage}{\linewidth}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\end{minipage}
\begin{minipage}{\linewidth}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\end{minipage}
\begin{minipage}{\linewidth}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\end{minipage}
\end{questions}
\end{document}
答案1
此代码将 minipages 添加到选项环境中。它还\vspace{0.5cm}
在选项前后添加了一些(可选)空格(使用 )。
它会将问题及其所有选项保存在同一页面上。
\documentclass[a4paper,12pt,addpoints]{exam}
\usepackage{graphicx}
\usepackage{anyfontsize}
\graphicspath{{\subfix{../images/}}}
% From https://tex.stackexchange.com/a/224654/161015 ***************<<<<<<<<<<<<<<<<<<<
\usepackage{etoolbox}
\BeforeBeginEnvironment{choices}{\vspace*{0.5cm}\par\nopagebreak\minipage{\linewidth}}
\AfterEndEnvironment{choices}{\vspace*{0.5cm}\endminipage}
%*******************************************************
\begin{document}
\sffamily
\newpage
{\Large\textbf{Section I - Multiple Choice}}
\textbf{Total Marks}
\textbf{Attempt All Questions}
\textbf{Allow About 12 Minutes for these questions}
Use the multiple choice answer sheet
Select the alternative A, B, C or D that best answers the question.
\vspace{0.4cm}\hrule\vspace{1cm}
%\vspace*{1.3cm} % USE to test. \vspace*{1.4cm} will make question 4 go tho the next page
\begin{questions}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\question What time is it?\hfill
\begin{choices}
\CorrectChoice 1 o'clock
\choice 2 o'clock
\choice 3 o'clock
\choice 4 o'clock
\end{choices}
\end{questions}
\end{document}
可以在规则之后和问题之前添加一些垂直空间进行测试。例如,\vspace*{1.4cm}
将使问题 #4 及其选项进入下一页。