使用 enumitem 包将节号设为枚举列表中显示的第一个数字

使用 enumitem 包将节号设为枚举列表中显示的第一个数字

我目前正在使用\section{}后跟来\begin{enumerate}创建编号列表。

我希望枚举列表的第一个数字作为章节编号。

因此不要:

2. Application of Income...
   1. ...

      1.1 ...

      1.2 ...
   2. ...

这将是:

2. Application of Income
   
   2.1 ...

          2.1.1 ...

          2.1.2 ...
   2.2

我本来想开始每个新的部分\begin{enumerate},但是,我想将这些部分包含在目录中。如果您认为这样做更容易,并且引用了目录中的第一项,请告诉我,您介意提供代码示例吗?非常感谢

要复制的完整文件:

\documentclass[a4paper,12pt]{extarticle}
\usepackage[utf8]{inputenc}

% Section Headers
\usepackage{titlesec}
\titlespacing*{\section}{0mm}{9mm}{9mm}
\titleformat{\section}{\Large\bfseries}{\arabic{section}.}{0.5em}{}[\titlerule]

% Lists
\usepackage{enumitem}
\setlist{topsep=0pt,noitemsep,leftmargin=1.3cm}
\setlist[enumerate,1]{label*=\arabic*.}      
\setlist[enumerate,2]{label*=\arabic*.}
\setlist[enumerate,3]{label*=\arabic*.}


\begin{document}
\tableofcontents

\section{Powers}
\begin{enumerate}
    \item The CIO has power to do anything which is calculated to further its 
\begin{enumerate}
\item Borrow money and to charge the whole or any part of its property as security for 
\item Buy, take on lease or in exchange, hire or 
\item Sell, lease or otherwise dispose of all or any part of the property belonging to the 
\end{enumerate}
\end{enumerate}

\section{Application of Income and Property}
\begin{enumerate}
    \item The income and property of the CIO must be applied solely 
        \begin{enumerate}
        \item A charity trustee is entitled to be reimbursed from the property of the CIO or may pay 
        \item A charity trustee may benefit from trustee indemnity insurance cover purchased at the CIO’s expense in accordance with, and subject to the 
        \end{enumerate}         
    \item None of the income or property of the CIO may be paid or transferred
\end{enumerate}

\end{document}

答案1

您只需添加\thesection到您的第一个标签定义:

\documentclass[a4paper,12pt]{extarticle}
\usepackage[utf8]{inputenc}

% Section Headers
\usepackage{titlesec}
%\titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}
\titlespacing*{\section}{0mm}{9mm}{9mm}
\titleformat{\section}{\Large\bfseries}{\arabic{section}.}{0.5em}{}[\titlerule]

% Lists
\usepackage{enumitem}
\setlist{topsep=0pt,noitemsep,leftmargin=1.3cm}
\setlist[enumerate,1]{label*=\thesection.\arabic*.}
\setlist[enumerate,2]{label*=\arabic*.}
\setlist[enumerate,3]{label*=\arabic*.}


\begin{document}

\section{Powers}
\begin{enumerate}
    \item The CIO has power to do anything which is calculated to further its 
\begin{enumerate}
\item Borrow money and to charge the whole or any part of its property as security for 
\item Buy, take on lease or in exchange, hire or 
\item Sell, lease or otherwise dispose of all or any part of the property belonging to the 
\end{enumerate}
\end{enumerate}

\section{Application of Income and Property}
\begin{enumerate}
    \item The income and property of the CIO must be applied solely 
        \begin{enumerate}
        \item A charity trustee is entitled to be reimbursed from the property of the CIO or may pay 
        \item A charity trustee may benefit from trustee indemnity insurance cover purchased at the CIO’s expense in accordance with, and subject to the 
        \end{enumerate}         
    \item None of the income or property of the CIO may be paid or transferred
\end{enumerate}

\end{document}

代码输出

相关内容