我想制作一个包含两个目录的 LaTeX 文档,例如:

内容概述

  • 1 - 简介
  • 2 - 解决方案

详细内容

  • 1 - 简介
    • 1.1 - 问题
    • 1.2 - 为什么?
  • 2 - 解决方案
    • 2.1 - A阶段
    • 2.2 - B 阶段

我尝试过

\setcounter{tocdepth}{1}
\tableofcontents

\setcounter{tocdepth}{2}
\tableofcontents

但这仅根据需要显示第一个目录。第二个目录是空的...(即使没有两个目录,第二个目录实际上也是空的 \setcounter 行。)

(一个相关问题:如何更改目录标题(与默认内容不同)?)

有帮助吗?

解决方案

你有没有尝试过 短链 包裹?

其他提示

您可以使用 enewcommand 更改目录名称,

\renewcommand{\contentsname}{My New Table Of Contents}

例子:

\documentclass{amsart}
\usepackage{hyperref}
\renewcommand{\contentsname}{My New Table of Contents}
\begin{document}

\setcounter{tocdepth}{3}
\tableofcontents
\newpage

\newpage
\section{Section a}
Some a text.
\subsection{Subsection b}
Some b text.
\subsubsection{Subsubsection c}
Some c text.

\newpage
\section{Section d}
Some d text.
\subsection{Subsection e}
Some e text.

\end{document}

我已经使用 enewcommand 自定义了 \maketitle 命令的外观,因此您可能需要考虑更新 ableofcontents。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top