3

Using scrlayer-scrpage in the documentclass scrreprt, I would like the word "Chapter 1" (or 2 or whichever chapter it is) to appear in the outer head of the even pages and the chapter title - without "Chapter 1" before it - in the outer head of the odd pages (see image). EDIT: In unnumbered chapters, the lehead should be empty. How do I achieve that?

enter image description here

My MWE:

\documentclass[twoside, openright, BCOR=1cm, bibliography=totoc,headsepline,chapterprefix=true]{scrreprt}

\usepackage{scrlayer-scrpage}

\pagestyle{scrheadings}
\automark[chapter]{chapter}
\usepackage{lipsum}

\setcounter{secnumdepth}{0}

\begin{document}

\chapter{An interesting title}
\thispagestyle{empty}

\newpage

\section{A slightly less interesting title}
\lipsum[1-5]

\end{document}

2 Answers 2

3

Question: What should be in header of even pages, if the chapter is unnumbered?


Here is a suggestion, where the chapter title would be used on even pages in unnumbered chapters:

\documentclass[
  twoside, open=right, BCOR=1cm,
  bibliography=totoc,
  headsepline,
  chapterprefix=true
]{scrreprt}
\usepackage{blindtext}% only for dummy text

\usepackage{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\automark{chapter}

\renewcommand*\chaptermark[1]{%
  \markboth{\ifnumbered{chapter}{\chaptermarkformat}{#1}}{#1}%
}

\begin{document}
\tableofcontents
\chapter{Numbered Chapter}
\blindtext
\section{Numbered Section}
\Blindtext[10]
\addchap{Unnumbered Chapter}
\blindtext
\addsec{Unnumbered Section}
\Blindtext[10]
\end{document}

or without package scrlayer-scrheadings:

\documentclass[
  twoside, open=right, BCOR=1cm,
  bibliography=totoc,
  headsepline,
  chapterprefix=true
]{scrreprt}
\usepackage{blindtext}% only for dummy text

\pagestyle{headings}

\renewcommand*\chaptermark[1]{%
  \markboth{\ifnumbered{chapter}{\chaptermarkformat}{#1}}{#1}%
}
\renewcommand*\sectionmark[1]{}

\begin{document}
\tableofcontents
\chapter{Numbered Chapter}
\blindtext
\section{Numbered Section}
\Blindtext[10]
\addchap{Unnumbered Chapter}
\blindtext
\addsec{Unnumbered Section}
\Blindtext[10]
\end{document}

If the header of the even page should be empty for unnumbered chapters, you can use

\renewcommand*\chaptermark[1]{%
  \markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}

Additionally you have to switch to manual marks and to set the marks for the TOC etc. manually:

\manualmark% or option manualmark for package `scrlayer-scrpage`
\AfterTOCHead[toc]{\markboth{}{\contentsname}}
%\AfterTOCHead[lof]{\markboth{}{\listfigurename}}
%\AfterTOCHead[lot]{\markboth{}{\listfigurename}}

Example:

\documentclass[
  twoside, open=right, BCOR=1cm,
  bibliography=totoc,
  headsepline,
  chapterprefix=true
]{scrreprt}
\usepackage{blindtext}% only for dummy text

\usepackage[manualmark]{scrlayer-scrpage}% sets pagestyle scrheadings automatically

\renewcommand*\chaptermark[1]{%
  \markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}

\AfterTOCHead[toc]{\markboth{}{\contentsname}}
%\AfterTOCHead[lof]{\markboth{}{\listfigurename}}
%\AfterTOCHead[lot]{\markboth{}{\listfigurename}}

\begin{document}
\tableofcontents
\chapter{Numbered Chapter}
\blindtext
\section{Numbered Section}
\Blindtext[10]
\addchap{Unnumbered Chapter}
\blindtext
\addsec{Unnumbered Section}
\Blindtext[10]
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\end{document}

or without package scrlayer-scrheadings:

\documentclass[
  twoside, open=right, BCOR=1cm,
  bibliography=totoc,
  headsepline,
  chapterprefix=true
]{scrreprt}
\usepackage{blindtext}% only for dummy text

\pagestyle{myheadings}

\renewcommand*\chaptermark[1]{%
  \markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}

\AfterTOCHead[toc]{\markboth{}{\contentsname}}
%\AfterTOCHead[lof]{\markboth{}{\listfigurename}}
%\AfterTOCHead[lot]{\markboth{}{\listfigurename}}

\begin{document}
\tableofcontents
\chapter{Numbered Chapter}
\blindtext
\section{Numbered Section}
\Blindtext[10]
\addchap{Unnumbered Chapter}
\blindtext
\addsec{Unnumbered Section}
\Blindtext[10]
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\end{document}
1
  • in unnumbered chapters, the header should indeed be empty, thanks for anticipating that! I edited my question accordingly.
    – C.Carl
    Commented Aug 19, 2019 at 13:53
1

You can redefine \chaptermark and \sectionmark in order to achieve this.

\documentclass[twoside]{scrreprt}

\usepackage{lipsum} % just for example text

\pagestyle{headings}

\renewcommand*\chaptermark[1]{%
  \markboth{Chapter~\thechapter}{#1}%
}
\renewcommand*\sectionmark[1]{}

\begin{document}

\chapter{Some Title}
\lipsum[1-5]

\section{A Section}
\lipsum[6-12]

\section{Another Section}
\lipsum[13-20]

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .