在对齐环境中使用“\hspace*{2em}”进行对齐

在对齐环境中使用“\hspace*{2em}”进行对齐

我正在做一个多项选择题测试。对于某些问题,选项在制表环境中显示得很好。对于某些问题,由于选项显示商,我认为制表环境不适合。我知道\\ [5mm]在制表环境中,行末要么将行间距设置为 5 毫米,要么将默认行间距增加 5 毫米。我希望无论我使用制表环境还是对齐环境,选项的显示都相同。

我给出一个由两道题组成的示例。第一道题的选项以我喜欢的方式显示。我该如何将第二道题的选项\hspace*{2em}从左边距放上去?

我把第三个问题展示出来只是为了说明当选择的是通常的行内表达式时行间距太大。这两个环境的行间距是多少?

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\begin{document}

\noindent {\bf 1.) }$A$, $B$, $C$, $D$, $E$, and $F$ are six points in the Cartesian plane. A line is drawn if, and only if, it contains two of these points. If no line contains three of the given points, how many lines are drawn?
\begin{tabbing}
\hspace*{2em} \= \kill
\> {\bf{a.) }}15 \\
\> {\bf{b.) }}18 \\
\> {\bf{c.) }}20 \\
\> {\bf{d.) }}30 \\
\> {\bf{e.) }}36
\end{tabbing}
\vskip0.25in


\noindent {\bf 2.) }A rectangular pen enclosing 4,000 square meters is to be made from split rail fencing along the span of one side of a barn. The pen is to be divided into three smaller, rectangular regions with more split rail fencing. If the side of this barn bordering the pen is $y$ meters long, how many meters of split rail fencing is needed to make the pen?
\begin{align*}
&\mbox{\bf{a.) }}\displaystyle{y + \frac{4,000}{y}} \\
&\mbox{\bf{b.) }}\displaystyle{y + \frac{16,000}{y}} \\
&\mbox{\bf{c.) }}\displaystyle{y + \frac{16,000}{3y}} \\
&\mbox{\bf{d.) }}\displaystyle{3y + \frac{8,000}{3y}} \\
&\mbox{\bf{e.) }}\displaystyle{3y + \frac{16,000}{3y}}
\end{align*}
\vskip0.25in


\noindent {\bf 3.) }Some bacteria are being cultured in a laboratory. The population of the bacteria in the culture $t$ days after the culture began is modeled by the function
\begin{equation*}
P(t) = 3,000 \left(2^{\frac{t}{4}}\right) .
\end{equation*}
By how many bacteria does the population increase from the end of the $4^{\mathrm{th}}$ day to the end of the $16^{\mathrm{th}}$ day?

\begin{tabbing}
\hspace*{3em} \= \hspace{2.5in} \= \kill
\> {\bf{a.) }}6,000     \> {\bf{b.) }}24,000 \\
\> {\bf{c.) }}36,000    \> {\bf{d.) }}42,000 \\
\> {\bf{e.) }}48,000
\end{tabbing}


\end{document}

答案1

您可以使用该enumitem包。这为您提供了自定义枚举的强大功能。您可以通过提供enumerate可选参数来自定义垂直和水平间距。请参阅文档http://anorien.csc.warwick.ac.uk/mirrors/CTAN/macros/latex/contrib/enumitem/enumitem.pdf有关详细信息,我认为那里解释得很好。您的代码将如下所示(我认为这也会使您的代码更易读):

\begin{enumerate}[label=\bfseries \alph*.), itemsep=0.5em]
  \item $ y + \dfrac{4,000}{y} $
  \item $ y + \dfrac{16,000}{y} $
  \item $ y + \dfrac{16,000}{3y} $
  \item $ 3y + \dfrac{8,000}{3y} $
  \item $ 3y + \dfrac{16,000}{3y} $
\end{enumerate}

在此处输入图片描述

编辑:为了完整起见,我提供了一个完整的文件,其中包含两个全局控制行间距和左缩进的变量:

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{enumitem}


% Change these to globally change inter-line spacing and left indentation
\def\interLine{0.5em}
\def\leftMargin{0cm}

\begin{document}

\noindent {\bf 1.) }$A$, $B$, $C$, $D$, $E$, and $F$ are six points in the Cartesian plane. A line is drawn if, and only if, it contains two of these points. If no line contains three of the given points, how many lines are drawn?
\begin{enumerate}[label=\bfseries \alph*.), itemsep=\interLine, itemindent=\leftMargin]
  \item 15
  \item 18
  \item 20
  \item 30
  \item 36
