1

I am using the scrreprt class and biblatex with backend=biber to include bibliographies at the end of each chapter. In my MWE you can see which other packages I am using to include pdfbookmarks and to set up hyperlinks. Also, I am using a code tweak to make the references local to each chapter.

I had the issue that the links of the bibliographies for each chapter (both in ToC and in pdfbookmarks) jump to the last section before the chapter bibliographies instead of the actual bibliographies instead.

In the meantime, I have figured out which lines in my code cause this issue: They are all related to the titlesec package and are currently commented out (see MWE below).

Thus, I am now trying to achieve the same layout changes I had realised using titlesec - but with another package or a different solution, respectively.

The desired formatting of titles is:

  1. increase horizontal separation of the titles and their corresponding numbering
  2. increase vertical spacing between chapter title and text
  3. increase vertical spacing before and after section and subsection titles

Please let me know some of your suggestions to make this work. Thanks in advance. Please note that I want to stick to the scrreprt class.

\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,    
    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}
\usepackage{booktabs}
\usepackage{tocloft}


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


%%% making links local in refsegments (https://tex.stackexchange.com/questions/303503/hyperref-inside-refsegment-always-linking-to-first-bibliography-not-current-bib)
% refsegment allows to use the same labels throughout the whole document
\makeatletter
\appto\blx@mkhyperref{%
    \let\blx@anchors\@empty
    \ifundef\hyper@natanchorstart
    {\protected\def\blx@anchor{%
            \xifinlist{\the\c@refsection @\the\c@refsegment @\abx@field@entrykey}{\blx@anchors}
            {}
            {\listxadd\blx@anchors{\the\c@refsection @\the\c@refsegment @\abx@field@entrykey}%
                \hypertarget{cite.\the\c@refsection @\the\c@refsegment @\abx@field@entrykey}{}}}}
    {\protected\def\blx@anchor{%
            \xifinlist{\the\c@refsection @\the\c@refsegment @\abx@field@entrykey}{\blx@anchors}
            {}
            {\listxadd\blx@anchors{\the\c@refsection @\the\c@refsegment @\abx@field@entrykey}%
                \hyper@natanchorstart{\the\c@refsection @\the\c@refsegment @\abx@field@entrykey}%
                \hyper@natanchorend}}}}

\appto\blx@mkhyperref{%
    \protected\def\blx@imc@bibhyperref{%
        \@ifnextchar[%]
        {\blx@bibhyperref}
        {\blx@bibhyperref[\abx@field@entrykey]}}%
    \ifundef\hyper@natanchorstart
    {\long\def\blx@bibhyperref[#1]#2{%
            \blx@sfsave\hyperlink{cite.\the\c@refsection @\the\c@refsegment @#1}{\blx@sfrest
                #2%
                \blx@sfsave}\blx@sfrest}%
        \protected\long\def\blx@imc@bibhyperlink#1#2{%
            \blx@sfsave\hyperlink{cite.\the\c@refsection @\the\c@refsegment:#1}{\blx@sfrest
                #2%
                \blx@sfsave}\blx@sfrest}%
        \protected\long\def\blx@imc@bibhypertarget#1#2{%
            \blx@sfsave\hypertarget{cite.\the\c@refsection @\the\c@refsegment:#1}{\blx@sfrest
                #2%
                \blx@sfsave}\blx@sfrest}}%
    {\long\def\blx@bibhyperref[#1]#2{%
            \blx@sfsave\hyper@natlinkstart{\the\c@refsection @\the\c@refsegment @#1}\blx@sfrest
            #2%
            \blx@sfsave\hyper@natlinkend\blx@sfrest}%
        \protected\long\def\blx@imc@bibhyperlink#1#2{%
            \blx@sfsave\hyper@natlinkstart{\the\c@refsection @\the\c@refsegment:#1}\blx@sfrest
            #2%
            \blx@sfsave\hyper@natlinkend\blx@sfrest}%
        \protected\long\def\blx@imc@bibhypertarget#1#2{%
            \blx@sfsave\hyper@natanchorstart{\the\c@refsection @\the\c@refsegment:#1}\blx@sfrest
            #2%
            \blx@sfsave\hyper@natanchorend\blx@sfrest}}
    \let\blx@imc@ifhyperref\@firstoftwo
    \def\blx@sf{\spacefactor}%
    \def\blx@sfsave{%
        \blx@leavevmode
        \numgdef\blx@sf{\spacefactor}}%
    \def\blx@sfrest{%
        \ifhmode\spacefactor\blx@sf\relax\fi
        \gdef\blx@sf{\spacefactor}}}
