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}}
\newcommand\partinheadfoot{\firstmarks\currentpart}
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}}
\newcommand\partinheadfoot{\firstmarks\currentpart}
\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}}
\newcommand\partinheadfoot{\firstmarks\currentpart}
\clearpairofpagestyles
\ihead{\leftmark}
\ohead{\rightmark}
\ifoot*{\partinheadfoot}
\ofoot*{\pagemark}
\renewcommand\partpagestyle{empty}
\usepackage{blindtext}% for dummy text
\begin{document}
\tableofcontents
\part{First Test (\KOMAScriptVersion)}
\blinddocument
\part{Second Test}
\blinddocument
\end{document}
texdoc komascript
on the commandline. miktex has something similar.