如何將目錄中的章節名稱加粗,而不是點和數字加粗

如何將目錄中的章節名稱加粗,而不是點和數字加粗

每當我使用輸出將目錄上的文字加粗時,\renewcommand{\cftsecfont}{\bfseries}就會顯示如下:

2 章節名稱............................................... . 24

2.1 部分名稱......................................... ....... 25

但我想要的是這樣的:

第2章 章節名稱.................................... 24

2.1 章節名稱.................................... 25

這個怎麼做?

答案1

一些建議:

  • 要為目錄中的章節級條目啟用“點前導符”,您需要發出指令

    \renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
    
  • 若要擺脫章節層級條目頁碼的粗體顯示,您需要發出以下指令

    \renewcommand{\cftchappagefont}{\mdseries}
    

完整的 MWE(最小工作範例):

在此輸入影像描述

\documentclass{book}

\usepackage{tocloft}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchappagefont}{\mdseries}

\begin{document}
\frontmatter
\tableofcontents

\mainmatter
\chapter{Uno}
\chapter{Due}
\end{document}

相關內容