2

Trying to customise chapter heading, i have trouble controlling the vertical spacing between the rule and the chapter name. I would like to use paragraph spacing instead of indentation, so i'm using the Koma options parskip=half*

But the spacing described before is bigger than with parskip=false and feels weird.

How can I define \chapterformat to avoid this issue?

Here is a somewhat MWE :

\documentclass[fontsize=12pt,french]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage{luatextra}
\usepackage{polyglossia}
\usepackage{blindtext}

\defaultfontfeatures{Ligatures=TeX} % To support LaTeX quoting style
\setmainfont{Cambria}
\setsansfont{Calibri}

\KOMAoption{chapterprefix}{true}
\KOMAoptions{%
    parskip=half*
}%
\renewcommand*\raggedchapter{\centering}
\RedeclareSectionCommand[beforeskip=0pt,afterskip=8\baselineskip,innerskip=0pt]{chapter}
%\setkomafont{chapterprefix}{\normalsize\mdseries}

\renewcommand*{\chapterformat}{%
  \chapappifchapterprefix{\nobreakspace}\thechapter\autodot%
  \IfUsePrefixLine{%
    {\parskip=0pt\par}\nobreak\vspace{-\parskip}\vspace{-.6\baselineskip}%
    \rule{0.9\textwidth}{.5pt}%
  }{\enskip}%
}

\newcommand\SectionFontStyle{\sffamily}

\setkomafont{sectioning}{\SectionFontStyle}
\addtokomafont{chapter}{\bfseries\scshape}    % Chapter in samm capitals font

\begin{document}
\tableofcontents
\chapter{Chapter One}
\textbf{\KOMAScriptVersion}
\par
\Blindtext
\addchap{Chapter without number}
\Blindtext
\end{document}

1 Answer 1

3

You could set innersep=-\parskip:

\documentclass[fontsize=12pt,french]{scrreprt}
%\usepackage[utf8]{inputenc}
\usepackage{luatextra}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\usepackage{blindtext}

\defaultfontfeatures{Ligatures=TeX} % To support LaTeX quoting style
\setmainfont{Cambria}
\setsansfont{Calibri}

\KOMAoption{chapterprefix}{true}
\KOMAoptions{%
    parskip=half*
}%
\renewcommand*\raggedchapter{\centering}
\RedeclareSectionCommand[
  beforeskip=0pt,afterskip=8\baselineskip,
  innerskip=-\parskip% <- changed
]{chapter}

\renewcommand*{\chapterformat}{%
  \chapappifchapterprefix{\nobreakspace}\thechapter\autodot%
  \IfUsePrefixLine{%
    \par\nobreak\vspace{-\parskip}\vspace{-.6\baselineskip}%
    \rule{0.9\textwidth}{.5pt}%
  }{\enskip}%
}

\newcommand\SectionFontStyle{\sffamily}
%
\setkomafont{sectioning}{\SectionFontStyle}
\addtokomafont{chapter}{\bfseries\scshape}    % Chapter in samm capitals font

\begin{document}
\tableofcontents
\chapter{Chapter One}
\textbf{\KOMAScriptVersion}
\par
\Blindtext
\addchap{Chapter without number}
\Blindtext
\end{document}

enter image description here


Another possibility is innerskip=0pt and

\renewcommand*{\chapterformat}{%
  \chapappifchapterprefix{\nobreakspace}\thechapter\autodot%
  \IfUsePrefixLine{%
    \par\nobreak\vspace{-\parskip}\vspace{-.6\baselineskip}%
    \rule{0.9\textwidth}{.5pt}%
    \vspace{-\parskip}% <- added
  }{\enskip}%
}
2
  • Thank you, that makes sense and works for this MWE. Unfortunately I cant apply to my thesis. it compiles ok with innerskip=0pt, but errors out with innerskip=-\parskip. ! Extra \else. \XKV@wh@list ...r \expandafter \XKV@wh@list \else \def #3{#6}\expandafter \e... l.28 ...,afterskip=0pt,innerskip=-\parskip]{chapter} I'm ignoring this; it doesn't match any \if. My template is much more complicated, any hint on what could trigger this?
    – Snow
    Commented Sep 16, 2017 at 11:02
  • @Snow You could add \vspace{-\parskip} to the redefinition of \chapterformat.
    – esdd
    Commented Sep 16, 2017 at 13:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .