Увеличить размер заголовка, если раздел начинается на новой странице

Увеличить размер заголовка, если раздел начинается на новой странице

Я использую класс KOMA-script scrartcl с пакетом геометрии и хотел бы, чтобы мои разделы (которые всегда начинаются на новой странице) имели дополнительный вертикальный интервал между строкой заголовка, но я не хотел бы менять заголовок для подразделов, подподразделов, абзацев, плавающих элементов и т. д.

я прочелэта почтано, к сожалению, у меня недостаточно репутации, чтобы комментировать.

Я считаю, что применение этой команды к разделу, а не только к подсекциям и подподсекциям, будет работать:

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

А вот мой 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

Отказ от ответственности: я бы рекомендовал использовать class scrreprtи \chapter.


Не злоупотребляйте \addtkomafont. В аргументе разрешены только команды шрифтов.

Измените патч на \sectionlinesformat:

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

Пример:

\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}

Результат:

введите описание изображения здесь

Связанный контент