
根據羅伯特·布林赫斯特的說法(印刷風格的元素),目錄中的領導者不美觀。這個問題詢問一種更好的設定目錄的方法。
另一種方法,更接近 TeX 的預設設置,是在節標題後面留一個小空格(也許 2em),然後在後面設定數字。布林赫斯特在他的書的實際內容中做到了這一點(下圖)。
奇怪的是,tocloft
似乎不直接支持這種風格。我相信這一點有錯嗎?或者是否有另一個軟體包可以實現此目的?
答案1
這是可能的tocloft
。此範例也處理節號:
\documentclass[openany]{book}
\usepackage{tocloft}
\usepackage{color}
\renewcommand*{\cftchappresnum}{\hss\color{red}}
\renewcommand*{\cftchapaftersnum}{\hspace{.5em}}
\settowidth{\cftchapindent}{\cftchapfont 99\cftchapaftersnum}
\setlength{\cftchapnumwidth}{0pt}
\renewcommand*{\cftchapleader}{\hspace{1em}}
\renewcommand*{\cftchapafterpnum}{\cftparfillskip}
\renewcommand*{\cftpnumalign}{l}
\begin{document}
\tableofcontents
\chapter*{Forword}
\addcontentsline{toc}{chapter}{Forword}
\setcounter{page}{9}
\chapter*{Historical Synopsis}
\addcontentsline{toc}{chapter}{Historical Synopsis}
\setcounter{page}{12}
\chapter{Rhytm \& Proportion}
\setcounter{page}{25}
\chapter{Harmony \& Counterpoint}
\setcounter{page}{45}
\chapter{Structural Forms \& Devices}
\setcounter{page}{61}
\chapter{Analphabetic Symbols}
\setcounter{page}{75}
\chapter{Choosing \& Combining Type}
\setcounter{page}{93}
\chapter{Historical Interlude}
\setcounter{page}{119}
\chapter{Shaping the Page}
\setcounter{page}{143}
\chapter{The State of the Art}
\setcounter{page}{179}
\chapter{Grooming the Font}
\setcounter{page}{198}
\chapter{Prowling the Specimen Books}
\setcounter{page}{209}
\end{document}
答案2
使用該titletoc
套件( 的同伴titlesec
),可以使用類似以下的命令:
\titlecontents{chapter}[0pt]{}%
{\contentslabel{2.25em}}{}%
{\hspace{2em}\thecontentspage}
按順序,參數代表:
- 斷面類型
- 前面的縮進
- 用於條目全域格式化的任何程式碼
- 如果該部分已編號,則為標籤
- 如果該部分未編號,則為標籤
- 顯示頁碼的程式碼,包括其前面的任何空格