6

I’m using the book style in LaTeX. I want my chapter headings to look like this:

      1
 Great Chapter

It should be in the sans-serif and bold font, centered, and I want to be able to customize the spacing before and after the heading, and also customize the spacing between the “1” and the “Great Chapter.” How can I do this in LaTeX?

1
  • Which document class do you use? Please provide a minimal example. Mar 14, 2012 at 18:55

1 Answer 1

9

The titlesec package can facilitate all of this.

enter image description here

From the titlesec package

 \titlespacing{command}{left spacing}{before spacing}{after spacing}[right]

How to read {12pt plus 4pt minus 2pt}

  • 12pt is what we would like the spacing to be
  • plus 4pt means that TeX can stretch it by at most 4pt
  • minus 2pt means that TeX can shrink it by at most 2pt

This is one example of the concept of, 'glue', in TeX; it may seem strange to use the word 'glue' for a stretchable space, but to quote Knuth (The TeXbook)

But whenever the author has suggested changing TeX's terminology, numerous people have said that they like the word "glue" in spite of its inappropriateness; so the original name has stuck.

\documentclass{book}
\usepackage{lipsum}
\usepackage[explicit]{titlesec}

% custom chapter
\titleformat{\chapter}[display]
{\filcenter\LARGE\bfseries\sffamily}
{\thechapter\\[2cm]% spacing between number and Great chapter
#1}
{1pc}
{\Huge}
% From the titlesec package
% \titlespacing{command}{left spacing}{before spacing}{after spacing}[right]
% spacing: how to read {12pt plus 4pt minus 2pt}
%           12pt is what we would like the spacing to be
%           plus 4pt means that TeX can stretch it by at most 4pt
%           minus 2pt means that TeX can shrink it by at most 2pt
%       This is one example of the concept of, 'glue', in TeX
\titlespacing{\chapter}{0pt}{*4}{-0.1cm}
\begin{document}

\chapter{Great chapter}
\lipsum
\end{document}
4
  • Thanks. However, can you please tell me how I replace the pre-defined sizes (\Large, \LARGE, \huge, \HUGE) with a command where I can specify the font size exactly?
    – Enchilada
    Mar 15, 2012 at 21:53
  • Or rather, how would I get the size that is, say, halfway between \huge and \Huge?
    – Enchilada
    Mar 15, 2012 at 22:18
  • @Enchilada I think that's a separate question :) What do you mean by 'specify the font size exactly'?
    – cmhughes
    Mar 15, 2012 at 23:54
  • Yeah, you’re right. I’ve put it in a separate question: tex.stackexchange.com/questions/48208/…
    – Enchilada
    Mar 16, 2012 at 1:25

You must log in to answer this question.

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