如何在目录中显示小节和段落?

如何在目录中显示小节和段落?

因此我们有类似的东西:

\documentclass{article}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\usepackage{amsmath}

\begin{document}

\tableofcontents

\section{Brushless Motor Fundamentals}
\subsection{Brushless Motor Operation}
\subsubsection{DC Motor Operation}
Torque is generated in DC motors from the magnetic force,
also known as the Lorentz force, which is produced when an
electric current is passed through a coil in a magnetic field.
This force is given by $F=q[E+(v\times B)]$,
where $F$ is the force perpendicular to the coil,
$E$ is the electric field in the coil, $B$ is the magnetic field,
and $v$ is the velocity of the charged particles in the coil.
From mechanics, torque is $\tau=F\times r$.

\section{Brushless Motor Fundamentals 2}
\subsection{Brushless Motor Operation}
\subsubsection{DC Motor Operation 2}
If the electrical force is ignored and the remaining magnetic force is used,
with the assumption that $v$ is perpendicular to $B$,
we find that $\tau=qvBrsin\theta$.

\end{document}

如何在目录中显示小节和段落?

答案1

tocdepth增加和的值secnumdepth。该tocdepth值决定了在目录中打印分段命令的级别(它们始终包含在文件中.toc,否则将被忽略)。该secnumdepth值决定了分段标题的编号级别。它们是 LaTeX 计数器,您可以使用 来设置它们\setcounter

分段级别具有以下编号:

-1 part
0 chapter     
1 section       
2 subsection  
3 subsubsection
4 paragraph
5 subparagraph

在文档类中article\chapter不存在,而是0代表\part

例子:

\documentclass{article}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\begin{document}
\tableofcontents

\section{section}
\subsection{subsection}
\subsubsection{subsubsection}
\paragraph{paragraph}
\end{document}

相关内容