Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

If you compile my current TOC code:

\documentclass[a4paper,10pt]{book}

\usepackage{lipsum,kantlipsum}
\usepackage[dotinlabels]{titletoc}

\contentsmargin{0pt}
\renewcommand\contentspage{\thecontentspage}

\titlecontents{chapter}[0pc]
{\addvspace{0.8pc}\large\scshape}
{\chaptername\ \thecontentslabel: }
{}
{\normalsize\titlerule*[6pt]{.}\contentspage}
[\addvspace{3pt}]

\newlength\widest
\settowidth\widest{99.99.}

\titlecontents{section}[1.025pc]
{\addvspace{0pc}}
{\parbox[t]{\widest}{\hfill\thecontentslabel.}\hspace{3mm}}
{}
{\normalsize\titlerule*[6pt]{.}\contentspage}
[\addvspace{0pt}]

\renewcommand\thesection{\arabic{section}}

\begin{document}
\tableofcontents
\chapter{Chapter 1}\section{Section 1}\kant[1-8]
\chapter{Chapter 2}\section{Section 2}\kant[1-60]
\chapter{Chapter 3}\section{Section 3}
\end{document}

You will see a TOC that looks like this:

TOC

I'm almost perfectly happy with this, but there are two issues that remain:

  1. The chapter dots are not exactly 100% aligned with the section dots. More precisely, each dot after a chapter name does not have the exact same horizontal position as the dot below it after the section name.

  2. The page number after the chapter does not look exactly like the one after the section. It's also not positioned same, horizontally. I want to make the chapter one look exactly like the section one (without changing the font size of the chapter heading).

Can you help me with this? In short: All dots and page numbers look alike and align properly, whether they be for a chapter or a section.

share|improve this question
add comment

2 Answers

up vote 9 down vote accepted

2.

For chapters you are using \large\scshape and only the font size is reset by \normalsize for the dots and the page number. \upshape resets the font shape to the normal setting:

\titlecontents{chapter}...{\normalsize\upshape\titlerule*[6pt]{.}\contentspage}...

1.

\titlerule* uses \leaders in the table of contents. Therefore the dots are exactly aligned in vertical direction. Probably you mean the horizontal distance after the title and the dots. This space can be zero as well as the space before the page number. Therefore I would add some space before and after the dots, at least \,:

\documentclass[a4paper,10pt]{book}

\usepackage{lipsum,kantlipsum}
\usepackage[dotinlabels]{titletoc}

\contentsmargin{0pt}
\renewcommand\contentspage{\thecontentspage}

\titlecontents{chapter}[0pc]
{\addvspace{0.8pc}\large\scshape}
{\chaptername\ \thecontentslabel: }
{}
{\normalsize\upshape\,\titlerule*[6pt]{.}\,\contentspage}
[\addvspace{3pt}]

\newlength\widest
\settowidth\widest{99.99.}

\titlecontents{section}[1.025pc]
{\addvspace{0pc}}
{\parbox[t]{\widest}{\hfill\thecontentslabel.}\hspace{3mm}}
{}
{\normalsize\,\titlerule*[6pt]{.}\,\contentspage}
[\addvspace{0pt}]

\renewcommand\thesection{\arabic{section}}

\begin{document}
\tableofcontents
\chapter{Chapter 1}\section{Section 1}\kant[1-8]
\chapter{Chapter 2}\section{Section 2}\kant[1-60]
\chapter{Chapter 3}\section{Section 3}
\newpage
\setcounter{page}{100}
\chapter{Chapter 4}   
\end{document}

Result

share|improve this answer
add comment

Add \normalfont to \normalsize: you're using, in chapter entries, periods from the small caps font, which are slightly different from the normal ones.

\titlecontents{chapter}[0pc]
{\addvspace{0.8pc}\large\scshape}
{\chaptername\ \thecontentslabel: }
{}
{\normalsize\normalfont\titlerule*[6pt]{.}\contentspage}
[\addvspace{3pt}]

This should account also for the difference (that I can't notice) in the numbers.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.