# KOMA Script exclude header-footer in contents

I am using these settings:

\documentclass[12pt,a4paper,english,openany,oneside]{scrbook}
\usepackage{etoolbox}
\usepackage{calc}
\makeatletter
\pretocmd{\@part}{\gdef\parttitle{#1}}{}{}
\pretocmd{\@spart}{\gdef\parttitle{#1}}{}{}
\makeatother
\usepackage[nouppercase,headsepline,footsepline,automark]{scrpage2}
\clearscrheadfoot
\clearscrheadings
\chead{}
\cfoot{}
\ihead{HeaderLeftText}
\ohead{\parttitle}
\ifoot{\rule{0pt}{\ht\strutbox+\dp\strutbox}\leftmark}
\ofoot{\rule{0pt}{\ht\strutbox+\dp\strutbox}\thepage}
\pagestyle{scrheadings}


and

\begin{document}
% title stuff here
\thispagestyle{empty}
\newpage
\tableofcontents
\part{PartText}


The problem is that since the settings above are defined before \begin{document}, the rendering of table of contents causes error that undefined control sequence in \parttitle and \part, because the headers and footers also appear on the contents page (which I dont want). I think the error is due to the fact that no \part is defined before the TOC and hence there is no text to put in partitle, i.e. the right header.

So, how could I get rid of the header-footer in TOC, or what's another solution?

-
I am not sure about your intent with the headers/footers. Remove \pagestyle{scrheadings} from the preamble and place it right after the firs \part command. This will prevent the error; I'm not sure however, if this is what you expect. –  Gonzalo Medina Jun 6 '11 at 14:12
add comment

## 2 Answers

To get rid of the error initialize your command (that's a good idea anyway) in the preamble: \newcommand\parttitle{}

To get another pagestyle (e.g. empty) in the toc do

\newpage
\pagestyle{empty}
\tableofcontents
\clearpage
\pagestyle{scrheadings}
\part{blub}

-
add comment

To get rid of the headers/footers in ToC, you can use:

\tableofcontents
\thispagestyle{empty}

-
This give the wanted result only if the table of contents has at most 2 pages. –  Ulrike Fischer Jun 6 '11 at 14:20
@Ulrike: that's right. –  ℝaphink Jun 6 '11 at 14:43
add comment