我一直在使用 LaTex 来编写我的家谱家族史研究,因为它能够索引、引用图片、表格等。这将是一个大文件,因为我已经有近 1000 页,而我只在树的第一个分支上工作!我一直在努力解决列举内容的问题,需要一些建议。
我用过枚举项包允许我更好地设置枚举,但我无法按我想要的方式格式化它。我有一些深层嵌套的项目,它们的标签可能是 B.10.2.3.2.2.3。
我想将其设置为这些标签左对齐,并且与它们匹配的文本遵循该缩进。我似乎只能使文本全部左对齐,然后标签会挤进页边距并离开页面。
这就是问题:
我怎样才能让“B”在边缘左对齐而不是乱七八糟?提前谢谢您!现在的情况是这样的:
\documentclass[12pt]{book}
\usepackage[letterpaper, portrait, margin=1.0in]{geometry}
\usepackage{enumitem}
\setlistdepth{9}
\newlist{myEnumerate}{enumerate}{9}
\setlist[myEnumerate]{topsep=7pt,itemsep=7pt}
\setlist[myEnumerate,1]{label*=\textbf{\Alph*}., leftmargin=*} % A, B, C
\setlist[myEnumerate,2]{label*=\arabic*., leftmargin=0cm} % 1, 2, 3
\setlist[myEnumerate,3]{label*=\arabic*., leftmargin=0cm} % 1, 2, 3
\setlist[myEnumerate,4]{label*=\arabic*., leftmargin=0cm} % 1, 2, 3
\setlist[myEnumerate,5]{label*=\arabic*., leftmargin=0cm} % 1, 2, 3
\setlist[myEnumerate,6]{label*=\arabic*., leftmargin=0cm} % 1, 2, 3
\setlist[myEnumerate,7]{label*=\arabic*., leftmargin=0cm} % 1, 2, 3
\setlist[myEnumerate,8]{label*=\arabic*., leftmargin=0cm}
\begin{document}
\begin{myEnumerate}
\item This is the first item.
\begin{myEnumerate}
\item This is the second item.
\begin{myEnumerate}
\item This is the third item.
\begin{myEnumerate}
\item This is the fourth item.
\begin{myEnumerate}
\item This is the fifth item.
\begin{myEnumerate}
\item This is the sixth item.
\begin{myEnumerate}
\item This is the seventh item.
\begin{myEnumerate}
\item This is the eighth item.
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{document}
答案1
这是我的尝试:
\documentclass[12pt]{book}
\usepackage[letterpaper, portrait, margin=1.0in]{geometry}
\newcommand*\mywidestlabel{M.1.1.1.1.1.1.1.}% adjust here if necessary
\newlength\mylength
\settowidth\mylength{\mywidestlabel}
\usepackage{enumitem}
\setlistdepth{9}
\newlist{myEnumerate}{enumerate}{9}
\setlist[myEnumerate]{topsep=7pt,itemsep=7pt}
\setlist[myEnumerate,1]{label*=\textbf{\Alph*}., align=left, leftmargin=1.0in, labelwidth=\mylength} % A, B, C
\setlist[myEnumerate,2]{label*=\arabic*., align=left, leftmargin=0pt, labelwidth=\mylength} % 1, 2, 3
\setlist[myEnumerate,3]{label*=\arabic*., align=left, leftmargin=0pt, labelwidth=\mylength} % 1, 2, 3
\setlist[myEnumerate,4]{label*=\arabic*., align=left, leftmargin=0pt, labelwidth=\mylength} % 1, 2, 3
\setlist[myEnumerate,5]{label*=\arabic*., align=left, leftmargin=0pt, labelwidth=\mylength} % 1, 2, 3
\setlist[myEnumerate,6]{label*=\arabic*., align=left, leftmargin=0pt, labelwidth=\mylength} % 1, 2, 3
\setlist[myEnumerate,7]{label*=\arabic*., align=left, leftmargin=0pt, labelwidth=\mylength} % 1, 2, 3
\setlist[myEnumerate,8]{label*=\arabic*., align=left, leftmargin=0pt, labelwidth=\mylength}
\begin{document}
\begin{myEnumerate}
\item This is the first item. This is the first item. This is the first item. This is the first item.
\begin{myEnumerate}
\item This is the second item. This is the second item. This is the second item. This is the second item.
\begin{myEnumerate}
\item This is the third item. This is the third item. This is the third item. This is the third item.
\begin{myEnumerate}
\item This is the fourth item. This is the fourth item. This is the fourth item. This is the fourth item.
\begin{myEnumerate}
\item This is the fifth item.
\begin{myEnumerate}
\item This is the sixth item.
\begin{myEnumerate}
\item This is the seventh item.
\begin{myEnumerate}
\item This is the eighth item. This is the eighth item. This is the eighth item. This is the eighth item.
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{myEnumerate}
\end{document}