[Tex/LaTex] How to change the font when using fncychap

fncychapfontssectioning

I am using fncychap and would like to use a different font for the chapter label than the rest of the document. Is there any easy and general way?

Best Answer

The exact configuration depends on the fncychap style you’re using, but in general, there are a few macros for adapting the style, as described in section 2.1 of the fncychap documentation. The ones for changing the font etc. are \ChNameVar{stuff}, \ChNumVar{stuff} and \ChTitleVar{stuff}. Here’s an example for the style Sonny using pdfLaTeX:

\documentclass[12pt]{report}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\usepackage[Sonny]{fncychap}
  % defaults:
  %\ChNameVar{\Large\sf}
  %\ChNumVar{\Huge}
  %\ChTitleVar{\Large\sf}
  % custom:
  \ChNameVar{\Large\fontfamily{put}\selectfont\color{blue}}
  \ChNumVar{\Huge\fontfamily{pzc}\selectfont\color{red}}
  \ChTitleVar{\Large\fontfamily{phv}\selectfont\scshape\color{green}}
\begin{document}
\chapter{Hello World!}
Foo bar baz
\end{document}

output

For some more details on how to change the font and also how to do it with XeLaTeX, LuaLaTeX, or ConTeXt, see How do I use a particular font for a small section of text in my document?.

Also note that in some fncychap styles, variables influence the following variables; e.g. in my example, “Hello World!” and the rules would be red if I hadn’t specified their color. I’m not sure if that’s a bug or intended behavior.