\makeatother

%%% Fixing page headers for bibliographies
%https://tex.stackexchange.com/questions/394102/page-header-with-references-at-end-of-each-chapter#394181
\defbibheading{subbibintoc}[\refname]{\addsec{#1}}


%%% Example bibliography
\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}


%%%% 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!)


%%%% heading format + horizontal spacing between heading and numbering
%\usepackage[noindentafter]{titlesec}
%\titleformat{\subsection}{\sffamily \bfseries \large }{\thesubsection}{1em}{}   % add "\itshape" für kursive Schreibweise
%\titleformat{\section}{\sffamily\bfseries\Large}{\thesection}{1em}{}
%\titleformat{\chapter}{\sffamily \Huge\bfseries}{\chaptername\ \thechapter}{0pt}{\vskip 0pt\raggedright}   %\vskip 20pt\raggedright
%
%
%%%%% verstical spacing between Chapter-Title and text
%% Alter <after-sep> in the macro below to vary the separation after the \chapter title.
%\titlespacing{\chapter}{0pt}{5pt}{150pt}% \titlespacing{<command>}{<left>}{<before-sep>}{<after-sep>}[<right>]
%% try \parskip, 5\baselineskip and 150pt
%
%
%%%% vertical spacing before and after section/subsection-titles 
%%\titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}
%\titlespacing*{\section}
%{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
%\titlespacing*{\subsection}
%{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}

%%% DOCUMENT

\begin{document}

%%% ToC
\phantomsection                             
\pdfbookmark{Inhaltsverzeichnis}{toc}   %include ToC in Hyperlink-Navigation
\setcounter{tocdepth}{4}
\tableofcontents

%%% Test Chapeters
\chapter{Test-Kapitel}
    \lipsum

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

\subsection{Test-Section}
\lipsum

%%% Test Bibliography for Test Chapter
\printbibliography[segment=\therefsegment, heading=subbibintoc, title={Literatur}]  
\clearpage


\end{document}
4

Maybe you want the following KOMA-Script code:

\renewcommand\chapterformat{\chapapp\ \thechapter}
\renewcommand\sectionformat{\thesection\hspace{1em}}
\renewcommand\subsectionformat{\thesubsection\hspace{1em}}

\RedeclareSectionCommand[
  beforeskip=-5pt,
  innerskip=0pt,%<- vertical space between chapter number and chapter title
  afterskip=150pt
]{chapter}
\RedeclareSectionCommands[
  beforeskip=-5.5ex plus -1ex minus -.2ex,
  afterskip=4.3ex plus .2ex
]{section,subsection}

\setkomafont{chapter}{\Huge}
%\setkomafont{chapterprefix}{\huge}% I don't know if you want this
\setkomafont{section}{\Large}
\setkomafont{subsection}{\large}
  • Do you happen to know the default values of beforeskip, innerskip, and afterskip? I am asking so I can modify the commands back to default at the beginning of the appendix. Thanks in advance. – dan Oct 10 '17 at 12:34
  • 1
    See the KOMA-Script documentation. With headings=big (default): afterskipfor chapter is 1.725\baselineskip plus .115\baselineskip minus .192\baselineskip and beforeskip is -3.3\baselineskip-\parskip. Default innerskipfor chapter is .5\baselineskip. – esdd Oct 10 '17 at 12:45

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.