Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
\pagestyle{scrheadings}
\clearscrheadfoot
\automark[section]{chapter}
\ihead{\leftmark}
\ohead{\rightmark}
\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!

share|improve this question
2  
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

2 Answers 2

up vote 4 down vote accepted

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

\pagestyle{scrheadings}
\clearscrheadfoot
\automark[section]{chapter}
\ihead{\leftmark}
\ohead{\rightmark}
\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}

enter image description here

share|improve this answer
    
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}}
\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}

enter image description here

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}
share|improve this answer
    
Thanks, that's also a really nice solution! (Y) –  Guest Jul 6 at 11:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.