# TOC with pagestyle empty in memoir

I'm using the memoir class for a thesis, and want no page numbering of the front matter including the TOC. Have followed the answer to Table of contents with page style empty which does remove the page numbering of the first page of the TOC. My TOC is three pages long, and the last 2 pages still has a heading with roman page numbering. Minimal example below here:

\documentclass[danish,12pt,a4paper,oneside,openany]{memoir}

\begin{document}
\frontmatter
\pagestyle{empty}
\include{frontmatter/titlepage}
\include{frontmatter/abstract}
\tableofcontents*

\mainmatter
...

-
Put the \pagestyle{empty} command before \frontmatter. –  Alan Munn Aug 5 '11 at 11:27
Gave it a try but does not cause any change in output. –  Jannick Aug 5 '11 at 13:03
Did you delete your .aux files and rerun latex twice? –  Alan Munn Aug 5 '11 at 13:08
Did now, still same result. I also tried adding a \AtEndDocument.. which strangely enough removed the header from the 2nd page of the TOC bot not the third. I'm using pdflatex from MikTek if it makes any difference. –  Jannick Aug 5 '11 at 15:19
Try putting \clearpage after the \tableofcontents* command. –  Alan Munn Aug 5 '11 at 15:39

Because memoir doesn't automatically start contents lists on a new page, you need to issue \clearpage commands to make sure that the page style gets associated correctly. Headers and footers are added after the page content is produced, so the \clearpage is necessary. The standard document classes incorporate \clearpage into some of these commands, but memoir chooses not to.

\documentclass[danish,12pt,a4paper,oneside,openany]{memoir}

\begin{document}
\pagestyle{empty}
\frontmatter
\include{frontmatter/titlepage}
\include{frontmatter/abstract}
\tableofcontents*
\clearpage % TOC will now have the previous pagestyle setting