
私はジオメトリ パッケージで KOMA スクリプトの scrartcl クラスを使用しており、セクション (常に新しいページで始まる) の headsepline 間に余分な垂直間隔を持たせたいのですが、サブセクション、サブサブセクション、段落、フロートなどの headsep を変更したくありません。
もう読んだこの郵便受けしかし残念ながら、コメントするには十分な評判がありません。
このコマンドをセクションに適用し、サブセクションとサブサブセクションのみに適用しないと機能すると思います。
\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
免責事項: クラス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}
結果: