0

I'm using the KOMA-script scrartcl class with the geometry package and would like to have my sections (which always start on a new page) have some extra vertical spacing between the headsepline, but I would not like to change the headsep for subsections, subsubsections, paragraphs, floats, etc.

I've read this post but unfortunately, I don't have enough rep to comment.

I believe that applying this command to the section, but not sub and subsub section only, would work:

\usepackage{xpatch}
\xpretocmd\sectionlinesformat{\vspace*{0pt}}{}{\PatchFailed}

And here is my MWE:

%%% Preamble
\documentclass[12pt,
twoside=false,
letterpaper,
hidelinks,
parskip=half,
onehalfspacing,
bibliography=numbered,
numbers=noenddot]{scrartcl}

\usepackage[headsepline]{scrlayer-scrpage}  % enable header line

\usepackage[
top=3cm,
headheight=2.5cm, % 17pt as per the warning by fancyhdr 17pt = about 0.6cm
headsep=1em,
%includehead,  % do not includefoot so that you can strictly define the top of the footer
heightrounded, % to avoid spurious underfull messages
footskip=5mm,
bottom=1cm,
bindingoffset=0.0mm,
left=2.2cm,
right=2.2cm,
%showframe=true,
]{geometry} 

\usepackage{xpatch}
\xpretocmd\sectionlinesformat{\vspace*{0pt}}{}{\PatchFailed}  % adds padding to subsections also :(

\addtokomafont{section}{\clearpage}
\RedeclareSectionCommand[beforeskip=1.0em,afterskip=0.01em]{section}
\RedeclareSectionCommand[beforeskip=1.0em, afterskip=0.01em]{subsection}
\RedeclareSectionCommand[beforeskip=1.0em, afterskip=0.01em]{subsubsection}


\usepackage{blindtext}

%%%   Document  %%%
\begin{document}

\blindtext

\blinddocument

\blindtext

\blindtext

\blinddocument

\end{document}
1

Disclaimer: I would suggest to use class scrreprt and \chapter.


Do not misuse \addtkomafont. There are only font commands allowed in the argument.

Change the patch of \sectionlinesformat to:

\usepackage{xpatch}
\xpretocmd\sectionlinesformat
  {\ifstr{#1}{section}{\clearpage\vspace*{0pt}}{}}
  {}{\PatchFailed}

Example:

\documentclass[12pt,
twoside=false,
letterpaper,
%hidelinks,
parskip=half,
%onehalfspacing,
bibliography=numbered,
numbers=noenddot]{scrartcl}
\usepackage{blindtext}% only for dummy text

\usepackage[headsepline]{scrlayer-scrpage}  % enable header line

\usepackage[
top=3cm,
headheight=2.5cm, % 17pt as per the warning by fancyhdr 17pt = about 0.6cm
headsep=1em,
%includehead,  % do not includefoot so that you can strictly define the top of the footer
heightrounded, % to avoid spurious underfull messages
footskip=5mm,
bottom=1cm,
%bindingoffset=0.0mm,
left=2.2cm,
right=2.2cm,
%showframe=true,
]{geometry} 

\usepackage{xpatch}
\xpretocmd\sectionlinesformat
  {\ifstr{#1}{section}{\clearpage\vspace*{0pt}}{}}
  {}{\PatchFailed}

\RedeclareSectionCommands
  [beforeskip=1.0em,afterskip=0.01em]
  {section,subsection,subsubsection}

\begin{document}
\blindtext
\blinddocument
\blindtext
\blindtext
\blinddocument
\end{document}

Result:

enter image description here

  • Thank you very much. May I ask why you would recommend using the scrreprt class instead? I prefer scrartcl because of the similar behavior of section/sub/subsub headings. – likethevegetable Aug 19 at 16:03
  • A chapter starts on a new page by default and there will be vertical space (beforeskip) before the chapter title by default. – esdd Aug 19 at 16:07
  • Understandable - however I would need to add some commands to get my chapter headings behaving like sections wouldn't I? Just curious if it is really worth it to use the scrreprt and make the changes to get the chapter headings behavings like sections... Are there any other advantages of using scrreprt that might convince me? Thanks again. – likethevegetable Aug 19 at 16:13

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.