我正在使用 KOMA-script scrbook 编写文档。我已自定义章节标题,使其看起来像下面的示例 1 (从这个问题)。这些是带编号的章节。但是,当使用无编号章节时,标题会被推到页面顶部。我该如何更改它,以便无编号章节标题与带编号的章节处于同一级别?
编辑:我简化了我的代码,因此它只显示相关部分。
梅威瑟:
\documentclass[11pt, a4paper, numbers=noenddot, headinclude, chapterprefix]{scrbook}
\usepackage[left=30mm,right=20mm,top=25mm,bottom=20mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[headsepline]{scrlayer-scrpage}
\RedeclareSectionCommand[
beforeskip=0pt,
innerskip=0pt,
afterskip=1.725\baselineskip plus .115\baselineskip minus .192\baselineskip
]{chapter}
\renewcommand\raggedchapter{\raggedleft}
\renewcommand\chapterformat{{\fontsize{80pt}{80pt}\selectfont{\thechapter}}}
\renewcommand\chapterlineswithprefixformat[3]{%
#2#3%
\vspace*{-.5\baselineskip}
\rule{\textwidth}{.4pt}\par\nobreak
}
\begin{document}
\chapter*{Abstract}
\chapter{Einleitung}
\end{document}
答案1
您可以放大beforeskip
并将章节编号放在章节标题前的此处:
\documentclass[
%11pt, a4paper,% <- default
numbers=noenddot, headinclude, chapterprefix
]{scrbook}
\usepackage[left=30mm,right=20mm,top=25mm,bottom=20mm]{geometry}
%\usepackage[utf8]{inputenc}% <- needed with older TeX distributions
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[headsepline]{scrlayer-scrpage}
\RedeclareSectionCommand[
beforeskip=60pt,% <- changed (vertical space for the chapter number)
innerskip=0pt,
afterskip=1.725\baselineskip plus .115\baselineskip minus .192\baselineskip
]{chapter}
\renewcommand\raggedchapter{\raggedleft}
\renewcommand\chapterformat{{\fontsize{80pt}{80pt}\selectfont{\thechapter}}}
\renewcommand\chapterlineswithprefixformat[3]{%
\parbox[b][\baselineskip]{\linewidth}{\raggedchapter#2#3}\par\nobreak% <- changed
\vspace*{-.5\baselineskip}
\rule{\textwidth}{.4pt}\par\nobreak
}
\begin{document}
\addchap*{Abstract}
\chapter{Einleitung}
\end{document}
请注意,我添加了twoside=false
可视化结果的选项: