# Customize ToC page layout

I am using memoir, in the document the ToC is inserted after the Introduction chapter. My problem is that the pages occupied by the ToC change the layout, headers and footers disappear, also I have found that the numbering of pages is lost, the pages occupied by the ToC are taken into account in the pagination of the document but not in the links on the ToC elements, to have the right links I have to manually reset the counter of pages after the ToC. I could not find any hint in the memoir manual on how to solve this. (?)

MWE:

\documentclass{memoir}
\usepackage{lipsum}
\makepagestyle{front}
\makeevenhead{front}{\thepage}{A}{FRONT}
\makeoddhead{front}{}{}{\itshape\leftmark}
\makepsmarks{front}{ \createmark{chapter}{left}{nonumber}{}{}} \makepagestyle{body}
\makeevenhead{body}{\thepage}{B}{BODY}
\makeoddhead{body}{}{}{\itshape\leftmark}
\makepsmarks{body}{ \createmark{chapter}{left}{nonumber}{}{}}

\begin{document}

\pagestyle{front}
\chapter{Intro} \lipsum[1-5]
\newpage \pagestyle{body}
\tableofcontents
\newpage
\chapter{Tks}
\lipsum[1]

\end{document}

• Can you please show us a short compilable TeX code resulting in your issue? To simulate a complete document use command Blinddocument of package blindtext ... – Mensch Aug 25 '19 at 5:46
• Thanks Mensch, I´ll prepare it asap – Richard Aug 25 '19 at 7:29

## 1 Answer

I tried your MWE and to me it did not exhibit the problems you mentioned. There were footers in the chapters and ToC pages, headers on the second and further pages after the first page of a chapter, and the page numbers reported in the ToC were correct.

Some comments:

1) Remember that memoir uses the chapter (aliased to plain) pagestyle for the first page of a chapter. If you want that to be one of your pagestyles then

\aliaspagestyle{chapter}{front} % and/or
\aliaspagestyle{chapter}{body}


at the appropriate places (e.g., after a \pagestyle{...} command)

2) In general better to use \clearpage than \newpage as the former will flush out any pending floats.

3) In general with memoir use the \frontmatter, \mainmatter and \backmatter commands to indicate the three portions of a typical (book) document.

4) Please check that your new pagestyles really do what you want them to do.

5) What happens if you comment out the \tableofcontents and extend the chapter texts to multiple (3 or 4) pages?