1

In this example :

\documentclass{book}

\begin{document}

\chapter{Chapter one}

\chapter{Chapter two}

\chapter{Chapter three}
New font and distance from the text here

\end{document} 

I would like to set a different style for my last chapter title, ie different font and distance from the text. Is it possible to do a \renew command ?

  • you can use all the stuff from titlesec right before that last chapter – A Gold Man Nov 9 '17 at 21:17
  • Yes, this is possible, for example, by redefinition of \@makechapterhead. – user31729 Nov 9 '17 at 21:17
  • I already have the code for that, but it's not working. – alfred Nov 9 '17 at 21:21
1

You can use titlesec for making the changes easier.

\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} 

I used the options to \documentclass just for showing the two chapters side by side, with also the help of shoframe. Instead of Book Antiqua, that I don't own, I use a distinctive font just for showing that the setting is honored.

enter image description here

0

Thanks to Christian Hupfer's suggestion and based on previous answer I got to this solution :

\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} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.