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.

In what follows, the toc heading is wrong except for the last page and I cannot find a solution. I've been trying to modify the \tableofcontents as well as the \toc@heading commands without success.

\documentclass[12pt]{book}
\usepackage[left=3.8cm,right=3.8cm,top=10cm,bottom=10cm,letterpaper]{geometry}
\usepackage{kpfonts}        
\DeclareRobustCommand{\capsspacing}[1]{\textsc{\MakeLowercase{#1}}}
\usepackage[linktocpage=true]{hyperref}              
\begin{document}
\tableofcontents
\markboth{\capsspacing{\contentsname}}{\capsspacing{\contentsname}}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\end{document}

The toc heading is supposed to be in small caps for all toc pages.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

To get the desired result, you can redefine \tableofcontents as implemented in book.cls to change the marks:

\documentclass[12pt]{book}
\usepackage[left=3.8cm,right=3.8cm,paperheight=10cm,top=2cm,bottom=2cm]{geometry}
\usepackage{kpfonts}  

\DeclareRobustCommand{\capsspacing}[1]{\textsc{\MakeLowercase{#1}}}
\DeclareRobustCommand{\capsspacingb}{\scshape\MakeLowercase}

\usepackage[linktocpage=true]{hyperref}             
\usepackage[titles]{tocloft}

% chapters
\renewcommand{\cftchappresnum}{\normalfont}%
\renewcommand{\cftchapfont}{\capsspacingb}%
\renewcommand{\cftchappagefont}{\normalfont}%      

\makeatletter
\renewcommand\tableofcontents{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\contentsname
        \@mkboth{%
           \scshape\MakeLowercase{\contentsname}}{\scshape\MakeLowercase{\contentsname}}}%
    \@starttoc{toc}%
    \if@restonecol\twocolumn\fi
    }
\makeatother      


\begin{document}
\tableofcontents
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\end{document}

enter image description here

Using the etoolbox package to patch \tableofcontents, the code simplifies:

\documentclass[12pt]{book}
\usepackage[left=3.8cm,right=3.8cm,paperheight=10cm,top=2cm,bottom=2cm]{geometry}
\usepackage{kpfonts}  
\usepackage{etoolbox}  

\patchcmd{\tableofcontents}{\MakeUppercase\contentsname}{\scshape\MakeLowercase{\contentsname}}{}{}
\patchcmd{\tableofcontents}{\MakeUppercase\contentsname}{\scshape\MakeLowercase{\contentsname}}{}{}

\DeclareRobustCommand{\capsspacing}[1]{\textsc{\MakeLowercase{#1}}}
\DeclareRobustCommand{\capsspacingb}{\scshape\MakeLowercase}

\usepackage[linktocpage=true]{hyperref}             
\usepackage[titles]{tocloft}

% chapters
\renewcommand{\cftchappresnum}{\normalfont}%
\renewcommand{\cftchapfont}{\capsspacingb}%
\renewcommand{\cftchappagefont}{\normalfont}%      

\begin{document}
\tableofcontents

\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\end{document}
share|improve this answer
    
Thanks. I think I tried something similar yesterday And I had an error message. Your suggestion works. –  pluton Jul 22 '12 at 19:43

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.