133

I'm searching for nice predefined chapter headings. I've found the fncychap package, and seen that memoir has quite a few, too.

Do you know other packages that provide predefined fancy chapter styles?

3
  • 2
    titlesec has some good examples
    – egreg
    Commented Jul 19, 2011 at 11:18
  • 4
    Wouldn't it be nice if people here published their code for fancy chapters and sections?
    – Keks Dose
    Commented Jul 19, 2011 at 11:24
  • 1
    Although this is not included as a standalone package, Vincent Zoonekynd's LaTeX website has some nice examples of section and chapter headings, complete with the code that generates them.
    – Werner
    Commented Jul 19, 2011 at 14:12

3 Answers 3

229
+700

Although the memoir class, fancychap, titlesec and others have some predefined chapter styles, I understand your search for something better.

There are two issues to consider here:

  1. The limitations of the original LaTeX structure and commands and,
  2. The typographical requirements for such an endeavour.

One of the difficulties in the redefinition of chapters, is the different mechanisms provided by the various packages as well as by LaTeX. To complicate matters further the code in the book.cls is spread in at least four chunks.

An approach to overcome the limitations and provide some more general and well abstracted routines to define a key-value approach similar to those provided by PGF keys. I have done some work in this respect sometimes back and a typical setting would be:

\cxset{
 name=\so{CHAPTER},
 numbering=arabic,
 number font-size=\large,
 number before={},
 number position=rightname,
 chapter color={black!80},
 chapter font-size=\large,
 chapter before=\rule[3pt]{\textwidth}{0.4pt}\par\hfill,
 number after=,
 chapter after=\hfill\hfill\par\rule[6pt]{\textwidth}{0.4pt}\par,
 number color=\color{black!80},
 title font-family=\bfseries,
 title font-color=\color{black!80},
 title font-weight=,
 title font-size=\LARGE,
 title beforeskip=\hfill\par\hspace*{0pt},
 header style=empty
}

Although the keys and the code might at first glance seem overwhelming it can be greatly simplified by the use of styles. So once a set of keys has been defined it can be stored in a .style command. Another advantage of this method is that community settings can easily be incorporated by the use of libraries. This is important for TikZ based designs, where the shapes and complexity cannot be abstracted easily if at all.

This brings us to the second part of the issues associated with chapter re-definitions: typography. The chapter look and feel must blend with the rest of the design. Consider for example the following two images:

enter image description hereenter image description here

It is no good only having definitions for chapters. The style should extend to exercises, tables, sections table of contents and the like. A similar method to using a key-value approach might make this task easier and share the styling among the community. Originally I experimented with .ini files and LuaLaTeX for loading them. However, the key value approach is better and more familiar to the community.

I have collected over 50 styles from different books and I have the basic code ready for experimentation (only for chapters).

And now the coding part. First we define keys for all major elements:

\def\cxset{\pgfqkeys{/chapter}}
\cxset{%
  name/.code={\gdef\chaptername{#1}},
  chapter font-family/.store in=\chapterfontfamily@cx,
  ...
}

As we want to use the basic LaTeX structure and conventions, we redefine the \@makechapterhead to handle the keys. Remember that there are two commands used by LaTeX to typeset chapter heads. The one is used for the unstarred version of the command, while the other one is for the starred version. The starred version of the command in our approach is unnecessary as we can define a key instruct the typesetting engine to ignore the numbering (numbering=none) and hence we redirect both the starred as well as the unstarred version to the same macro.

 \renewcommand\@makechapterhead[2][]{%
   ...
   \titlebeforeskip@cx%
   \if@lefttitle%
     \beforenumber@cx%
     \counterdisplay\c@chapter\afternumber@cx%
   \fi
   ...
  }

The macro contains the typesetting algorithm and hooks into the various keys. To typeset a chapter head the simplest approach is to define a set of keys as styles. For example we can use:

   \cxset{manet/.style={
   name={},
   numbering=none,
   ...
   }

to define the style "manet". The chapter is then typeset as:

  \cxset{manet}
  \chapter{EDOUARD MANET}
  \begin{multicols}{3}
    \leftskip0pt
    \lettrine{I}{psum dolor} sit amet latixeus. \lipsum*[1-2]
    Latinicus porcupinus to fill the line.
  \end{multicols}

Giving us the following result:

enter image description hereenter image description here

With slight variations, we can inherit the style and get the "cardinal on a vespa chapter":

   \cxset{manet}
   \topimage{<image file>}
   \chapter{ALAN MacDONALD}

Additional keys can be defined if necessary to cater for all fields.

Chapters made out of only textual components are easier to define. You just set the style number.

   \cxset{style7}
   \chapter{Introduction to Style Seven}
   ...
   \cxset{style12}
   \chapter{Introduction to Style Twelve}
   ...

enter image description hereenter image description here

Special chapter openings need a different treatment and are best described as environments, as they tend to have many textual components as well as images:

  \begin{specialchapter}[
     image=genetics-dogs,%chromosomes
     image caption={Labrador retriever\\
      ...
     by two gene pairs.}]%
    {Extensions\\ of Mendelian\\ Genetics}
    \begin{itemize}
     ...
    \end{itemize}
  \end{specialchapter}

enter image description hereenter image description here

The second image above had only the image key changed, just to illustrate the technique. As a point of interest the images were placed with traditional boxing techniques rather than using tikZ or picture commands. The shading was achieved by stretching a "shadow" image file, pretty much like it was used on the web in the pre-html5 days.

The technique has proved useful, easy to define and although the documentation still needs to be developed and the code needs a good clean-up and a few must-do; in the meantime you can download the image samples (used in the documentation), the chapterx package file, the documentation tex file and the documentation pdf file.

Please ping me at chat, if you have any other interesting designs that we can add to the collection.

24
  • 4
    The link given to BOTH the package chaptersx and documentation is dead: docs.google.com/…
    – Paulo Ney
    Commented Apr 17, 2013 at 11:15
  • 4
    @ADP I have extended it quite a bit since I first wrote the above, it is still not production ready but you can have a peek at github.com/yannisl/phd/blob/master/phd.dtx
    – yannisl
    Commented Jun 18, 2013 at 18:51
  • 2
    @YannisLazarides Is there any chance to get these onto CTAN so that we can include it in TeX Live. You might open a git project so that others can contribute or help fix things. I generally have the impression that opening these kind of things helps development. And inclusion in TeX Live would help, too, I guess. Thanks for your consideration.
    – norbert
    Commented Mar 26, 2014 at 5:42
  • 2
    Your googleCode links expired, can you edit the github links in there?
    – Johannes_B
    Commented May 9, 2015 at 12:40
  • 2
    @YiannisLazarides has there new regarding a publication on CTAN?
    – raphink
    Commented Jul 23, 2015 at 11:18
59

You could use titlesec together with TikZ. Here's an example which you could modify in color and shape:

\documentclass[svgnames]{report}
\usepackage{tikz}
\usepackage{kpfonts}
\usepackage[explicit]{titlesec}
\newcommand*\chapterlabel{}
\titleformat{\chapter}
  {\gdef\chapterlabel{}
   \normalfont\sffamily\Huge\bfseries\scshape}
  {\gdef\chapterlabel{\thechapter\ }}{0pt}
  {\begin{tikzpicture}[remember picture,overlay]
    \node[yshift=-3cm] at (current page.north west)
      {\begin{tikzpicture}[remember picture, overlay]
        \draw[fill=LightSkyBlue] (0,0) rectangle
          (\paperwidth,3cm);
        \node[anchor=east,xshift=.9\paperwidth,rectangle,
              rounded corners=20pt,inner sep=11pt,
              fill=MidnightBlue]
              {\color{white}\chapterlabel#1};
       \end{tikzpicture}
      };
   \end{tikzpicture}
  }
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}

\begin{document}
\tableofcontents
\chapter{Introduction}
Text
\chapter{Main}
\section{Section}
Text
\begin{thebibliography}{99}
\bibitem{Test} test reference
\end{thebibliography}
\end{document}

fancy chapter heading example

Source: TeXblog.

5
  • 1
    This is a good example indeed, but I'm more searching for a list of packages that provide built-in styles.
    – raphink
    Commented Jul 22, 2011 at 9:27
  • 1
    I have had similar thoughts, but as one of the gurus here once told me, there can never be two persons with the same identical liking and thus what you are looking for may be unique to your demands. I have found that it is always a good idea to start with what you really want and then move on from there.
    – azetina
    Commented Apr 2, 2012 at 21:30
  • 1
    Just for the sake of being as exhaustive as possible since this thread sure is among top search results: Some more examples can be found in my blog, see web.slzm.de/blog/latex/schone-kapiteltitelseiten-in-latex
    – Johannes
    Commented Apr 8, 2012 at 9:15
  • how can i change the counter to start from right to left for example : Chapter 1. thanks
    – Educ
    Commented Apr 8, 2015 at 14:04
  • 1
    @Johannes, your blog link from this post is now inactive. Commented Aug 25, 2019 at 17:59
-10

How about more simple solution which evades the usage complicated tikz codes? Well, it is no TeXer masterclass, however if you want save your time, try this workaround:

  1. Draw your fancy page in Microsoft Word for example, and save file as PDF, JPG or PNG.
  2. Insert it as picture in your TeX-doc. For a4paper, the code will be...

\cleardoublepage \pagestyle{empty}

{\centering\includegraphics[width=210mm,height=297mm,trim=+5mm 0 0 +5mm]{test.pdf}}
\addcontentsline{toc}{part}{Part 1 TestPart}

\newpage
\pagestyle{plain}

enter image description here

As you see, I did't use the \part{...} directly. As defafault, the 'part' counter has not got influence on section and lower levels in article class, so when you add this part to TOC, do not forget to assign the number maually.

7
  • 1
    And then you change a section's title or number, and you need to redraw your entire picture :). I am not saying this is a bad solution, just that it should only apply to parts, preferably where there is no description of the internal subdivisions.
    – ienissei
    Commented Sep 1, 2014 at 10:09
  • I agree what you say is not convenient. To minimize time lost, 1) save your source files, and if necessary just edit the part or chapter number. 2) make this fancy titles typesetting process already complete and you need just to put in order your publication. Commented Sep 1, 2014 at 11:36
  • 5
    Down-voting because the answer requires manual maintenance, as @ienissei noted. Commented Sep 2, 2015 at 17:18
  • 2
    not many people here would use word if they can avoid it
    – nilon
    Commented Dec 21, 2016 at 13:45
  • As you said. Word was just for example, but you can use any other soft for the flying title creating, as Photoshop or similar free soft. Commented Dec 22, 2016 at 4:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .