0

I'm using scrbook. Some chapter titles are long and wrap, some of those even twice. When it goes on the third line, the spacing is different than that between the first and second lines. Looks terribly annoying (sorry for the lousy screenshot):

ivanScrbookChaptertitle

I've no idea why this happens, and I can't fix it.

There's substantial "literature" here on TeX.SE on formatting titles. The closest it gets to is the very nice discussion in Control line spacing of section headings, but it uses titlesec, so not an option. I tried to redefine \chapterformat, doesn't help:

\renewcommand*{\chapterformat}{\normalfont\large\bfseries}{%
\thechapter}{1em}{\setstretch{0.1}}

I tried to apply the two solutions in Changing the linespacing of headings independently from the rest of the text. The one with the \setstretch in the mandatory argument just scales what there is. The other doesn't have any effect. The best thing that worked is looseness=-1, but it breakes "syntactic" in two.

EDIT: All apologies, here's a MWE:

\documentclass[a4paper,10pt,headings=optiontohead,version=last,openany]{scrbook}
\usepackage{kantlipsum}\date{}
\usepackage{suffix}
\renewcommand{\sectionmark}[1]{}%prevent rewriting \markright 
\renewcommand{\subsectionmark}[1]{}%prevent rewriting \markright 
\newcommand{\chapterauthor}[1]{\authortoc{#1}\printchapterauthor{#1}\markright{#1}}% setting \markright to author

\makeatletter
\newcommand{\printchapterauthor}[1]{%
 {\parindent0pt\vspace*{-10pt}%
 \linespread{1.1}\large\scshape#1%
 \par\nobreak\vspace*{30pt}}
 \@afterheading%
}
\newcommand{\authortoc}[1]{%
 \addtocontents{toc}{\vskip-10pt}%
 \addtocontents{toc}{%
 \protect\contentsline{chapter}%
 {\hskip1.3em\mdseries\scshape\protect\scriptsize#1}{}{}}
 \addtocontents{toc}{\vskip5pt}%
}
\makeatother
%% chapter formatting 
%% based on https://tex.stackexchange.com/a/173857/12934
\makeatletter
\renewcommand{\@chapapp}{}% remove the word `chapter'
\renewcommand*{\chapterformat}{%
  \linespread{2.5}\chapappifchapterprefix{\ }\thechapter\autodot\enskip}

\def\@makechapterhead#1{%
\vspace*{10\p@}%
{\parindent \z@ \raggedleft \reset@font
    \Huge \sffamily \@chapapp{}  \thechapter\vspace*{-15\p@}
    \par\nobreak
    \interlinepenalty\@M\hrulefill\newline\vspace*{-5\p@}
    \LARGE \sffamily #1\par\nobreak
    \vspace*{-8\p@}%
    \hrulefill
    \par\nobreak
    \vskip 30\p@
}}

\def\@makeschapterhead#1{%
\vspace*{4\p@}%
{\parindent \z@ \raggedleft \reset@font
    \sffamily
    \interlinepenalty\@M\hrulefill\newline\vspace*{-5\p@}
    \Huge \bfseries #1\par\nobreak
    \vspace*{-8\p@}%
    \hrulefill
    \par\nobreak
    \vskip 30\p@
}}

\begin{document}
\chapter{The walzing wombat went to the lazy lizard to get to the
dixie dancing ducks to have a meal of beloved bananas}
\kant[2]
\end{document}

I think now that the custom formatting is triggering it somehow...

1 Answers1

4

For a lack of the actual code, i cannot really tell why this spacing is introduced, but here a solution using KOMA-only methods.

ivanKOMAChapterTitle

\documentclass[english]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{blindtext}

\KOMAoption{chapterprefix}{true}
\renewcommand*\raggedchapter{\raggedleft}
\addtokomafont{chapter}{\large}
\renewcommand*{\chapterformat}{\thechapter\autodot\IfUsePrefixLine{}{\enskip}}
\RedeclareSectionCommand[beforeskip=0pt]{chapter}
\renewcommand{\chapterheadmidvskip}{%
    \par\nobreak\vskip -.1cm {\rule{.4\textwidth}{.5pt}}\par%
}
\renewcommand{\chapterheadendvskip}{%
    \begingroup
    \raggedchapter
    \rule{0.9\textwidth}{.5pt}\par%
\vspace*{\baselineskip}%
\endgroup
}

\usepackage{geometry}% Just for this test
\geometry{ margin=7cm }
\begin{document}
\blinddocument
\chapter{The walzing wombat went to the lazy lizard to get to the
dixie dancing ducks to have a meal of beloved bananas}
\blindtext
\end{document}

With a bit of tweaking, we get this:

ivanKomaChaptertitleMod

\documentclass[english]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{blindtext}
\usepackage{libertine}

\KOMAoption{chapterprefix}{true}
\renewcommand*\raggedchapter{\raggedleft}
\setkomafont{chapter}{\normalfont\large\sffamily}
\renewcommand*{\chapterformat}{\thechapter\autodot\IfUsePrefixLine{}{\enskip}}
\RedeclareSectionCommand[beforeskip=0pt]{chapter}
\renewcommand{\chapterheadmidvskip}{%
    \par\nobreak\vspace{\baselineskip}{\rule[.7\baselineskip]{.4\textwidth}{.4pt}}\par%
}
\renewcommand{\chapterheadendvskip}{%
\begingroup%
\raggedchapter%
\rule{\textwidth}{.5pt}\par%
\vspace*{\baselineskip}%
\endgroup%
}

\usepackage{geometry}
\geometry{ margin=6.9cm }
\begin{document}
\blinddocument
\chapter{The walzing wombat went to the lazy lizard to get to the
dixie dancing ducks to get some of their beloved bananabread}
\blindtext
\end{document}
Johannes_B
  • 24,235
  • 10
  • 93
  • 248
  • Elke, siehst du das raggedleft im endvskip-Teil? Die raggedchapter Gruppe wird schon vorher geschlossen. Ist jetzt die Frage, sollte das mit in der ragged-Gruppe enthalten sein? Früher zumindest wurde in der Doku die Möglichkeit der Nutzung von Nicht-Space erwähnt. – Johannes_B May 23 '15 at 14:13
  • Maybe \raggedchapter instead \raggedleft is better? And you could use \renewcommand*{\chapterformat}{\thechapter\autodot\IfUsePrefixLine{}{\enskip}} and \renewcommand*{\chapterheadmidvskip}{% \par\nobreak\vspace*{-\parskip}\vspace*{-.6\baselineskip}% \rule{0.4\textwidth}{.5pt}\par\nobreak\vskip.4\baselineskip% } Wegen der ragged Gruppe kann ich ihn nach seinem Urlaub fragen. – esdd May 23 '15 at 14:38
  • Alas, that doesn't help. I'll post my code in a minute. – Ivan Kapitonov May 23 '15 at 14:38
  • Why \raggedleft to align a simple rule? Why not \hfill? – Ulrike Fischer May 23 '15 at 14:43
  • @UlrikeFischer Esdd is right, raggedchapter would be more suited, in case the OP later decides to set this to raggedright or centered. – Johannes_B May 23 '15 at 14:44
  • 1
    @esdd I was reusing code from the other answer ;-) – Johannes_B May 23 '15 at 14:46
  • @IvanKapitonov How is my solution supposed to work? You are setting chapterhead yourself. This wouldn't even use my solution. – Johannes_B May 23 '15 at 14:58
  • @Johannes_B: You mean, because of redefinitions? – Ivan Kapitonov May 23 '15 at 15:13
  • You are defining @@makechapterhead and completely thowing a stick in the KOMA-machine. Try out my code as it is, it should work just fine. A few adjustments need to be made, considering the spacing and maybe a lighter font shape. – Johannes_B May 23 '15 at 15:15
  • Actually touching the @ stuff should be a warning sign, the makeatletter is a switch to expert-mode command, and hence should be dealt with in a sensible way. – Johannes_B May 23 '15 at 15:17
  • @Johannes_B: That was stuff borrowed from elsewhere, -- but I take your point completely, it doesn't mean I shouldn't care about what I declare. And yes, your solution works, I'll study and tweak it. – Ivan Kapitonov May 23 '15 at 15:20
  • @esdd Do you think it would be a good idea to put the chaptertitle (maybe even the prefix) in a box of a given width? I initially had the lower rule to a width of .9\textwidth. Consider 70% and the text would surely extend the rule making it even more ugly. – Johannes_B May 23 '15 at 15:27