내용의 페이지 번호 앞에 hspace를 사용하고 오른쪽으로 정렬되지 않음

내용의 페이지 번호 앞에 hspace를 사용하고 오른쪽으로 정렬되지 않음

로버트 브링허스트(Robert Bringhurst)에 따르면(인쇄 스타일의 요소), 목차의 선두 부분이 보기 흉합니다.이 질문목차를 설정하는 더 좋은 방법에 대해 묻습니다.

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}

매개변수는 순서대로 다음을 나타냅니다.

  • 섹션 유형
  • 들여쓰기 앞
  • 항목의 전역 형식화를 위한 모든 코드
  • 섹션에 번호가 매겨진 경우 레이블
  • 섹션에 번호가 없는 경우 레이블
  • 페이지 번호 앞의 공백을 포함하여 페이지 번호를 표시하는 코드

관련 정보