About these ads

Fancy LaTeX chapter styles

Many books, theses and reports are written in LaTeX using the report or book document classes. Often, the authors make use of the default chapter style. There are, however, a great number of alternative styles available, some of which being very fancy or playful. This post is a collection of alternative chapter styles available, some as packages, others simply in form of LaTeX code.

 

Default chapter style

The default chapter style is often used in (academic) books and theses. Here is an example:

\documentclass{report}
\begin{document}
\chapter{Default Chapter Heading}
\end{document}

 

Package titlesec

The titlesec package allows basic changes to the standard chapter style, including setting the font style and size or placement of the title. You can do great things with titlesec package and the titleformat command in particular, just be creative (and let me know below)!

Here is a neat example:

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{titlesec, blindtext, color}
\definecolor{gray75}{gray}{0.75}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
\begin{document}
\chapter{Less is More}
\blindtext
\end{document}

See the documentation for more details.

 

Package fncychap

The fncychap package has a nice set of predefined chapter styles. The style is set through the optional argument when loading the package. Available styles include: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, and Bjornstrup. The package documentation has examples for all available styles. The package will use the LaTeX default chapter style in case the optional argument is not set (i.e. \usepackage{fncychap}).

\documentclass{report}
%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
\usepackage[Sonny]{fncychap}
\begin{document}
\chapter{Sonny}
\end{document}

Examples of Glenn and Bjornstrup chapter styles provided from the fncychap package:

 

Chapter styles with memoir

The memoir document class is more flexible in terms of chapter styles than report or book.

I will not go into detail since there is extensive documentation on the memoir document class (see page 83 onwards). Furthermore, there is additional documentation describing the memoir chapter styles including code examples and output. Below you’ll find one of the examples taken from that document named hansen.

