# LaTeX to Lulu, the Making of AOSA: Fonts and Captions

The two volumes of The Architecture of Open Source Applications were typeset with LaTeX and printed through Lulu. I couldn’t have finished the AOSA books without the generosity of people all over the world who posted their LaTeX tips to forums and blogs. This series of posts pays some of that back by sharing what I learned.

This is the second post in the series.

#### LaTeX to Lulu

Today’s post is about specifying fonts and captions.

#### Fonts

Here are our fonts. The `fontenc` package allows you to specify the font encoding, and the `T1` option specifies the T1 encoding, which lets you use fonts with more characters.

```\usepackage[T1]{fontenc}
\usepackage{tgtermes}    % body font
\usepackage{inconsolata} % fixed width font
\usepackage{tgheros}     % sans-serif font```

I used the LaTeX Font Catalogue to find the fonts for the book. One of our requirements was that the fonts be open source, or at least free, so that eliminated the vast majority of the fonts out there.

The body font is TeX Gyre Termes and the sans-serif, which I used for headings and the footer, is TeX Gyre Heros. The code font is Inconsolata.

I’ve read a lot about choosing typefaces, and I know more than I used to, but I confess I still mostly do it by trial and error and what “looks good”. There’s a chance that I’ll look at these books in five years and wonder what on earth made me choose these typefaces, but for now I’m very happy with the way the books look.

#### Captions and Other Text Tweaks

I made a few changes to LaTeX’s default behaviour in terms of typefaces.

The default in LaTeX is for caption copy to be the same size as the body text. We used the `caption` package to make it smaller, which helps differentiate long captions from the surrounding text.

`\usepackage[small]{caption}  % make caption text size smaller`

I also found there was too much space above and below captions by default, so I used `setlength` to tighten it up a little:

```%% Make the space above and below captions smaller
\setlength{\abovecaptionskip}{1.2ex}
\setlength{\belowcaptionskip}{-1.5ex}```

I made section headers sans-serif because I wanted them to stand out, and for our sans-serif font to do a little more work.

```% set all section headers to be sans-serif
\allsectionsfont{\normalfont\sffamily}```

The monospaced font we used, Inconsolata, is a little larger than Termes at the same point size, so I set it a little smaller to look more graceful.

```% make all verbatim (code blocks) text smaller, just because it was bugging me
\let\oldverbatim\verbatim
\renewcommand\verbatim{\small\oldverbatim}```

### 4 Comments on “LaTeX to Lulu, the Making of AOSA: Fonts and Captions”

1. […] Fonts and Captions […]

2. k says:

Hi, thanks for putting up these posts on the process, I’ve been considering printing something with Lulu myself, so it’s very nice to see what you did and actually compare it with a book I have :-)

btw, I think in my print, ligatures (ff, fi) were messed up in the ToC and headings (e.g. “snowflock” looks like “snow ock”). Fortunately not in the actual paragraphs though.

• amyrhoda says:

Hi K; thanks for commenting.

We actually had that problem with ligatures in headers with the last volume, too. It only seems to show up in prints in Europe. The problem is that Lulu uses local printers, so if you order from Norway your book will be printed somewhere in Europe, and for some reason the European printers don’t like the ligatures in the font we used for headers — even though we embedded all the fonts. I’m not sure why it would be different, but printing is mysterious stuff.

Unfortunately, Lulu won’t follow up on this problem unless a customer (that’s you) reports it; they won’t take my word for it. So if you (or anyone else who has this problem) could report it to Lulu here that would be terrific.

• k says:

Oh, wow. *reporting*