# Modifying headers and footers of a double-sided document with Koma-script "srcbook"

I am writing my thesis, I am using the KOMA-class scrbook but I got stuck while changing the style of the document.

First, I have a problem with the headers and footers. The format that I want should look like this for even and odd pages, respectively.

The preamble of my document is the following

\documentclass[twoside,12pt,headsepline,chapterprefix=true]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{slashed}
\usepackage{mathtools}
\usepackage{scrlayer-scrpage}
\usepackage{biblatex}
\usepackage{csquotes}
\usepackage{hyperref}
\pagestyle{scrheadings}
\automark{chapter}
\automark*[section]{}


But this gives me the following format

Note that the chapter and the section name appear opposite to the desired place and also the page number appears in the footer. Does anyone know a way to obtain the format I am looking for? Also, I would like to get rid of the "Chapter 2" I just want the name of the chapter in the header.

Second, since I am using a double-sided format there is a blank page after each chapter. I would like to keep those blank sheets after the title page, the acknowledgments, the abstract, and the table of contents but I do not want it in the rest of the document. Is it possible to do that?

EDIT: This is code gives something with the same format as my current document

\documentclass[twoside,12pt,headsepline,chapterprefix=true]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{slashed}
\usepackage{mathtools}
\usepackage{scrlayer-scrpage}
\usepackage{lipsum}
\pagestyle{scrheadings}
\automark{chapter}
\automark*[section]{}
\begin{document}
\frontmatter
\tableofcontents
\chapter{Acknowledgements}
\lipsum[1-3]
\chapter{Abstract}
\lipsum[4-5]
\mainmatter
\chapter{ Cha 2}
\lipsum[6-15]
\section{section 1}
\lipsum[16-22]
\end{document}

• Alberto, please post a complete, compilable document -- a "minimal working example" -- MWE. The koma-script documentation explains all your questions. Look at pages 112 and 237.
– user9424
Dec 28 '19 at 1:24

## 1 Answer

Assuming the page number should be in outer header on plain pages (eg. chapter pages) too, you can use:

\clearpairofpagestyles
\ohead*{\pagemark}
\ihead{\headmark}


To remove the chapter number from page header use

\renewcommand*\chaptermarkformat{}


To remove the blank pages in main matter you can patch \mainmatter to set KOMA-Script option open=any:

\usepackage{xpatch}
\xapptocmd{\mainmatter}{\KOMAoptions{open=any}}{}{\PatchFailed}


Example:

\documentclass[
%twoside,% default
12pt,headsepline,chapterprefix=true
]{scrbook}
\usepackage{lipsum}% only for dummy text
%\usepackage[utf8]{inputenc}% only needed for outdated TeX distributions
\usepackage{graphicx}
%\usepackage{amsmath}
\usepackage{slashed}
\usepackage{mathtools}% loads amsmath
\usepackage{scrlayer-scrpage}% sets page style scrheadings automatically
%\pagestyle{scrheadings}
\automark[section]{chapter}
\renewcommand*\chaptermarkformat{}% removes chapter number from page header

\clearpairofpagestyles
\ohead*{\pagemark}
\ihead{\headmark}

\usepackage{xpatch}
\xapptocmd{\mainmatter}{\KOMAoptions{open=any}}{}{\PatchFailed}

\begin{document}
\frontmatter
\tableofcontents
\chapter{Acknowledgements}
\lipsum[1-3]
\chapter{Abstract}
\lipsum[4-5]
\mainmatter
\chapter{Cha 1}
\lipsum[6-15]
\section{section 1}
\lipsum[16-22]
\chapter{Foo}
\lipsum[23-50]
\end{document}


Note that I have shorten

\automark{chapter}
\automark*[section]{}


to

\automark[section]{chapter}


But maybe you want

\automark[chapter]{chapter}
\automark*[section]{}