2

In this thesis - made with the memoir class - the author uses headseplines next to the header content instead of below:

enter image description here

Is it possible to achieve the same with KOMAscript and scrlayer-scrpage, for both the even pages with the chapter title and the odd pages with the section title?

Unlike the linked example I'd like to get:

even page:

chapter title _________________________________________________

odd page:

__________________________________ section number section title

Page numbers are not relevant, as they are in the footer.


Here a MWE to play with:

\documentclass{scrbook}

\RequirePackage[headsepline,automark]{scrlayer-scrpage}

\renewcommand*{\chaptermarkformat}{\scshape}
\KOMAoption{headsepline}{0.1pt}
\pagestyle{scrheadings}

\usepackage{blindtext}

\begin{document}

\chapter{Hello World!}
\section{Section One}
\blindmathpaper
\blindmathpaper
\blindmathpaper

\end{document} 

I tried to abolish the headsepline and modify the \chaptermarkformat and \sectionmarkformat using hrulefill, which seems to be a good way. But I can't get it right.

\documentclass{scrbook}

\RequirePackage[automark]{scrlayer-scrpage}

\renewcommand*{\chaptermarkformat}[1]{\scshape \hspace{2ex} \hrulefill}

enter image description here

(chapter name should be on left side, spacing wrong)


With

\renewcommand*{\sectionmarkformat}[1]{\hrulefill \hspace{2ex} \thesection \hspace{1ex} \rightmark }

the odd page looks all right, but it seems to me that it should be done a little different. E.g. why do I need set the spacing manually here: \thesection \hspace{1ex} \rightmark

enter image description here

3

Here is a suggestion using \hrulefill

\documentclass{scrbook}
\usepackage[automark]{scrlayer-scrpage}

\lehead{\headmark{} \hrulefill}
\rohead{\hrulefill{} \headmark}

\renewcommand*{\chaptermarkformat}{}
\addtokomafont{pagehead}{\scshape}

\usepackage{blindtext}

\begin{document}
\Blinddocument
\end{document}

enter image description here

enter image description here


Or if you want to use the headmarks=.1pt option:

\documentclass{scrbook}
\usepackage{xcolor}
\usepackage[automark,headsepline=.1pt]{scrlayer-scrpage}

\RemoveLayersFromPageStyle{scrheadings}{scrheadings.head.below.line}
\DeclareNewLayer[
  clone=scrheadings.head.odd,
  contents={\GetLayerContents{scrheadings.head.below.line}}
]{scrheadings.head.odd.line}
\DeclareNewLayer[
  clone=scrheadings.head.odd.line,
  evenpage
]{scrheadings.head.even.line}
\AddLayersToPageStyleBeforeLayer{scrheadings}%
  {scrheadings.head.odd.line}{scrheadings.head.odd}
\AddLayersToPageStyleBeforeLayer{scrheadings}%
  {scrheadings.head.even.line}{scrheadings.head.even}

\lehead{\setlength\fboxsep{0pt}\colorbox{white}{\headmark\strut\enskip}}
\rohead{\setlength\fboxsep{0pt}\colorbox{white}{\enskip\headmark\strut}}

\renewcommand*{\chaptermarkformat}{}
\addtokomafont{pagehead}{\scshape}

\usepackage{blindtext}

\begin{document}
\Blinddocument
\end{document}

enter image description here enter image description here

  • Thanks for your extensive answer! Regarding your additional edit: I finally used this two commands: \def\verrulefill{\leaders\hrule width 0pt height 3pt depth -2.8pt \hfill}% \newcommand{\headseprule}{{\color[rgb]{0.75,0.75,0.75}\verrulefill}} to modify thickness, color and vertical position of the line. Seems a little easier. Or what else is the purpose of the large second part of your answer? – thewaywewalk Apr 19 '15 at 20:00

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.