4

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?

1
  • Please provide some more information about your computing setup. E.g., do you use pdf(la)tex, xe(la)tex, or lua(la)tex -- or something else? Which documentclass do you use? And, which fonts are you currently using and/or looking to use for the chapter headings? – Mico Jan 8 '13 at 20:39
3

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.

1
  • the downside is on other styles it change position of title to left – Woeitg Aug 28 '16 at 11:56

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.