# Fix "CONTENTS" in header using etoc

I use etoc package for local TOCs to be inserted after each chaper title via \localtableofcontents command. It works fine, but it changes all chapter titles in headers into "CONTENTS" title. However section titles are shown correctly. If I skip \localtableofcontents, headers become correct.

How to revert headers to default behavior while \localtableofcontents is used?

A sample code:

\documentclass{book}
\usepackage{lipsum,etoc}
\begin{document}
\frontmatter
\tableofcontents
\etocarticlestyle
\mainmatter
\chapter{Chapter A}
\localtableofcontents
\section{Section 1}
\lipsum[1-100]
\end{document}


I would remove those marks completely, your local toc isn't likely to be larger than one page.

\documentclass{book}
\usepackage{lipsum,etoc}
\makeatletter
\def\etocarticlestyle{%
\etocsettocstyle
{\section *{\contentsname
%                \@mkboth {\MakeUppercase \contentsname}
%                         {\MakeUppercase \contentsname}
}
}
{}}
\makeatother
\begin{document}
\frontmatter
\tableofcontents
\etocarticlestyle
\mainmatter
\chapter{Chapter A}
\localtableofcontents
\section{Section 1}
\lipsum[1-100]
\end{document}

• perhaps I should modify etoc to skip adding those marks for local TOCs. A command such as \localtableofcontentswithmarks could then be provided. Or, for back compatibility, the alternative would be to provide \localtableofcontentswithoutmarks and not modify the default behavior.
– user4686
Oct 21 '15 at 10:39
• @jfbu seems like a good idea. I think those marks are a bit distracting. Oct 21 '15 at 10:53
• all I know is that I didn't pause much to think about the pros and cons of their insertions in \etocarticlestyle, and that I may not have had the local TOCs much present in mind at that time.
– user4686
Oct 21 '15 at 10:56
• @jfbu On a different matter: Great package, thanks :-) Oct 21 '15 at 10:57
• @Johannes_B thanks... but etoc needs a proficiency in LaTeX which, for small modifications, is surely a bit overwhelming; as it is possible to use tocloft together with etoc, I recommand that combination, tocloft for easy customizing, and etoc for allowing local tables of contents and possibly some of its fancier effects...
– user4686
Oct 21 '15 at 11:35