# Page header with references at end of each chapter

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[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}
citecolor=blue, filecolor=blue, urlcolor=blue, breaklinks=false,
\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

\lohead{\rightmark} % left odd head     %rightmark = section

%%% 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}

%%% DOCUMENT

\begin{document}

\chapter{Test-Kapitel}
\lipsum

\section{Test-Section}
\lipsum
Some \cite{Giancoli} text \autocite{Giancoli}
\lipsum
\lipsum

%\printbibliography[segment=\therefsegment]
\clearpage

\end{document}

• @moewe This sounds familiar. This is the same behaviour as mentioned in the issue. biblatex sets the mark, even if it is unwanted. :-) I should look at the KOMA addchap stuff. – Johannes_B Oct 1 '17 at 15:30
• Does \defbibheading{subbibintoc}[\refname]{\addsec{#1}} do what you want in all situations? – moewe Oct 1 '17 at 15:49
• refsection=chapter seems like a bad idea. – John Kormylo Oct 1 '17 at 15:51
• John is right that if you use refsection=chapter, there is probably little point in calling \printbibliography with segment=\therefsegment. He is also right that in a single work you probably don't want to use refsections, you probably want refsegments. Do you want independent bibliographies per chapter, or do you want them to be connected (see golatex.de/…)? – moewe Oct 1 '17 at 15:54
• @Johannes_B I commend your precognition. ;-) The problem here could even be made worse by using 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 in biblatex, but I'm still not sure if we can make everybody happy in the end. – moewe Oct 1 '17 at 15:57

You want

\defbibheading{subbibintoc}[\refname]{\addsec{#1}}


Simply put the code into your preamble.

The default for heading=subbibintoc is

\defbibheading{subbibintoc}[\refname]{%
\markboth{#1}{#1}}


and includes a \markboth{#1}{#1} that you don't want.

This is related to https://github.com/plk/biblatex/issues/627, where Johannes mentioned that the KOMA heading settings probably need an overhaul.

Note also that titlesec should not be used with the KOMA classes.

• Hi, can you please have a look at latex.org/forum/viewtopic.php?f=50&t=30371? I have no idea what is going on with all the ibid and idem stuff. – Johannes_B Oct 3 '17 at 7:12
• @Johannes_B Oh crikey, that is a complicated one. The code in biblatex-chicago is really complicated and lengthy and can be a pain to modify. There is \ifuniquework to check for situations where one labelname-labeltitle combination occurs more than once, one could use that to add additional information. It is not clear to me, however, what the expected behaviour would be in that case. What would one add? Can we make sure that by adding that bit we get a unique citations? Etc.? – moewe Oct 3 '17 at 7:26
• @Johannes_B Not really keen on signing up for another forum, but a first suggestion can be found at gist.github.com/moewew/9805f72a43ca2cc56ee6e4c3819a2354 This will issue a full citation if the short 'name-title' is not unique. For LyX users note that I had to add the loading option uniquework=true to biblatex-chicago (this is crucial), the other interesting bit is between the redefinition of cite. – moewe Oct 3 '17 at 7:43
• Wow, thank you. I added your remarks in a quote in a reply: latex.org/forum/… – Johannes_B Oct 3 '17 at 8:12
• @dan I have a strong hunch that that is possible, but it is not my expertise, so I can't help you much with that. Just ask a new question with a useful MWE and exact description of what you need about it and I'm sure people will be able to help you. – moewe Oct 3 '17 at 17:44