我正在尝试实现以下结果:
1. Section 1
Some text here
1.1 Subsection 1
Some text here
(a) Some text here
(b) Some text here
(i) Some text here
(ii) Some text here
2. Section 2
Some text here
以下是我现在所拥有的:
\documentclass[11pt,a4paper]{article}
\usepackage{enumerate}
\usepackage[shortlabels]{enumitem}
\begin{enumerate}[leftmargin=*,label*=\bf{\arabic*}]\itemsep6pt
\item
\begin{enumerate}[leftmargin=*,label*={\arabic*}]
\item
\begin{enumerate}[(a)]\itemsep6pt
\item
\begin{enumerate}[(i)]\itemsep6pt
\item
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{enumerate}
\begin{enumerate}[leftmargin=*,label*={\arabic*.}]\itemsep6pt
\setcounter{enumi}{10}
\item
但这无法提供正确的对齐和间距。此外,如果我想制作另一个列表,我需要手动设置计数器,这很不方便。有没有关于如何更方便地做到这一点的建议?
答案1
以下实现了您请求的布局:
\documentclass{article}
\makeatletter
%\def\@seccntformat#1{\csname the#1\endcsname\quad}
\renewcommand{\@seccntformat}[1]{\makebox[0pt][r]{\makebox[30pt][l]{\csname the#1\endcsname}}}
\makeatother
\usepackage{enumitem}
\setlist[enumerate,1]{label=(\alph*),align=left}
\setlist[enumerate,2]{label=(\roman*),align=left}
\begin{document}
\sloppy% Just for this example
\section{First section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tellus dolor,
euismod venenatis enim a, dapibus scelerisque neque. Duis dolor sem, bibendum
in diam ac, iaculis ornare neque. Integer et congue sapien. Praesent diam
nunc, ultrices quis lobortis quis, tincidunt lacinia diam. Nulla at nulla dui.
Mauris vitae venenatis odio.
\subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tellus dolor,
euismod venenatis enim a, dapibus scelerisque neque. Duis dolor sem, bibendum
in diam ac, iaculis ornare neque. Integer et congue sapien. Praesent diam
nunc, ultrices quis lobortis quis, tincidunt lacinia diam. Nulla at nulla dui.
Mauris vitae venenatis odio.
\begin{enumerate}
\item
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tellus dolor,
euismod venenatis enim a, dapibus scelerisque neque. Duis dolor sem, bibendum
in diam ac, iaculis ornare neque.
\item
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tellus dolor,
euismod venenatis enim a, dapibus scelerisque neque. Duis dolor sem, bibendum
in diam ac, iaculis ornare neque.
\begin{enumerate}
\item
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tellus dolor,
euismod venenatis enim a, dapibus scelerisque neque. Duis dolor sem, bibendum
in diam ac, iaculis ornare neque.
\item
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tellus dolor,
euismod venenatis enim a, dapibus scelerisque neque. Duis dolor sem, bibendum
in diam ac, iaculis ornare neque.
\end{enumerate}
\end{enumerate}
\subsection{Second subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tellus dolor,
euismod venenatis enim a, dapibus scelerisque neque. Duis dolor sem, bibendum
in diam ac, iaculis ornare neque. Integer et congue sapien. Praesent diam
nunc, ultrices quis lobortis quis, tincidunt lacinia diam. Nulla at nulla dui.
Mauris vitae venenatis odio.
\section{Second section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tellus dolor,
euismod venenatis enim a, dapibus scelerisque neque. Duis dolor sem, bibendum
in diam ac, iaculis ornare neque. Integer et congue sapien. Praesent diam
nunc, ultrices quis lobortis quis, tincidunt lacinia diam. Nulla at nulla dui.
Mauris vitae venenatis odio.
\end{document}
章节编号通过调整打印在页边距中\@seccntformat
(通常只打印数字后跟空格1em
- \quad
)。调整30pt
以满足您的需要。
一级和二级环境的标签使用以下提供的键值接口进行对齐enumerate
打印:left
enumitem
。