4

I am setting up the layout for my bachelor thesis using scrbook as basis for a self-made documentclass with twosided print. I want a header containing the current part number and name on the outer side (left on even pages, right on odd pages), the current chapter number and name on the center of the head and the same for section on the inner side. I found this example in the KOMA-Script documentation:

\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\automark[chapter]{chapter}
\automark*[section]{}

It puts the chapter on the outer side on even pages and the section on the outer side on odd pages. Sadly, I was not able to modify this to fit my needs because I do not really understand the way KOMA-Script works here. If a part starts but there is still no chapter in it, the place for the chapter shall remain empty (same for chapter and section). Can anyone help?

Furthermore, I would like to change all fonts that KOMA-Script changes (e.g. toc, section, chapter...) back to the default computer modern as I do not like the font KOMA-Script uses here. Is there a better way than changing all the fonts manually like this:

\addtokomafont{section}{\fontfamily{cmr}\selectfont}
  • Your Bachelor report has section, chapters and parts? Ho many pages do you get at the end? – Johannes_B Jun 5 '16 at 10:39
  • To the bonus question (usually, we have a one questioin per question limit): Try emulatestandardclasses as option to documentclass. – Johannes_B Jun 5 '16 at 10:41
  • \addtokomafont{disposition}{\rmfamily} changes all of those. – Manuel Jun 5 '16 at 10:47
  • I expect about 80-100 pages, so I think it is useful to have parts. – Enno Jun 5 '16 at 10:54
  • emulatestandardclasses did not work, it mixed up with the header and produced a header containing the page number on the blank pages, while \addtokomafont{disposition}{\rmfamily} worked quite well without side effects (as far as I can see). Thanks for that – Enno Jun 5 '16 at 10:56
15

For the part entries in the page header I will modify my example from scrpage2: Three “marks” for headings. Note that there must be no unstarred \automark command after the redefinition of \partmark because this would reset this definition.

To get serif font in the section titles you can change font element disposition

\setkomafont{disposition}{\normalcolor\bfseries}

or you can use the undocumented option

headings=standardclasses

If also font elements like descriptionlabel should use the serif font you can set the undocumented option egregdoesnotlikesansseriftitles which was a result of this question and needs KOMA version 3.20 or newer.

 \documentclass[
  egregdoesnotlikesansseriftitles,% needs version 3.20 or newer
  %headings=standardclasses
]{scrbook}
\usepackage{scrlayer-scrpage}% activates page style scrheadings automatically
\automark[section]{chapter}
\newmarks\currentpart

\renewcommand\partmark[1]{% after all unstarred \automark commands!
  \marks\currentpart{\ifnumbered{part}{\partname~\thepart\autodot\enskip}{}#1}%
  \markboth{}{}%
  }
\newcommand\partinheadfoot{\firstmarks\currentpart}

\clearpairofpagestyles
\ohead{\partinheadfoot}
\chead{\leftmark}
\ihead{\ifstr{\leftmark}{\rightmark}{}{\rightmark}}
\ofoot*{\pagemark}

\renewcommand\partpagestyle{empty}
\usepackage{lipsum}% for dummy text
\begin{document}
\tableofcontents
\part{First Test}
\chapter{A Chapter}
\section{A Section}
\lipsum

\part{Second Test}
\chapter{Only a Chapter}
\lipsum

\part{Third Test}
\section{Only a Section}
\lipsum

\part{Fourth Test}
\lipsum
\begin{description}
\item[Testlabel] Text
\end{description}
\end{document}

enter image description here

enter image description here

enter image description here

enter image description here

If your part, chapter or section titles are to long for the header, you can use option headings=optiontohead or headings=optiontoheadandtoc to use a short title in head and the long (or an other) version in TOC. See the explanations for \part[short version ]{heading etc. in the KOMA-Script documentation section "3.16. Structuring of Documents".

  • Ha ha ha. Great sense of huour. :D – Johannes_B Jun 5 '16 at 11:49
  • I have to upvote this tomorrow, i voted too much today. – Johannes_B Jun 5 '16 at 11:50

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.