LaTeX 中的多个目录

发布于 2024-07-18 08:22:06 字数 633 浏览 10 评论 0原文

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

内容概述

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

详细内容

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

我尝试过,

\setcounter{tocdepth}{1}
\tableofcontents

\setcounter{tocdepth}{2}
\tableofcontents

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

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

I would like to make a LaTeX document with two tables of contents, like:

Contents overview

  • 1 - Introduction
  • 2 - Solution

Detailed contents

  • 1 - Introduction
    • 1.1 - The problem
    • 1.2 - Why?
  • 2 - Solution
    • 2.1 - Phase A
    • 2.2 - Phase B

I tried with

\setcounter{tocdepth}{1}
\tableofcontents

\setcounter{tocdepth}{2}
\tableofcontents

but this only displays the first table of contents as required. The second table of contents is empty...
(The second table of contents is actually empty even without the two \setcounter lines.)

(A related question: how to change the title of the table of contents (to something different than the default Contents)?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紫瑟鸿黎 2024-07-25 08:22:06

您是否尝试过 shorttoc 包?

Have you tried the shorttoc package?

抚你发端 2024-07-25 08:22:06

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

\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}

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

You can change the name of the ToC with \renewcommand,

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

Example:

\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}

I have customized the look of the \maketitle command using \renewcommand, so you might want to look into renewing \tableofcontents.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文