在 scrreprt 中,我想要
- 「章節」一詞和章節號位於連續兩行中(已實現)
- 「章節」一詞和要縮排的章節號(已實現)
- 「章節」一詞和章節編號採用不同的樣式(已實現)
- 要縮排的章節標題
- 章節標題為斜體
我已經實現了 1、2 和 3,但不知道如何獲得 4 和 5
微量元素:
\documentclass[chapterprefix=true]{scrreprt}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{lipsum}
%%%--chapter no. underneath the word "chapter" and in different styles
\renewcommand*{\chapterformat}{%
\hskip 2cm \mychaptername{\chaptername}\\*\vskip 0.5\baselineskip
\hskip 2cm \mychapternumber{\thechapter}%
}
\newcommand{\mychaptername}[1]{%
\usekomafont{chapter}%
{\color{black}\bfseries\fontsize{20}{20}\selectfont#1}%
}%
\newcommand{\mychapternumber}[1]{%
\usekomafont{chapter}%
{\color{blue}\bfseries\fontsize{40}{40}\selectfont#1}%
}%
%%%--chapter title indented and in italics
\renewcommand*{\chapterlinesformat}[3]{%
\hskip 2cm \mychaptertitle{#3}%
#2%
}
\newcommand{\mychaptertitle}[1]{%
\usekomafont{chapter}%
{\itshape#1}%
}
\begin{document}
\chapter{General Introduction}
\lipsum[1]
\end{document}
答案1
你設定了 option chapterprefix
,所以你必須重新定義\chapterlineswithprefixformat
:
\documentclass[chapterprefix=true]{scrreprt}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{lipsum}% only for dummy text
\addtokomafont{chapter}{\itshape}
\addtokomafont{chapterprefix}{\upshape}
\newkomafont{chapternumber}{\usekomafont{chapterprefix}\color{blue}\fontsize{40}{40}\selectfont}
\newlength{\chapterindent}
\setlength{\chapterindent}{2cm}
\renewcommand*{\chapterformat}{%
\IfUsePrefixLine
{%
\hskip\chapterindent\chapapp\\*\vskip 0.5\baselineskip
\hskip\chapterindent {\usekomafont{chapternumber}\thechapter}%
}{%
\thechapter\autodot\enskip
}%
}
\makeatletter
\renewcommand*{\chapterlineswithprefixformat}[3]{%
#2%
\@hangfrom{\hskip \chapterindent}{#3}%
}
\makeatother
\begin{document}
\tableofcontents
\chapter{General Introduction}
\lipsum[1]
\chapter{Long chapter title which fills more than one line}
\lipsum[2]
\end{document}