LaTeX to Lulu, the Making of AOSA: Pulling It All Together

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 fourth post in the series.

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

This post is about the LaTeX that pulls the whole book together.

I think I mentioned this before: we used the book document class, which allows chapters and two-sided printing by default. That’s the very first line in our LaTeX file.

\documentclass{book}

Then we include all the packages and set up all the settings and custom environments I’ve been posting about for days, and then finally…

\begin{document}

Whoo hoo!

\frontmatter

The frontmatter command is defined by the book class. It affects numbering, specifically setting the page numbers to Roman in the front matter.

Then we include a file called frontmatter.tex which defines the half-title page, title page, and dedication.

\include{frontmatter}

The tableofcontents command tells LaTeX to (guess what!) generate a table of contents.

\tableofcontents

Then we include the intro file, which is our introduction and list of contributors.

\include{intro}

mainmatter tells it to switch to Arabic numerals, then we include all the chapters.

\mainmatter
\include{distsys}
\include{ffreleng}
\include{freertos}
...
\include{zeromq}

Then we set the style of the bibliography. alpha means the labels for the bibliography entries are based on the the authors’ initials and publication year, so an article by Donald Knuth published in 1986 would be labelled [Knu86].

The bibliography command tells LaTeX which file to use for the bibliography.

\bibliographystyle{alpha}
\bibliography{aosa2}

I copied this next bit from somewhere on the web because I wanted to get rid of the blank page after the bibliography, and honestly I’m not entirely sure how it works. makeatletter makes the @ sign into a letter, for some reason. Then @openrightfalse does the no-blank-page magic, and makeatother returns @ to its rightful status as whatever-it-is.

%% This prevents LaTeX from adding a blank page after the bibliography
\makeatletter
\@openrightfalse
\makeatother

backmatter ends the main matter, and thus the page numbering. Then we include the colophon, and that’s the end!

\backmatter

\include{colophon}

\end{document}

Resources

I literally could not have made this book without the power of Google. (Well, I suppose there are books, but then you wouldn’t be reading our book until 2015.) Some of the sites which popped up again and again were the LaTeX WikiBook, Stack Overflow, StackExchange’s TeX site, and the LaTeX Community. In particular, Stefan Kottwitz furnished so many helpful answers he practically earned a place in the acknowledgments.


Next time I’ll write about some of the tools I used to manage the process of creating the book.

Advertisements

3 Comments on “LaTeX to Lulu, the Making of AOSA: Pulling It All Together”

  1. thiscouldbecomeahabit says:

    This looks useful, and I’d like to try it… but any chance you could upload a template? Creating a template from your text seems a bit more challenging than necessary…

    I’d be glad to put a template on github and share the link here, so things can be simple for everybody!


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 )

Google+ photo

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

Connecting to %s