目錄包含頁碼?

目錄包含頁碼?

我使用的命令\addcontentsline如下:

\chapter*{Conclusions and Perspectives}

\addcontentsline{toc}{chapter}{Conclusions and Perspectives}

但是,我得到以下結果:

結論和觀點138

數字138代表頁碼。如何解決這個問題

答案1

您可以使用此\chapter{}指令取代 \chapter*{},然後使用 手動抑制章節號碼\setcounter{secnumdepth}{-1}。這樣,「結論與觀點」章節就會出現在目錄中,而沒有頁碼。

\documentclass{report}

\begin{document}

\tableofcontents

% Suppress chapter number
\setcounter{secnumdepth}{-1}

% Add unnumbered chapter to table of contents
\chapter{Conclusions and Perspectives}

% Reset chapter numbering
\setcounter{secnumdepth}{0}

% Your content here

\end{document}

相關內容