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
    Using titlesec with KOMA is never a good idea :-( – Johannes_B May 23 '15 at 13:52
  • No! That's why I'm not using it :-) – Ivan Kapitonov May 23 '15 at 14:06
  • 2
    Certainly the preamble (and a small document body) matters. Do you really believe one can analyze the behaviour without some code? Without knowing how you implemented the lines? – Ulrike Fischer May 23 '15 at 14:24
  • @UlrikeFischer: Mea culpa. – Ivan Kapitonov May 23 '15 at 14:52
  • 3
    Replace the \newline\vspace*{-5\p@} by \\[-5pt]. \vspace inside a paragraph is inserted after the current line (and so the \vspace{-5pt} makes the space between your first two lines smaller). Btw: With your redefinitions you are completly overwriting the KOMA commands. – Ulrike Fischer May 23 '15 at 15:03
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}
  • 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
  • 1
    @esdd I was reusing code from the other answer ;-) – Johannes_B May 23 '15 at 14:46

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.