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.

The following code uses the pagestyles option and \renewpagestyle from the titlesec package to redefine the plain style:

\documentclass{book}
\usepackage[paperheight=12cm]{geometry}
\usepackage[pagestyles]{titlesec}

\renewpagestyle{plain}
  {\setfoot{}{}{}\sethead{}{}{}}

\begin{document}

\tableofcontents

\end{document}

The expected behaviour would be to clear all fields in both the header and footer; however, the result of the above example code is the following:

enter image description here

Why is the word "Contents" appearing in the header and in the footer?

share|improve this question
    
This seems to be resolved if you formally issue a \pagestyle{plain} after setting it via \renewstyle{plain}{..}. –  Werner Dec 6 '11 at 6:14
    
@Werner: but then all pages will have plain style, unless a manual change is done. Certainly that's not the desired behaviour. –  Gonzalo Medina Dec 6 '11 at 13:24
add comment

1 Answer 1

up vote 7 down vote accepted

The documentation of titlesec warns about using \markboth along with it. The \tableofcontents issues \@mkboth (which is usually equivalent to \markboth). One can cure the problem by saying

\makeatletter
\renewcommand\@mkboth[2]{\chaptermark{#1}}
\makeatother

(which is something titlesec should do by itself).

share|improve this answer
2  
What I don't understand is why the problem doesn't show up in report class, even though the code for \tableofcontents in the two classes is identical. –  Alan Munn Dec 6 '11 at 17:00
    
In addition to Alan's comment, in both classes \@mkboth is let exactly the same, either as \markboth or as \@gobbletwo, so yes, it's strange that the problem appears with book but not with report. –  Gonzalo Medina Dec 7 '11 at 1:51
    
@Alan. Because report has plain as the main page style while book has headings. If plain is used as a "subsidiary" style with \thispagestyle, the main page style has to be (re)defined with titlesec, too. See the manual for further info. BTW, \renewpagestyle{plain}{} is shorter. (I'll realease a new version with many new features for page styles in a few days.) –  Javier Bezos Dec 7 '11 at 11:37
1  
@JavierBezos I'd say that the documentation is not very clear about that: it took me a while to understand that the explanation is in footnote 21. –  egreg Dec 7 '11 at 11:49
1  
@JavierBezos: could you please clarify to me your last comment? According to egreg's answer it seems that the problem is \@mkboth, but you say that this is not the culprit. What is then the cause of the problem? Perhaps I am misunderstanding you previous comment?. –  Gonzalo Medina Dec 7 '11 at 17:13
show 1 more 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.