[Tex/LaTex] scrbook – How to place chapter to the left edge and section to the right edge on single-sided (!) documents

header-footerkoma-script

Let's create a single-sided (!) document made in scrbook-class (e.g. scientific work) by setting \documentclass[twoside=false]{scrbook}.


Working minimum-example:

\documentclass[twoside=false]{scrbook}

\usepackage{blindtext}

\begin{document}

    \blinddocument

\end{document}

Screenshot of the initial state

Consequently, the chapter will be placed in the middle of the head (on non-plain-pages).

enter image description here


Screenshot of the desired end state

But now how is it possible to place the chapters name to the left edge and the sections name to the right edge?

enter image description here


In a two-sided layout it would be really simple by typing…

\automark[section]{chapter}       % chapter in \leftmark; section in \rightmark

\lehead[]{\leftmark}{\leftmark}   % \leftmark placed in even-side left-edges
\rohead{\rightmark}               % \rightmark placed in odd-side right-edges

… into the preambel. But how does it work for single-sided documents (with declaration twoside=false)?

It is a well known fact that popular KOMA-classes like…

\lehead[content plain.scrheadings]{content scrheadings}
\rehead[content plain.scrheadings]{content scrheadings}

… only will work fine in double-sided layouts.


Thank you very much for your help, I'm curious about your solutions! 🙂

Best Answer

If you want to use both \leftmark and \rightmark in a one-sided document with package scrlayer-scrpage you have to set the option autooneside=false

\documentclass[twoside=false]{scrbook}
\usepackage{blindtext}

\usepackage[
  automark,
  autooneside=false % <- 
]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead{\leftmark}
\ohead{\rightmark}
\cfoot*{\pagemark}

\begin{document}
\blinddocument
\end{document}

enter image description here

Note that option automark does the same as \automark[section]{chapter} and \cfoot*{\pagemark} is a short version of \cfoot[\pagemark]{\pagemark}.


Update

To avoid identical entries in left and right header you can change the definition of \ohead to

\ohead{\ifstr{\rightmark}{\leftmark}{}{\rightmark}}

enter image description here

Code:

\documentclass[twoside=false]{scrbook}
\usepackage{blindtext}
\usepackage[
  automark,
  autooneside=false 
]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead{\leftmark}
\ohead{\ifstr{\rightmark}{\leftmark}{}{\rightmark}}
\cfoot*{\pagemark}

\begin{document}
\blinddocument
\chapter{Chapter}
\Blindtext
\end{document}