\documentclass{memoir}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}
\setSingleSpace{1.1}
\SingleSpacing
\usepackage{xcolor,calc, blindtext}
\definecolor{chaptercolor}{gray}{0.8}
% helper macros
\newcommand\numlifter[1]{\raisebox{-2cm}[0pt][0pt]{\smash{#1}}}
\newcommand\numindent{\kern37pt}
\newlength\chaptertitleboxheight
\makechapterstyle{hansen}{
  \renewcommand\printchaptername{\raggedleft}
  \renewcommand\printchapternum{%
    \begingroup%
    \leavevmode%
    \chapnumfont%
    \strut%
    \numlifter{\thechapter}%
    \numindent%
\endgroup%
}
  \renewcommand*{\printchapternonum}{%
    \vphantom{\begingroup%
      \leavevmode%
      \chapnumfont%
      \numlifter{\vphantom{9}}%
      \numindent%
      \endgroup}
    \afterchapternum}
  \setlength\midchapskip{0pt}
  \setlength\beforechapskip{0.5\baselineskip}
  \setlength{\afterchapskip}{3\baselineskip}
  \renewcommand\chapnumfont{%
    \fontsize{4cm}{0cm}%
    \bfseries%
    \sffamily%
    \color{chaptercolor}%
  }
  \renewcommand\chaptitlefont{%
    \normalfont%
    \huge%
    \bfseries%
    \raggedleft%
  }%
  \settototalheight\chaptertitleboxheight{%
    \parbox{\textwidth}{\chaptitlefont \strut bg\\bg\strut}}
  \renewcommand\printchaptertitle[1]{%
    \parbox[t][\chaptertitleboxheight][t]{\textwidth}{%
      %\microtypesetup{protrusion=false}% add this if you use microtype
      \chaptitlefont\strut ##1\strut}%
}}
\chapterstyle{hansen}
\aliaspagestyle{chapter}{empty} % just to save some space
\begin{document}
\chapter{Hansen Memoir Chapter Style}
\blindtext
\end{document}

 

Styling the chapter

Henrik Stuart wrote this article in 2007 with a series of great chapter styles. They are also based on the memoir document class and the PGF/TikZ package. Here is an example that I like a lot, simply beautiful!

\documentclass{memoir}
\usepackage{tikz, blindtext}
\makechapterstyle{box}{
  \renewcommand*{\printchaptername}{}
  \renewcommand*{\chapnumfont}{\normalfont\sffamily\huge\bfseries}
  \renewcommand*{\printchapternum}{
    \flushright
    \begin{tikzpicture}
      \draw[fill,color=black] (0,0) rectangle (2cm,2cm);
      \draw[color=white] (1cm,1cm) node { \chapnumfont\thechapter };
    \end{tikzpicture}
  }
  \renewcommand*{\chaptitlefont}{\normalfont\sffamily\Huge\bfseries}
  \renewcommand*{\printchaptertitle}[1]{\flushright\chaptitlefont##1}
}
\chapterstyle{box}
\begin{document}
\chapter{Fancy chapter with TikZ}
\blindtext
\end{document}

 

A few more resources worth checking out

I found a discussion on tex.SX quite enlightening with lots of rather fancy chapter style examples.

This greatly colored example is another chapter style based on PGF/TikZ and titlesec. You can get the code and screenshots from texblog.net or texample.

 
Did I forget anything? Drop me a comment.

About these ads

24 Responses to “Fancy LaTeX chapter styles”

  • BG

    I really like the “Less is More” style – it’s just what I’ve been looking for. Thanks!

  • Ole J. Forsberg, Ph.D.

    First of all: Tom, thank you for an excellent source of TeX and LaTeX information. I reference it frequently.

    Second: I just wrote an include for making my chapters look good (to me). Here is the code:

    \newcommand*\chapterlabel{}
    \titleformat{\chapter}[block]{
       \gdef\chapterlabel{}
       \normalfont\sffamily\Huge\bfseries\scshape%
       }
       {\gdef\chapterlabel{\thechapter}}{0pt}{%
    % The upper bar
        \begin{tikzpicture}[remember picture, overlay]
            \node[yshift=-2cm] at (current page.north west)
            { \begin{tikzpicture}[remember picture, overlay]
              \draw[fill=chapterbackground] (0,0) rectangle (\evensidemargin+0.2\paperwidth,2cm);
              \end{tikzpicture}
            };
        \end{tikzpicture}
    % The lower bar
        \begin{tikzpicture}[remember picture, overlay]
            \node[yshift=-6.2in] at (current page.north west)
            { \begin{tikzpicture}[remember picture, overlay]
              \draw[fill=chapterbackground] (0,0) rectangle (\paperwidth,2cm);
              \end{tikzpicture}
            };
        \end{tikzpicture}
    % The photograph
        {%
            \flushright
            \setlength\fboxsep{0pt}
            \setlength\fboxrule{0.5pt}
            \fbox{\includegraphics[width=0.8\textwidth]{chapterImages/chapter\thechapter.jpg}}
        }
    % The chapter number
        \begin{tikzpicture}[remember picture, overlay]
        \node[yshift=-6.15in] at (current page.north west)
          { \begin{tikzpicture}[remember picture, overlay]
            \node[above left,
                  anchor=west, 
                  xshift=\evensidemargin,
                  yshift=0.8cm,
                  rectangle,
                  inner sep=10pt,
                  fill=chapterbackground ]
                  {\color{white} Stage \thechapter:};
            \end{tikzpicture}
          };
       \end{tikzpicture}
    % The chapter name
        \begin{tikzpicture}[remember picture, overlay]
        \node[yshift=-6.7in] at (current page.north west)
          { \begin{tikzpicture}[remember picture, overlay]
            \node[above left,
                  anchor=west, 
                  xshift=0.92*(1in + \hoffset + \oddsidemargin),
                  yshift=0.3cm ]
                  {\color{chapterbackground}#1};
            \end{tikzpicture}
          };
       \end{tikzpicture}
    % End titleformat
    }
    \titlespacing*{\chapter}{0.3\textwidth}{-100pt}{50pt}

    I like the effect (others may not). I offer it PD.

    • tom

      Hi Ole,

      Thanks for sharing the code! For others to use it the way you designed it however, you would also have to provide the jpg and some things that got lost from the preamble like which packages you load and the color definition of chapterbackground. If you agree, I will send you an e-mail so you can attach the picture. Or if you have a place to upload it to, just send me the link.

      Looking forward to seeing your chapter style!

      Thanks, Tom.

  • JK

    Wonderful examples. I’m always looking for customisations of these types, of which your blog is full of, to finesse my thesis. Thank you.

    The new chapter definitions however, don’t seem to work on unnumbered chapters (ie. \chapter*{Name of Unnumbered Chapter})
    Any thoughts?
    Cheers,

    • tom

      Please tell me which style you are having problems with and I will look into it. Thanks, Tom.

      • JK

        Initially I have been playing around with your more is less style and the titlesec package.
        Cheers,
        JK

      • tom

        Hi JK,

        I works perfectly for me (see the code below). Please provide a minimal example illustrating the problem.

        \documentclass{report}
        \usepackage[T1]{fontenc}
        \usepackage{titlesec, blindtext, color}
        \definecolor{gray75}{gray}{0.75}
        \newcommand{\hsp}{\hspace{20pt}}
        \titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
        \begin{document}
        \tableofcontents
        \chapter{Less is More}
        \blindtext
        \chapter*{Less is Less}
        \blindtext
        \end{document}

        Best, Tom.

      • JK

        Cheers Tom. The code is working fine for me now too. I must have had something commented out before, else some other random oddity was present.

      • tom

        Great, I’m glad it worked out. Thanks for the feedback! Tom.

  • Nazma

    hi,
    I use latex in linux (ubutu). Please tell me how I use fancychapter. For using the same I am have to download any package. From where I download it and tell me the stps.

    • tom

      Hi Nazma,

      Thanks for your question. You are right, the fancychapter package is not included in the standard TeX distributions. However, you can get the style file here. The easiest way would be to just keep the file in your project folder where your tex-file is located. Apart from loading it, that’s all you need.

      Hope it works.
      Best, Tom.

  • Phil

    Thank you so very much! Been looking all over for this…

  • Prakash

    Thanks for the nice post. This is very helpful. Is there anyway I can give author names and affliations beneath the chapter title?

  • Hassan

    Good work. Thank you for the post. You are doing a great job.

  • Rafik Margaryan (@raffdoc)

    Hi Tom,
    I liked very much the “Less is More” style.
    But it creates a problem for me!
    It eats practically APPENDIX word but after comes appendices with letter: A,B etc.
    How can I fix this?
    Many thanks.

    • tom

      Hi Rafik,

      Thanks for your question. I’m not sure whether I understand your problem. Please provide a minimal working example which I can run on my computer.

      Here is some code that adds the word Chapter and later Appendix to the title. You might find this useful.

      \documentclass{report}
      \usepackage[T1]{fontenc}
      \usepackage{titlesec, blindtext, color}
      \definecolor{gray75}{gray}{0.75}
      \newcommand{\hsp}{\hspace{20pt}}
      \titleformat{\chapter}[hang]{\Huge\bfseries}{\chaptername~\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
      \begin{document}
      \chapter{Less is More}
      \blindtext
      \appendix
      \renewcommand\chaptername{Appendix}
      \chapter{First}
      \blindtext
      \chapter{Second}
      \blindtext
      \end{document}
      • Rafik Margaryan (@raffdoc)

        Thank you very much, indeed!
        But I truly satisfied with the chapter having only number without word “chapter”. I would like only to Have Appendix word before A, B etc appendices !
        Could you help with this?
        Tanks in advance.

      • tom

        Hi Rafik,

        A possible solution is to use the code I provided below with a minor modification, set \chaptername to “empty” for regular chapters. Here is the code:

        \documentclass{report}
        \usepackage[T1]{fontenc}
        \usepackage{titlesec, blindtext, color}
        \definecolor{gray75}{gray}{0.75}
        \newcommand{\hsp}{\hspace{20pt}}
        \renewcommand\chaptername{}
        \titleformat{\chapter}[hang]{\Huge\bfseries}{\chaptername\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
        \begin{document}
        \chapter{Less is More}
        \blindtext
        \appendix
        \renewcommand\chaptername{Appendix~}
        \chapter{First}
        \blindtext
        \chapter{Second}
        \blindtext
        \end{document}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 713 other followers

%d bloggers like this: