考试:问题上方和下方的额外空间

考试:问题上方和下方的额外空间

我正在尝试使用 Latex 编写考卷,示例 tex 文件如下所示:

\documentclass[a4paper,addpoints,answers,11pt]{exam}
\usepackage[T1]{fontenc}
\usepackage{multicol}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{nonfloat}
\usepackage{caption}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{ifpdf}
\usepackage[export]{adjustbox}
\usepackage{wallpaper}
\renewcommand{\choiceshook}{%
\settowidth{\leftmargin}{W.\hskip\labelsep\hskip 0em}
}
\TileWallPaper{\paperwidth}{1\paperheight}{dummy}
\newenvironment{Figure}
  {\par\medskip\noindent\minipage{\linewidth}}
  {\endminipage\medskip\par}
\newcommand*\circled[1]{%
  \tikz[baseline=(char.base)]
    \node[
      shape=circle,
      fill,
      inner sep=1.5pt,
      text=white,
      minimum size=1.5em
    ] (char) {#1};
}
\renewcommand{\questionlabel}{\circled{\thequestion}}
\begin{document}
\begin{questions}
\question How did he solve the problem?
\begin{multicols}{2} \begin{choices}
\choice He searched for food.
\choice He ate a carrot from the nearby farm.
\choice He ate a carrot from the snowman's nose.
\choice He ran away.
\end{choices} \end{multicols}
\question Which pair has rhyming words?
\begin{multicols}{2} \begin{choices}
\choice lunch, nibble
\choice little, chubby
\choice suppose, stick
\choice man, ran
\end{choices} \end{multicols}
\question Which of these is a noun?
\begin{multicols}{2} \begin{choices}
\choice hungry
\choice nibble
\choice bunny
\choice grabbed
\end{choices} \end{multicols}
\end{questions}
\end{document}

其输出如下:

在此处输入图片描述

问题上方和下方都有额外的空间(在图像中以橙色框突出显示),您能否建议如何(1)减少问题上方的空间(2)减少问题下方的空间?

答案1

除了\setlength{\multicolsep}{0.2em}Ruedi 建议的(改变问题下方的垂直距离)之外,您还需要\setlength\itemsep{-.7\baselineskip}改变两个问题之间的距离。为了进行更改,我使用了etoolbox及其\AtBeginEnvironment宏。根据需要调整值,但要小心不要让事情变得难看。

\documentclass[a4paper,addpoints,answers,11pt]{exam}
\usepackage[T1]{fontenc}
\usepackage{multicol}
\usepackage{tikz}
\usepackage{etoolbox}
\AtBeginEnvironment{multicols}{\vspace{-.7\baselineskip}}             %%   adjust this

\newcommand*\circled[1]{%
  \tikz[baseline=(char.base)]
    \node[
      shape=circle,
      fill,
      inner sep=1.5pt,
      text=white,
      minimum size=1.5em
    ] (char) {#1};
}
\renewcommand{\questionlabel}{\circled{\thequestion}}

\begin{document}

\begin{questions}
\setlength\itemsep{-.7\baselineskip}                                %%   adjust this
\question How did he solve the problem?
\begin{multicols}{2} \begin{choices}
\choice He searched for food.
\choice He ate a carrot from the nearby farm.
\choice He ate a carrot from the snowman's nose.
\choice He ran away.
\end{choices} \end{multicols}
\question Which pair has rhyming words?
\begin{multicols}{2} \begin{choices}
\choice lunch, nibble
\choice little, chubby
\choice suppose, stick
\choice man, ran
\end{choices} \end{multicols}
\question Which of these is a noun?
\begin{multicols}{2} \begin{choices}
\choice hungry
\choice nibble
\choice bunny
\choice grabbed
\end{choices} \end{multicols}
\end{questions}
\end{document}

在此处输入图片描述

答案2

尝试:

\setlength{\multicolsep}{0.2em}

此命令应放在“\usepackage”命令的下方某处。

相关内容