2

How could I include the part name in front of the chapter name in the header of odd pages within a classicthesis scrreprt document?

The original section in classicthesis.sty reads as follows:

% ******************************************************************                
% headlines
% ********************************************************************  
\PassOptionsToPackage{automark}{scrpage2}
\RequirePackage{scrpage2} % provides headers and footers (KOMA Script)
\clearscrheadings
\setheadsepline{0pt}
\ifthenelse{\boolean{@nochapters}}%
    {\relax}%
    {\renewcommand{\chaptermark}[1]{\markboth{\spacedlowsmallcaps{#1}}{\spacedlowsmallcaps{#1}}}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\enspace\spacedlowsmallcaps{#1}}} 
\lehead{\mbox{\llap{\small\thepage\kern2em}\headmark\hfil}}
\rohead{\mbox{\hfil{\headmark}\rlap{\small\kern2em\thepage}}}
\renewcommand{\headfont}{\small}  
%    \DeclareRobustCommand{\fixBothHeadlines}[2]{} % <--- ToDo
% hack to get the content headlines right (thanks, Lorenzo!)
    \def\toc@heading{%
        \ifthenelse{\boolean{@nochapters}}%
        {\section*{\contentsname}}%nochapters
        {\chapter*{\contentsname}}%chapters
        \@mkboth{\spacedlowsmallcaps{\contentsname}}{\spacedlowsmallcaps{\contentsname}}}

It results in a header with the actual chapter name on odd pages and the sections name on even pages. Do I have to include something like \renewcommand{\partmark}? What exactly is \headmark doing? Again, the aim is to include the part name (not the number) in the header.

2

This might work:

\documentclass{scrbook}
\usepackage[parts]{classicthesis}
\usepackage{xpatch}

\usepackage{kantlipsum}

\xpatchcmd{\Part}
  {\ctparttext}
  {\gdef\thisparttitle{#1}\ctparttext}
  {}{}
\renewcommand{\chaptermark}[1]{%
  \if\relax\detokenize\expandafter{\thisparttitle}\relax
    \markboth{\spacedlowsmallcaps{#1}}
             {\spacedlowsmallcaps{#1}}%
  \else
    \markboth{\spacedlowsmallcaps{\thisparttitle\relax\ -- #1}}
             {\spacedlowsmallcaps{\thisparttitle\relax\ -- #1}}%
  \fi
}
\newcommand{\clearparttitle}{\gdef\thisparttitle{}}

\begin{document}
\mainmatter
\part{First}
\chapter{Title}
\section{Section}
\kant

\appendix
\clearparttitle
\chapter{Appendix}
\kant

\end{document}

You need to remove the part title when you don't want it any more.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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