コンテンツ内のページ番号の前に hspace を使用し、右揃えにしない

コンテンツ内のページ番号の前に hspace を使用し、右揃えにしない

ロバート・ブリングハースト(印刷スタイルの要素)、目次のリーダーは見苦しいです。この質問目次を設定するためのより良い方法について質問します。

もう 1 つの方法は、TeX のデフォルトにさらに近いもので、セクション タイトルの後に小さなスペース (おそらく 2em) を置き、その直後に番号を設定することです。Bringhurst は、実際の本のコンテンツでこれを行っています (下の図)。

不思議なことに、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}

パラメータは順番に以下を表します。

  • セクションタイプ
  • 前のインデント
  • エントリのグローバルフォーマット用のコード
  • セクションに番号が付いている場合のラベル
  • セクションに番号が付いていないときのラベル
  • ページ番号を表示するコード(その前のスペースを含む)

関連情報