LaTeX to Lulu, the Making of AOSA: Geometry, and Headers and Footers

The two volumes of The Architecture of Open Source Applications were typeset with LaTeX and printed through Lulu. If you’re publishing through Lulu or another self-publisher and you want to create a polished book without spending the earth on a desktop publishing package, LaTeX is a good choice. It provides a professional result and it’s infinitely customizable — if you have the patience to put it together and the resourcefulness to figure out how. 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.

LaTeX to Lulu

  1. Headers and Footers
  2. Fonts and Captions
  3. Table of Contents and Chapter Title Pages
  4. Custom Commands and Environments
  5. Other Useful Packages and Settings
  6. Pulling It All Together

Today’s post is about specifying the size of the book, and the headers and footers.

First, we used the book document class, which allows chapters and two-sided printing by default.


Book Size and Margins

We used the geometry package to define the size of the book, and the margins.


The includefoot option tells LaTeX that the footer should come within the textblock (that is, the footer isn’t in the bottom margin). There’s an includehead option, but we didn’t have a running header.

Later in the preamble we define the size of the book:

% define page size and margins etc
vmargin=1.9cm, % top and bottom margins
inner=1.9cm, % inside margin
outer=2.29cm, % outside margin
bindingoffset=0.89cm % gutter

Lulu has a whole host of book sizes, but geometry makes this one of the easiest parts of the layout job. We used Lulu’s Crown Quarto size, and I set the margins to exactly match the MS Word template that Lulu provides.

I realized later that I didn’t need to stick so closely to that template, but those settings kept me safely within the extended distribution requirements, which are the requirements your book must meet to be distributed on Amazon.

Setting Up Headers and Footers

The fancyhdr package gives you control over the style of your footers and headers.

\usepackage{fancyhdr} % to format headers/footers

Setting pagestyle to fancy tells LaTeX you want to use fancyhdr.


Here’s a tricky bit, and I confess some of this I don’t really understand myself — I copied it from the Internet and hoped for the best.

%% fiddle with chaptermark so we can make it not all caps

I’m not sure why those two lines make footers not all caps, but that’s what the Internet said and it seemed to work.

Here I’m just defining the header and footer to be empty, and getting rid of the line that LaTeX puts under the header:

%% next get rid of existing header and footer and header rule

Now that we’ve got a blank slate, here’s where we define the footer:

% now make the footer the way we want it:
% page number on right side of footer for odd pages
\rfoot[]{\small{\textsf{\chapterauthor \hspace{0.25cm} \thepage}}}
\fancyhfoffset[EL]{0cm} % this looks like it doesn't do anything, but
                        % it seems to remind it to line up headers with the
                        % rest of the text

% page number and chapter name on left side of footer for even pages
\lfoot[\small{\textsf{\thepage \hspace{0.25cm} \leftmark}}]{}

We have the page number and chapter name on the left pages, and the author name and page number on the right, in sans-serif font. Why? I thought it looked nice.


We didn’t do much with footnotes — the default way LaTeX handles them worked for us. We did change one thing: LaTeX treats footnotes as a paragraph and indents the first line, but since many of our footnotes are simply URls, they are less than one line long and it looked weird to have them indented. So I used the footmisc package:

\usepackage[hang,flushmargin]{footmisc}  % To not indent footnotes

The footmisc package provides an assortment of ways to style footnotes. The hang option sets the footnote flush with the margin rather than indenting it.

The flushmargin option places the footnote marker; the documentation says it “sets the footnote marker flush with, but just inside the margin from, the text of the footnote”. I’m not exactly sure what that means, but I like the way our footnotes look so I left it.

Next time: Fonts and Captions.


Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s