如何將目錄包含到有編號的目錄中

如何將目錄包含到有編號的目錄中

隨包

\usepackage{tocbibind}

我可以將目錄本身包含在內,但這沒有編號。我想知道是否可以在內容中包含一個數字(因此它就像一個部分),然後將其包含在目錄中。

一個例子是這樣的,

  1. 抽象的
  2. 內容
  3. 第1節

然後在目錄中會顯示所有這 3 個。

答案1

對於標準類,您可以使用 package tocbasic

\documentclass{article}
\usepackage{lipsum}% only for dummy text

\usepackage{tocbasic}
\addtotoclist[\jobname]{toc}
\renewcommand*\tableofcontents{\listoftoc[{\contentsname}]{toc}}
\setuptoc{toc}{numbered}

\begin{document}
\section{Abstract}
\lipsum[1]
\tableofcontents
\section{Section 1}
\lipsum[2-3]
\end{document}

在此輸入影像描述

套件tocbasic是 KOMA-Script 套件的一部分。 KOMA-Script 類別會自動載入它:

\documentclass{scrartcl}
\usepackage{lipsum}% only for dummy text

\setuptoc{toc}{numbered}

\begin{document}
\section{Abstract}
\lipsum[1]
\tableofcontents
\section{Section 1}
\lipsum[2-3]
\end{document}

在此輸入影像描述

相關內容