
我正在使用帶有幾何包的 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
免責聲明:我建議使用 classscrreprt
和\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}
結果: