I am using the scrreprt
class and I am trying to modify the page header in my document.
I am generating a twosided
document; chapters start on even pages. On even pages (except first page of chapter), the page header shall display the chapter title and the page number; on odd pages, the page header shall display the section title and the page number.
I have implemented these requirements in my document.
However, there is one situation with which I am not satisfied yet. I am generating a bibliography at the end of each chapter. For odd pages, the page headers behave just as I want them to, showing the "Section Title". However, if a bibliography starts on an even page, the page header says "References" instead of "Chapter Title".
I would like this to be fixed: "References" shall only appear in the page header on the succeeding pages (after the first) of the bibliography. It seems as if every bibliography is treated as a chapter of its own. How can I work on this?
Please note that I want to stick to the KOMA-class scrreprt
.
EDIT: I changed the code according to the suggestions (using refsegment instead of refsection). This is my second edit.
\documentclass[12pt, twoside, openright, chapterprefix, numbers=noenddot]{scrreprt}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm,headheight=15pt,includeheadfoot]{geometry}
\usepackage[automark,headsepline=off]{scrlayer-scrpage}
\usepackage[ngerman]{babel} % deutsche Trennregeln
\usepackage{lmodern} % fixes bug with \usepackage[T1]{fontenc}; ändert Schriftart zudem in Latin Modern
\usepackage[T1]{fontenc} % für europäische Autoren ratsam; % wichtig für Trennung von Wörtern mit Umlauten
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{etoolbox}
\usepackage{patchcmd}
\usepackage{xpatch}
\usepackage{lipsum}
\usepackage{hyperref}
\hypersetup{colorlinks=true, linktocpage=true, linktoc=all,
%linkcolor=beierblau,
citecolor=blue, filecolor=blue, urlcolor=blue, breaklinks=false,
bookmarksopen=true, colorlinks, linkcolor = black}
\usepackage[all]{hypcap} % needed to help hyperlinks direct correctly;
\usepackage[numbered]{bookmark}
%%%% Change Chapter Prefix
\setkomafont{chapterprefix}{\huge} % Default is \LARGE
%%% No Spacing Between Chapter Title and Prefix
\RedeclareSectionCommand[innerskip=0pt]{chapter} % <--- Vary distance here (Thanks @esdd!)
%%% Subsubsections kursiv erscheinen lassen + Abstand zwischen Überschrift/Nummerierung
%\usepackage[noindentafter]{titlesec}
%\titleformat{\subsection}{\sffamily \bfseries \large }{\thesubsection}{1em}{} % auch NUmmerierung kursiv
%\titleformat{\section}{\sffamily\bfseries\Large}{\thesection}{1em}{}
%\titleformat{\chapter}{\sffamily \Huge\bfseries}{\chaptername\ \thechapter}{0pt}{\vskip 0pt\raggedright} %\vskip 20pt\raggedright
%%% Page header: No Dot after Numbering & Spacing between Numbering and Title in page headers
\renewcommand*\chaptermarkformat{\thechapter \quad}
\renewcommand*\sectionmarkformat{\thesection \quad}
\renewcommand*{\headfont}{\normalfont}
%%% PAGER HEADERS
\renewcommand*\chapterpagestyle{plain.scrheadings} % default=empty
\lehead{\pagemark} % left even head
\rehead{\headmark} % right even head %leftmark = chapter
\lohead{\rightmark} % left odd head %rightmark = section
\rohead{\pagemark} % right odd head
%%% References
\usepackage[style=authoryear, backend=biber,
refsegment=chapter % benutze automatisch Kapitel als Biobliographie-Abschnitte...
]{biblatex}
\ExecuteBibliographyOptions{firstinits=true,maxcitenames=2,maxbibnames=999,isbn=false,doi=false,url=false,labeldate=true,uniquelist=minyear}
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Giancoli,
Author = {Douglas C. Giancoli},
Publisher = {Pearson},
Title = {Physics for Scientists \& Engineers},
Year = {2014},
Date-Added = {2015-10-05 12:23:12 +0000},
Date-Modified = {2015-10-05 12:23:50 +0000},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\defbibheading{subbibintoc}[\refname]{\addsec{#1}}
%%% DOCUMENT
\begin{document}
\chapter{Test-Kapitel}
\lipsum
\section{Test-Section}
\lipsum
Some \cite{Giancoli} text \autocite{Giancoli}
\lipsum
\lipsum
%\printbibliography[segment=\therefsegment]
\printbibliography[segment=\therefsegment, heading=subbibintoc, title={Literatur}]
\clearpage
\end{document}
biblatex
sets the mark, even if it is unwanted. :-) I should look at the KOMA addchap stuff.\defbibheading{subbibintoc}[\refname]{\addsec{#1}}
do what you want in all situations?refsection=chapter
, there is probably little point in calling\printbibliography
withsegment=\therefsegment
. He is also right that in a single work you probably don't want to userefsections
, you probably wantrefsegments
. Do you want independent bibliographies per chapter, or do you want them to be connected (see golatex.de/…)?titlesec
with KOMA. But again, a KOMA expert would need to tell me how to set up the headings correctly. I am coming to the conclusion that we probably need to change some of the KOMA defaults inbiblatex
, but I'm still not sure if we can make everybody happy in the end.