我已经使用 KOMA 选项格式化了章节标题,以使章节编号显示在章节标题上方。不幸的是,我不知道如何让两个章节名称以相同的高度开始。这张图片显示了我当前 MWE 的输出。也许有人可以帮助我解决这个问题。提前致谢!
\documentclass[
a4paper,
10pt,
listof=totoc,
bibliography=totoc,
twoside,
]{scrreprt}
\usepackage[no-math]{fontspec}
\PassOptionsToPackage{no-math}{fontspec}
\usepackage[showframe]{geometry}
\usepackage{blindtext}
\usepackage{footnotebackref}
\hypersetup{pdfpagelayout=TwoPageRight}
\setlength{\parindent}{0pt}
\KOMAoptions{chapterprefix=true}
\renewcommand{\raggedchapter}{\raggedleft}
\renewcommand{\chapapp}{}
\RedeclareSectionCommand[
prefixfont = \bfseries\fontsize{50}{52}\selectfont,
font = \Huge,
beforeskip = 40pt,
innerskip = 0pt,
afterskip = 40pt,
]{chapter}
\begin{document}
\chapter*{Unnumbered Chapter} \addcontentsline{toc}{chapter}{Unnumbered Chapter}
\blindtext
\chapter{Numbered Chapter}
\blindtext
\end{document}
答案1
您可以重新定义\chapterlineswithprefixformat
:
\documentclass[
%a4paper,% default
10pt,
listof=totoc,
bibliography=totoc,
twoside
]{scrreprt}
\usepackage[no-math]{fontspec}
\usepackage[showframe]{geometry}
\usepackage{blindtext}
\usepackage{footnotebackref}
\hypersetup{pdfpagelayout=TwoPageRight}
%\setlength{\parindent}{0pt}% use class option parskip=half or parskip=full
\KOMAoptions{chapterprefix=true}
\renewcommand*{\raggedchapter}{\raggedleft}
\renewcommand*{\chapterformat}{\thechapter}
\RedeclareSectionCommand[
prefixfont = \bfseries\fontsize{50}{52}\selectfont,
font = \Huge,
beforeskip = 40pt,
innerskip = 0pt,
afterskip = 40pt,
]{chapter}
\makeatletter
\renewcommand*\chapterlineswithprefixformat[3]{%
\Ifstr{#1}{chapter}
{\IfArgIsEmpty{#2}
{{\usekomafont{#1prefix}{%
\mbox{}%
\setlength{\@tempskipa}{\csname scr@#1@innerskip\endcsname}\chapterheadmidvskip
}}#3%
}% unnumbered chapter headings
{#2#3}% numbered chapter headings
}
{#2#3}% other headings using style=chapter
}
\makeatother
\begin{document}
\addchap{Unnumbered Chapter}% unnumbered chapter with ToC entry
\blindtext
\chapter{Numbered Chapter}
\blindtext
\end{document}