根据部分进行枚举

根据部分进行枚举

我如何才能实现我的枚举依赖于我所在的部分?

例如在第 1 节中:

begin{enumerate}
\item ....

那么枚举将是 1.1,1.2,等等。

在第 2 节中:枚举为 2.1、2.2 等等。

答案1

我希望这能有所帮助:

\documentclass[12pt, a4paper]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{enumitem}
\begin{document}
\section{Introduction :}
Here's a list :
\begin{enumerate}[label=\thesection.\arabic*.]
\item Item number one 
\item Item number two 
\end{enumerate}
\section{Another introduction :}
Here's another list :
\begin{enumerate}[label=\thesection.\arabic*.]
\item Item number one 
\item Item number two 
\end{enumerate}
\end{document}

在此处输入图片描述

请记住这里thesection是章节的编号,在这种情况下(文章类)1., 2., ...在书籍类中情况有所不同,thesection即章节编号。为了解决这个问题,您可以重新定义哪个很容易,下面是它的工作原理:

\documentclass[12pt, a4paper]{book}
\usepackage[margin=2cm]{geometry}
\usepackage{enumitem}
\renewcommand{\thesection}{\arabic{section}}
\begin{document}
\chapter{Some introductions :}
\section{Introduction :}
Here's a list :
\begin{enumerate}[label=\thesection.\arabic*.]
\item Item number one 
\item Item number two 
\end{enumerate}
\section{Another introduction :}
Here's another list :
\begin{enumerate}[label=\thesection.\arabic*.]
\item Item number one 
\item Item number two 
\end{enumerate}
\end{document}

结果如下:

在此处输入图片描述

相关内容