我正在制作一本书,遇到了一个我想使用的自定义章节模板,但我不知道如何在 overleaf 中设置它。所以我希望左页的页面颜色为黑色,章节标题的文本为白色。然后右页的页面颜色为白色,章节号为黑色文本,并附有引文。 这些是我的设置:
\documentclass[11pt,twoside,openright]{book}
\usepackage[paperheight=8.5in,paperwidth=5.5in]{geometry}
\geometry{showframe=false}
\geometry{margin=0.5in,bottom=0.70in, top=0.80in, bindingoffset=0.2in}
\usepackage[super,comma]{natbib}
\usepackage{lipsum} % for dummy text
\begin{document}
\chapter{WHAT IS LIFE?}
\begin{quote}
\textit{``Life teaches you a new lesson every day if you are attentive enough in the class of life.''}
\begin{center}
{\textbf{\textit{--- Invajy}}}
\end{center}
\end{quote}
\lipsum[21-40]
\end{document}
答案1
用一个KOMA 脚本scrbook
可以使用选项open=left
在左页开始新章节并重新定义\chapterlinesformat
或 来完成此类课程\chapterlineswithprefixformat
。让我们开始吧:
\documentclass[open=left,chapterprefix,footsepline]{scrbook}% 11pt and twoside are defaults
\usepackage[paperheight=8.5in,paperwidth=5.5in]{geometry}
\geometry{showframe=false}% you could move this to the options of \usepackage above
\geometry{margin=0.5in,bottom=0.70in, top=0.80in, bindingoffset=0.2in}% you could move this to the options of \usepackage above
\usepackage{xcolor}%
\usepackage{lmodern}% you should use as scalable font like this one
\usepackage{lipsum} % for dummy text
\let\MakeMarkcase\MakeUppercase% Use uppercase in page header
\renewcommand*{\chapterlineswithprefixformat}[3]{% redefine output of chapter heading
\pagecolor{black}% use black background
#3% output the title
\clearpage
\nopagecolor% deactivate background
\raggedleft #2% output the number
}
\setkomafont{chapterprefix}{\color{gray!50}\fontsize{64}{72}\selectfont}% color and fontsize of number
\setkomafont{chapter}{\color{white}\fontsize{64}{72}\selectfont}% color and fontsize of title
\renewcommand{\chapterformat}{\thechapter}
\begin{document}
\chapter{WHAT IS LIFE?}
\begin{quote}
\textit{``Life teaches you a new lesson every day if you are attentive enough in the class of life.''}
\begin{center}
{\textbf{\textit{--- Invajy}}}
\end{center}
\end{quote}
\lipsum[21-40]
\end{document}
对于 KOMA-Scrip,我还建议使用 设置引文\setchapterpreamble
。 并将其添加\MakeUppercase
到章节标题的输出中,将自动打印章节标题(如目录标题)并以大写形式显示:
\documentclass[open=left,chapterprefix,footsepline]{scrbook}% 11pt and twoside are defaults
\usepackage[paperheight=8.5in,paperwidth=5.5in]{geometry}
\geometry{showframe=false}% you could move this to the options of \usepackage above
\geometry{margin=0.5in,bottom=0.70in, top=0.80in, bindingoffset=0.2in}% you could move this to the options of \usepackage above
\usepackage{xcolor}%
\usepackage{lmodern}% you should use as scalable font like this one
\usepackage{mwe} % for dummy text
\let\MakeMarkcase\MakeUppercase% Use uppercase in page header
\renewcommand*{\chapterlineswithprefixformat}[3]{% redefine output of chapter heading
\pagecolor{black}% use black background
\MakeUppercase{#3}% output the title with automatic upper case added for titles like CONTENTS
\clearpage
\nopagecolor% deactivate background
\raggedleft #2% output the number
}
\setkomafont{chapterprefix}{\color{gray!50}\fontsize{64}{72}\selectfont}% color and fontsize of number
\setkomafont{chapter}{\color{white}\fontsize{52}{64}\selectfont}% color and fontsize of title
\renewcommand{\chapterformat}{\thechapter}
\begin{document}
\tableofcontents
\setchapterpreamble{%
\begin{quote}
\textit{``Life teaches you a new lesson every day if you are attentive enough in the class of life.''}
\begin{center}
{\textbf{\textit{--- Invajy}}}
\end{center}
\end{quote}
}
\chapter{WHAT IS LIFE?}
\lipsum[21-40]
\blinddocument
\end{document}
额外的更改(例如使用 KOMA-Script 命令\lipsum
或包csquotes
进行引用或在定义\thispagestyle{\chapterpagestyle}
后添加或使用包来延长脚分隔线并更改该线的颜色等)可能会很有用。这主要取决于所需的结果和您自己的品味。\clearpage
\chapterlinesformat
scrlayer-scrpage