\end{enumerate}
\vskip0.25in

\noindent {\bf 2.) }A rectangular pen enclosing 4,000 square meters is to be made from split rail fencing along the span of one side of a barn. The pen is to be divided into three smaller, rectangular regions with more split rail fencing. If the side of this barn bordering the pen is $y$ meters long, how many meters of split rail fencing is needed to make the pen?
\begin{enumerate}[label=\bfseries \alph*.), itemsep=\interLine, itemindent=\leftMargin]
  \item $ y + \dfrac{4,000}{y} $
  \item $ y + \dfrac{16,000}{y} $
  \item $ y + \dfrac{16,000}{3y} $
  \item $ 3y + \dfrac{8,000}{3y} $
  \item $ 3y + \dfrac{16,000}{3y} $
\end{enumerate}
\vskip0.25in


\noindent {\bf 3.) }Some bacteria are being cultured in a laboratory. The population of the bacteria in the culture $t$ days after the culture began is modeled by the function
\begin{equation*}
P(t) = 3,000 \left(2^{\frac{t}{4}}\right) .
\end{equation*}
By how many bacteria does the population increase from the end of the $4^{\mathrm{th}}$ day to the end of the $16^{\mathrm{th}}$ day?
\begin{enumerate}[label=\bfseries \alph*.), itemsep=\interLine, itemindent=\leftMargin]
  \item 6,000
  \item 24,000
  \item 36,000
  \item 42,000
  \item 48,000
\end{enumerate}


\end{document}

答案2

这是使用 tabularstacks 的替代方法,我已将其包装到宏中\answers。在执行 1/4in 之前,答案之间的间隙设置为 4pt,并在答案字段的上方和下方添加 5pt 缓冲区\vskip

已编辑,以便可以插入带有的自动标签\>。已重新提供\newquestion,它仅用于开始新问题,问题编号递增。

因此,输入的形式为

\newquestion Text of question?
\answers{
  \> answer1 \\
  \> answer2 \\
  \> ...
}

与答案之间的差距a.)可以用 设置\setstacktabulargap{<length>}。默认值是\tabcolsep

答案默认为数学模式输入,但\stackText在给定之前添加\answers会将默认答案模式更改为文本。可以\stackMath按照 的结论将其改回\answers

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tabstackengine}
\stackMath
\makeatletter
\def\answers#1{%
  \renewcommand\>{\textbf{\alph{TAB@stackindex}.)}&}%
  \setstackgap{S}{4pt}%
  \par\noindent\hspace*{2em}\addstackgap[5pt]{\tabularShortstack{rl}{#1}}%
  \vskip0.25in\par\noindent\ignorespaces%
}
\makeatother
\newcounter{Question}
\newcommand\newquestion{\stepcounter{Question}\noindent\textbf{\arabic{Question}.)\ \,}}
%\setstacktabulargap{\tabcolsep}
\begin{document}

\newquestion $A$, $B$, $C$, $D$, $E$, and $F$ are six points in the Cartesian plane. A line is drawn if, and only if, it contains two of these points. If no line contains three of the given points, how many lines are drawn?
\answers{
  \> 15 \\
  \> 18 \\
  \> 20 \\
  \> 30 \\
  \> 36 
}
\newquestion A rectangular pen enclosing 4,000 square meters is to be made from split rail fencing along the span of one side of a barn. The pen is to be divided into three smaller, rectangular regions with more split rail fencing. If the side of this barn bordering the pen is $y$ meters long, how many meters of split rail fencing is needed to make the pen?
\answers{
  \> y + \dfrac{4,000}{y} \\
  \> y + \dfrac{16,000}{y} \\
  \> y + \dfrac{16,000}{3y} \\
  \> 3y + \dfrac{8,000}{3y} \\
  \> 3y + \dfrac{16,000}{3y}
}
\newquestion Some bacteria are being cultured in a laboratory. The population of the bacteria in the culture $t$ days after the culture began is modeled by the function
\begin{equation*}
P(t) = 3,000 \left(2^{\frac{t}{4}}\right) .
\end{equation*}
By how many bacteria does the population increase from the end of the $4^{\mathrm{th}}$ day to the end of the $16^{\mathrm{th}}$ day?
\answers{
  \> 6,000 \\
  \> 24,000 \\
  \> 36,000 \\
  \> 42,000 \\
  \> 48,000
}
\end{document}

在此处输入图片描述

相关内容