在此示例中:
\documentclass{book}
\begin{document}
\chapter{Chapter one}
\chapter{Chapter two}
\chapter{Chapter three}
New font and distance from the text here
\end{document}
我想为我的最后一章标题设置不同的样式,即不同的字体和与文本的距离。可以执行命令吗\renew
?
答案1
您可以使用titlesec
它来更轻松地进行更改。
\documentclass[
openany,% for the picture
oneside,% for the picture
]{book}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{showframe} % for the picture
\newfontfamily{\cambria}{Cambria}
\newfontfamily{\antiqua}{Futura}[ % use Book Antiqua, I don't have it
NFSSFamily=antiqua,
]
\newcommand{\specialchapters}{%
\titleformat{\chapter}[display]
{\normalfont\cambria\huge\bfseries}
{\chaptertitlename\ \thechapter}
{20pt}
{\Huge}%
\titlespacing*{\chapter}{0pt}{50pt}{10pt}%
\renewcommand{\familydefault}{antiqua}%
\normalfont
}
\begin{document}
\chapter{Chapter one}
Distance from the text
\specialchapters
\chapter{Chapter two}
New font and distance from the text here
\end{document}
我使用选项\documentclass
只是为了并排显示两个章节,同时借助shoframe
。我没有使用 Book Antiqua(我不拥有它),而是使用了一种独特的字体,只是为了显示对设置的尊重。
答案2
感谢 Christian Hupfer 的建议,并根据之前的回答,我得到了这个解决方案:
\documentclass{book}
\usepackage{fontspec}
\begin{document}
\chapter{Chapter one}
\chapter{Chapter two}
\makeatletter
\renewcommand*{\@makechapterhead}[1]{
\vspace*{50\p@}
{%
\parindent \z@ \raggedright
\setmainfont{Cambria} % <- change 'Chapter 3' font here
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\large \normalfont \@chapapp \space \thechapter \par
\nobreak \vskip 2\p@
\setmainfont{Book Antiqua} % <- change title font here
\fi
\fi
\interlinepenalty \@M \fontsize{34}{38}\selectfont \normalfont #1\par
\nobreak \vskip 40\p@ % <- change vertical distance from text here
}}
\makeatother
\chapter{Chapter three}
New font and distance from the text
\end{document}