![枚举内容对齐,第 2 部分](https://linux22.com/image/426496/%E6%9E%9A%E4%B8%BE%E5%86%85%E5%AE%B9%E5%AF%B9%E9%BD%90%EF%BC%8C%E7%AC%AC%202%20%E9%83%A8%E5%88%86.png)
这是之前询问。
代码:
\documentclass[12pt]{article}
\usepackage{enumitem}
\usepackage{diagbox}
\usepackage[margin=1in]{geometry}
\begin{document}
\begin{enumerate}[itemindent = {\widthof{\arabic*.} + \labelsep}, leftmargin =*]
\item Ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp but rather I would \addtocounter{enumi}{9}
\item Ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp but rather I would
\end{enumerate}
\end{document}
我想按最高有效位而不是最低有效位对齐数字(这很常见)。但是,数字似乎是按最低有效位对齐的,如下所示(我收到错误;我使用的是 TeXpad):
如何按最高有效位对齐数字以及从第二行开始的多行内容?第一个做得很好,但第二个枚举没有达到预期效果。
附录:Bernard 解决了这个问题。下面是一个案例:
\documentclass[12pt]{article}
\usepackage{enumitem}
\usepackage{diagbox}
\usepackage[margin=1in]{geometry}
\begin{document}
\begin{enumerate}[wide = 0pt]
\item Ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp but rather I would \addtocounter{enumi}{9}
\item Ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp but rather I would
\item
\begin{enumerate}[wide = 0pt]
\item Ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp but rather I would
\item Ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp but rather I would
\end{enumerate}
\end{enumerate}
\end{document}
输出:
这里,嵌套的枚举器没有对齐。我只是想知道是否有办法对齐枚举器,同时对齐外部枚举器最高有效位处的“溢出”行。
答案1
如果我理解了你想要什么,这个选项[wide=0pt]
应该可以做到:在这种情况下,标签是左对齐的。如果是嵌套的enumerate
,我们需要更多参数:
\documentclass[12pt]{article}
\usepackage{enumitem}
\usepackage{diagbox}
\usepackage{calc}
\usepackage[margin=1in, showframe]{geometry}
\begin{document}
\begin{enumerate}[wide =0pt]%
\item Ppppp pppp ppppppp ppp pppp ppppp pppp pppp ppppp ppppp pppp ppp ppp ppp ppp but rather I would \addtocounter{enumi}{9}
\item Ppppp pppp ppppppp ppp pppp ppppp pppp pppp ppppp ppppp pppp ppp ppp ppp ppp but rather I would
\item
\begin{enumerate}[wide=1.8em, leftmargin=1.8em, before=\hspace*{-1.8em}\vspace*{-\baselineskip-2\topsep}]
\item Ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp but rather I would
\item Ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp but rather I would
\end{enumerate}
\end{enumerate}
\end{document}
要使所有第二行项目与文本左边距对齐,请删除leftmargin=1.8em
第二级枚举选项中的,如下所示:
\begin{enumerate}[wide =0pt]%
\item Ppppp pppp ppppppp ppp pppp ppppp pppp pppp ppppp ppppp pppp ppp ppp ppp ppp but rather I would \addtocounter{enumi}{9}
\item Ppppp pppp ppppppp ppp pppp ppppp pppp pppp ppppp ppppp pppp ppp ppp ppp ppp but rather I would
\item
\begin{enumerate}[wide=1.8em, leftmargin=1.8em, before=\hspace*{-1.8em}\vspace*{-\baselineskip-2\topsep}]
\item Ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp but rather I would
\item Ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp but rather I would
\end{enumerate}
\end{enumerate}