完成论文后,我开始用我所有的诗歌写一本书。由于我的论文,我习惯了scrbook
上课,可以处理koma script
一些。但我无法调整章节标题。考虑以下 MWE(使用 LuaLaTeX 并描绘了我的典型诗歌方案)使用我之前要求的设计.:
\documentclass{scrbook}
\usepackage[no-math]{fontspec}
\usepackage{Alegreya}
\usepackage{xcolor}
\usepackage{pgf}
\usepackage{tikz}
\usepackage{blindtext}
\definecolor{themecolor}{RGB}{180, 220, 70}
% Design Chapter
\renewcommand\raggedchapter{\raggedleft}
\setkomafont{chapter}{\Huge}
\setkomafont{chapterprefix}{\large\scshape\rmfamily}
\tikzset{
headings/base/.style = {
outer sep = 5pt,
inner sep = 0pt,
inner xsep = 10pt,
},
headings/chapterbackground/.style = {
headings/base,
font = \strut,% equal height no matter if capitals or 'g', 'p', etc are used or not
},
headings/chapapp/.style = {
headings/base,
text = themecolor,
font = \usekomafont{chapterprefix}
},
headings/chapterline/.style = {
themecolor,
line width = 2pt,
}
}
\makeatletter%
\renewcommand*\chapterlinesformat[3]{%
\ifstr{#1}{chapter}{%
\begin{tikzpicture}[baseline=(title.base)]
\node[headings/chapterbackground](title){%
\parbox[t]
{\dimexpr\textwidth-2\pgfkeysvalueof{/pgf/outer xsep}\relax}%
{\raggedchapter #3}%
};
\node[headings/chapapp,anchor=south east]
at ([xshift=0pt, yshift=-12pt]title.north east){\ifstr{#2}{}{}{\chapapp}\strut};% Positionierung chapterprefix
\useasboundingbox
(current bounding box.north west)
rectangle
([xshift=0pt, yshift=-10pt]current bounding box.south east);%
\draw[headings/chapterline]
(current bounding box.south east)++(0.5\pgflinewidth,0)--+(0,\paperheight);
\end{tikzpicture}
\par
}{%
\@hangfrom{#2}{#3}% other section levels using style=chapter
}%
}
\makeatother
\begin{document}
\chapter{Poems of Love}
\addsec{Title of the poem}
This is the first line\\
and this the second line of a verse.
\bigskip
This is where the common text starts.\\
\blindtext
This is a new block without parskip.
\blindtext
\bigskip
\blindtext
\bigskip
This is the first line\\
and the second of the last verse.
\end{document}
我想要实现的是: Chaptertitle 而不是 chapterprefix Sectiontitle 而不是 chaptertitle 考虑到 MWE,如下所示:
爱情诗(代替“章节”,绿色)
诗歌标题(代替“爱的诗”,黑色)
这是第一行...
但是,我尝试用“section”和“sectionlinesformat”替换“chapter”和“chapterlinesformat”,但不起作用,并给出错误消息。我计划将实际的 chaptertitle 放在一个页面上,并让 chaptertitle 再次出现在每个部分上方。我希望这个带有示例的链接能起作用。
附言:我并不局限于scrbook
。我之所以选择它,是因为我的论文让我对它最了解。我memoir
以前试过上课,但对布局不满意。所以我愿意听取任何建议来简化我的想法,并感谢您的帮助。