# scrbook - Three extremely simple questions about adjustment and font-styling

I have some (probably) really simple questions about a few adjustments in a scrbook-documents. Let's take the following minimum-example as the basis for my questions.

Working minimum-example:

\documentclass[chapterprefix=true]{scrbook}

\usepackage{lipsum}

\renewcommand*\chapterheadstartvskip{                                                          % Horizontal rule above chapter
\ifnumbered{chapter}
{\noindent\rule{\linewidth}{1pt}\par}
{}}

\renewcommand*\chapterheadendvskip{\noindent\rule{\linewidth}{1pt}\par\vspace*{\baselineskip}} % Horizontal rule below chapter

\begin{document}

\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]

\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]

\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]

\tableofcontents

\chapter{Experimental chapter - the first}

\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]

\chapter{Experimental chapter - the second}

\lipsum

\chapter{Experimental chapter - the third}

\lipsum

\chapter{Experimental chapter - the fourth}

\lipsum

\end{document}


Question 1: I want to reduce the vertical space between chapterprefix and chapter - how can I do that? I think it should be inserted a \vspace*{-Xpt} somewhere?

Screenshot to question 1:

Question 2: How can I make the headline of automatically generated elements like \tableofcontents look like the \addchap-headlines (e.g. Foreword, Note of thanks or Other blabla). Only one line below should be drawn to those automatically generated elements instead of one line above and a line below (like it is represented at the numbered-chapters). The same problem exists at \listoffigures, \listoftables, \printglossary and \printbibliography... All those mentioned and non-numbered (automated) contentelements should be drawn like regular nonumbered-chapters with only one line below.

Screenshots to question 2:

Numbered chapters (should look like\chapter - correct):

Unnumbered-chapters and automated elements (should look like \addchap - correction for automated elements needed)

Question 3: How to write \leftmark and \rightmark with sansserif-font instead of serif-font? Is it a clean solution to simply write \setkomafont{pageheadfoot}{\sf} - I get some warnings about that?

Screenshot to question 3:

\leftmark and \rightmark written in serif-font

Thank you very much for your help!

• Usually on TeX.SX you ask one question per question... – Ruben Jul 11 '15 at 21:13
• \sf is deprecated - it is from 2.09 - in LaTeX. Use \sffamily instead. The only warnings I get tell you exactly that and tell you exactly how to avoid the warnings, why you should do it differently and what to type ;). – cfr Jul 11 '15 at 21:30
• \ifnumbered{<section level>} just tests whether a particular level of sectioning is numbered. It doesn't test whether the current instance is numbered or unnumbered. – cfr Jul 11 '15 at 21:39
• Use \chapterheadmidvskip to adjust the skip between the chapter label and the title. – cfr Jul 11 '15 at 21:41

Update

Here is a new Suggestion for KOMA-Script version 3.19 or newer. There are two new commands: \chapterlinesformat and chapterlineswithprefixformat. They can be redefined to insert the lines.

With chapterprefix=true you can use

\newcommand\titlerule[1][1pt]{\rule{\textwidth}{#1}}
\renewcommand\chapterlineswithprefixformat[3]{%
\ifstr{#2}{}{}{\titlerule\par\nobreak}%
#2#3\par\nobreak\titlerule%
}


In case if the lower line should also be inserted if chapterprefix=false is used add

\makeatletter
\renewcommand\chapterlinesformat[3]{%
\@hangfrom{#2}{#3}\par\nobreak\titlerule%
}
\makeatother


MWE:

\documentclass[
chapterprefix=true
]{scrbook}[2015/09/29]
\usepackage{lipsum}

\RedeclareSectionCommand[
beforeskip=0pt,
%innerskip=0pt,
afterskip=1\baselineskip
]{chapter}

\newcommand\titlerule[1][1pt]{\rule{\textwidth}{#1}}
\renewcommand\chapterlineswithprefixformat[3]{%
\ifstr{#2}{}{}{\titlerule\par\nobreak}%
#2#3\par\nobreak\titlerule%
}

\makeatletter
\renewcommand\chapterlinesformat[3]{%
\@hangfrom{#2}{#3}\par\nobreak\titlerule%
}
\makeatother

\begin{document}
\lipsum[1-4]
\lipsum[1-4]
\lipsum[1-4]
\tableofcontents
\listoffigures
\chapter{Experimental chapter - the first}
\lipsum[1-4]
\chapter{Experimental chapter - the second}
\lipsum
\chapter{Experimental chapter - the third}
\lipsum
\chapter{Experimental chapter - the fourth}
\lipsum
\end{document}


Original answer: The space between chapterprefix and chapter is set by \chapterheadmidvskip. If there should be no additional space between this two lines you could use either

\renewcommand*\chapterheadmidvskip{\par}


or the new interface

\RedeclareSectionCommand[innerskip=0pt]{chapter}


\addchap changes secnumdepth locally, so \ifnumbered{chapter}. So your definition of \chapterheadstartvskip works with \addchap but not with \chapter*.

One possibility is changing the counter before the TOC/lists headings and reseting it after the TOC/lists headings.

\newcounter{savesecnumdepth}
\setcounter{savesecnumdepth}{\value{secnumdepth}}%
\setcounter{secnumdepth}{\partnumdepth}}


Note that option listof=totocnumbered will not work with this code. But the usage of listof=totoc is still possible.

Or you could redefine the TOC/lists headings using \addchap with an empty optional argument to avoid an entry in the table of contents:

\deftocheading{toc}{\addchap[]{#1}}


Or in a loop for all lists known by package tocbasic:

\makeatletter
\makeatother


But in that case you can not use the values totoc and leveldown for option listof.

Update

Maybe it is easier to insert the first line in \chapterformat instead in \chapterheadstartvskip.

\RedeclareSectionCommand[
beforeskip=0pt,
innerskip=0pt,
afterskip=1\baselineskip
]{chapter}

\usepackage{etoolbox}
\newcommand\titlerule[1][1pt]{\noindent\rule{\linewidth}{#1}\par}
\preto\chapterformat{\IfUsePrefixLine{\vspace{-\baselineskip}\titlerule}{}}


To get a sans-serif font in the page header and footer use

\setkomafont{pageheadfoot}{\sffamily}


Complete example:

\documentclass[chapterprefix=true]{scrbook}
\usepackage{lipsum}

\RedeclareSectionCommand[
beforeskip=0pt,
innerskip=0pt,
afterskip=1\baselineskip
]{chapter}

\usepackage{etoolbox}
\newcommand\titlerule[1][1pt]{\noindent\rule{\linewidth}{#1}\par}
\preto\chapterformat{\IfUsePrefixLine{\vspace{-\baselineskip}\titlerule}{}}

\begin{document}
\lipsum[1-4]
\lipsum[1-4]