# scrpage2: Three “marks” for headings

As far as I know of the \automark command (scrpage2 package), it is only possible to mark two different "header-types" (e.g. sections and chapters). I'm searching for a way to mark an additional "header" (e.g. part) to use it in headings.

Example usage of this would be:

\documentclass{scrbook}

\usepackage{scrpage2}
\automark[section]{chapter}
\ifoot{Display part title here}

\begin{document}
\part{Test}
\chapter{Test 2}
\section{Test 3}
\end{document}


Does anybody know of an automatic way to do this? Thanks in advance for any help!

-
Before you dig, consider moving to scrlayer-scrpage. Markus Kohm has released a new version of KOMA-script (3.12). Besides that, do you simply wish to print the name of the part into each foot? – Keks Dose Jan 7 '14 at 15:43
Hello and thanks for your comment: I wasn't aware of scrlayer-scrpage. I will search for documentation! Exactly, I'm trying to display the name of the current part in the foot. Just like the section and chapter are displayed in the head. – Guest Jan 7 '14 at 15:46
Search for docu? If you installed texlive, it's just texdoc komascript on the commandline. miktex has something similar. – Keks Dose Jan 7 '14 at 15:58
Well, I read the corresponding section in the updated scrguide.pdf and will use the package from now on (as there's almost no code change required). But an easy way to archieve an additional mark isn't described in the documentation. Did I miss something? – Guest Jan 7 '14 at 17:32

Here's a simple patch: we add to \@part the code that stores in \theparttitle the current part title. You can also give anywhere \parttitle{whatever} (perhaps with an empty argument) to change the footer.

\documentclass{scrbook}
\usepackage{scrpage2}

\usepackage{etoolbox}
\makeatletter
\apptocmd{\@part}{\parttitle{#2}}{}{}
\def\parttitle#1{\gdef\theparttitle{#1}}
\def\theparttitle{} % initialization
\makeatother

\automark[section]{chapter}
\ifoot[\theparttitle]{\theparttitle} % on both sides of a spread, just for the example

\begin{document}
\part{Test}
\chapter{Test 2}
\section{Test 3}
\end{document}


-
And thanks again! Works like a charm! – Guest Jan 7 '14 at 18:31

Here is another suggestion without etoolbox and without \makeatletter ... \makeatother: Each of the KOMA-Script classes scrartcl, scrreprt und scrbook define the command \partmark. Hence I can redefine this command to set a new defined mark.

\automark[section]{chapter}
\newmarks\currentpart
\renewcommand\partmark[1]{%
\marks\currentpart{\ifnumbered{part}{\partname~\thepart\autodot\enskip}{}#1}}


Note that you have to set \automark before redefining \partmark because \automark resets the \...mark commands. But there is also a starred version that only changes the behaviour of the section Levels of its arguments. So the following is also possible:

\newmarks\currentpart
\renewcommand\partmark[1]{%
\marks\currentpart{\ifnumbered{part}{\partname~\thepart\autodot\enskip}{}#1}}
\automark*[section]{chapter}


Now I can insert the part into the footer using

\ifoot*{\partinheadfoot}


Code:

\documentclass{scrbook}
\usepackage{scrlayer-scrpage}
\automark[section]{chapter}
\newmarks\currentpart
\renewcommand\partmark[1]{%
\marks\currentpart{\ifnumbered{part}{\partname~\thepart\autodot\enskip}{}#1}}

\clearpairofpagestyles
\ofoot*{\pagemark}

\renewcommand\partpagestyle{empty}
\usepackage{blindtext}% for dummy text
\begin{document}
\tableofcontents
\part{First Test (\KOMAScriptVersion)}
\blinddocument
\part{Second Test}
\blinddocument
\end{document}

-
Thanks, that's also a really nice solution! (Y) – Guest Jul 6 '15 at 11:48