如何对齐乳胶中的枚举列表?

How to align an enumerated list in latex?

假设我想使枚举列表居中对齐。我这样做了:

\begin{center}
\begin{enumerate}[label=(\Roman*)]
\item  Equation 1
\item  Equation 2
\item  Equation 3
\item  Equation 4
\end{enumerate}
\end{center}

这不是很好用。我也尝试过不使用 'enumerate' 而只是 'center' 并手动标记。它确实有效,但对齐方式看起来并不完美。

另外对于中心我们也可以这样做:

我。等式 1 \quad II.公式 2

三。公式 3 \quad IV.Equation 4

您不能像这样将项目列表居中。 Enumerate 是一个格式化环境,它将取代中心环境。

可以做的是把枚举列表放在一个盒子里(像一个小页面),然后把这个盒子居中。

标准的minipage需要一个宽度,但是有一个包(varwidth)允许定义一个未知宽度的minipages(更准确地说,你给一个宽度参数,但如果宽度小于那个,实际with是使用过)。

所以这是一个 varwidth 的解决方案。

\documentclass{article}
\usepackage{enumitem}
\usepackage{varwidth}
\usepackage{tasks}
\begin{document}


\begin{center}
\begin{varwidth}{\textwidth}
\begin{enumerate}[label=(\Roman*)]
\item  Equation 1
\item  Equation 2
\item  Equation 3
\item  Equation 4
\end{enumerate}
\end{varwidth}
\end{center}
\end{document}

如果您希望每行有多个枚举项目,您的解决方案不是很可靠,因为如果您希望项目对齐,您必须根据项目长度调整间距。

'tabto' 包提供了一种灵活的对齐方式。但最好的解决方案是使用允许定义列列表的 'tasks' 包。这个包在确定项目宽度方面不如其他包聪明,如果需要,必须明确给出。括号内的参数是列数。和以前一样,如果你想全局居中环境,你必须使用 varwidth。

\begin{center}
\begin{varwidth}{\textwidth}
\begin{tasks}[label={(\Roman*)},label-width={1cm}](2)
\task  Equation 1
\task  Equation 2
\task  Equation 3
\task  Equation 4
\end{tasks}
\end{varwidth}
\end{center}

对于像您这样的简单列表,也可以使用表格。