如何在考试文档类中问题编号和实际问题之间添加水平空格

如何在考试文档类中问题编号和实际问题之间添加水平空格

我是 LaTeX 的新手,但想用它来出卷。

我现在的代码像这样输出我的考试题目。

在此处输入图片描述

但是我想增加问题号和问题之间的水平间距,以及选项号和选项之间的水平间距。我通过手动添加 设法实现了这一点\hspace{0.2cm}

在此处输入图片描述

我想知道是否有办法改变它,这样我就不需要\hspace{0.2cm}每次都手动输入了?比如改变命令\question本身。这可能吗?

我当前的代码如下:

% !TEX program = xelatex

\documentclass[addpoints]{exam}
\usepackage{fontspec}
\usepackage{geometry}
\usepackage[version=4]{mhchem}
 
\setmainfont{Arial}
\title{Sample Exam}
\geometry{a4paper, portrait, margin=1in}
   
\renewcommand{\choicelabel}{\textbf{\thechoice}}

\renewcommand{\questionlabel}{\textbf{\thequestion}}

\renewcommand{\partlabel}{\textbf{(\thepartno)}}

\renewcommand{\subpartlabel}{\textbf{(\thesubpart)}}

\renewcommand{\choiceshook}{%
    \setlength{\leftmargin}{1.2cm}%
}

\setlength\dottedlinefillheight{.4in}

\renewcommand{\questionshook}{\setlength{\itemsep}{2em}}
\renewcommand{\partshook}{\setlength{\itemsep}{1em}}
\renewcommand{\subpartshook}{\setlength{\itemsep}{1em}}

\begin{document}

\begin{questions}
  
    \question \hspace{0.2cm}
    Which statement about $\ce{^{35}_{17}Cl}$ and $\ce{^{37}_{17}Cl}$ is correct?
    \begin{choices}
        \choice \hspace{0.2cm} They have the same number of electrons and protons.
        \choice \hspace{0.2cm} They have the same number of neutrons and electrons.
        \choice \hspace{0.2cm} They have the same number of neutrons and protons.
        \choice \hspace{0.2cm} They have the same number of nucleons and electrons.
    \end{choices}

\end{questions}

\end{document}

谢谢!

答案1

根据用户手册,环境questionschoices实现为 LaTeXlist环境,您可以使用相应的命令设置列表参数\...hook

在此处输入图片描述

% !TEX program = xelatex

\documentclass[addpoints]{exam}
\usepackage{fontspec}
\usepackage{geometry}
\usepackage[version=4]{mhchem}
 
\setmainfont{Arial}
\title{Sample Exam}
\geometry{a4paper, portrait, margin=1in}
   
\renewcommand{\choicelabel}{\textbf{\thechoice}}

\renewcommand{\questionlabel}{\textbf{\thequestion}}

\renewcommand{\partlabel}{\textbf{(\thepartno)}}

\renewcommand{\subpartlabel}{\textbf{(\thesubpart)}}

\renewcommand{\choiceshook}{%
  \addtolength{\labelsep}{0.2cm}}
\renewcommand{\questionshook}{%
  \addtolength{\labelsep}{0.2cm}}

\setlength\dottedlinefillheight{.4in}

\renewcommand{\partshook}{\setlength{\itemsep}{1em}}
\renewcommand{\subpartshook}{\setlength{\itemsep}{1em}}

\begin{document}

\begin{questions}
  
    \question
    Which statement about $\ce{^{35}_{17}Cl}$ and $\ce{^{37}_{17}Cl}$ is correct?
    \begin{choices}
        \choice They have the same number of electrons and protons.
        \choice They have the same number of neutrons and electrons.
        \choice They have the same number of neutrons and protons.
        \choice They have the same number of nucleons and electrons.
    \end{choices}

\end{questions}

\end{document}

相关内容