LaTeX to Lulu, the Making of AOSA: Other Useful Packages and Settings

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 rounds up some of the packages and settings I haven’t talked about yet.

To tell the truth LaTeX isn’t meant to do this kind of custom typesetting; it was created to do the work of laying out a document for you so you could concentrate on the content. All this rearranging and customising and fiddling with layout is beside the point, which is why you have to include packages to design each different aspect of your document.

The epstopdf package converts EPS images to PDF when you run LaTeX. We used this more in the first book; for some reason the authors for the second book submitted mostly PNG and PDF images, not EPSs.

\usepackage{epstopdf}

I needed a package which would display URLs nicely, break them at the ends of lines properly, and ideally have them be clickable in the final PDF.

\usepackage[hyphens]{url} % this package doesn't make proper clickable
                          % links, but
% \usepackage{hyperref} % this package breaks the build.

I tried both the url and the hyperref packages, and while the hyperref package promised to do what I wanted, it stopped the book from compiling properly. The url package did everything I wanted except make clickable links, so I left it in and commented out the other, thinking I would come back and figure it out later. Ha.

The microtype package provides the ability to micromanage your typography. When invoked without any options it does some nice things like protruding punctuation over the edge of the right margin to make the margin appear smoother. Basically it makes your book look more professional with very little effort. It also has a ton of options if you want to micromanage even more.

\usepackage{microtype}

The amssymb package allows use of some math symbols.

\usepackage{amssymb}

The sectsty package allowed me to change the font of the section headers.

\usepackage{sectsty}

The mathtools package allowed one of our authors to display a matrix. This is one of several packages which were only used in one place in the book.

\usepackage{mathtools} % for bmatrix in matplotlib

enumitem is the package that allowed me to set all the spacing options in our custom list environments.

\usepackage{enumitem}  % to manage spacing in and around lists

The multicol package is another we only used once; we thank a long list of reviewers in the introduction, and I wanted to format the list without using a table. Using a table would mean I’d have to decide where to break the columns (and possibly change it every time we added a name), whereas with multicol LaTeX does the work of flowing the names evenly into three columns.

\usepackage{multicol} % to break the list of reviewers into columns

Then I just called it like this:

\begin{multicols}{3}
list \\
of \\
names...
\end{multicols}

You probably know that widows and orphans are single lines separated over a page break from the rest of their paragraph. They make text harder to read, so LaTeX will get rid of them for you if you set a high enough penalty.

% introduce penalty for widows and orphans (can increase to 10 000, although
% not recommended)
% upped the widow/orphan penalty to 600 from 300; seems to have removed
% all widows and orphans -- ARB Mar 30 2012
\widowpenalty=600
\clubpenalty=600

LaTeX does hyphenation for you, and it generally does a pretty good job, but sometimes you have to tell it about unusual words. The hyphenate command takes a list of words with accepted hyphenation. I ended up only passing it one word.

% list of hard-to-hyphenate words with correct possible hyphenation-points
\hyphenation{Free-RTOS}

By dafault, LaTeX will try and make all your pages the length that you set using the geometry setting. If a page has images, tables, headings or paragraph breaks which make it shorter than that page length, LaTeX will pad the page by adding whitespace between elements. We thought that looked sillier than having pages be different lengths, so we used the raggedbottom command.

\raggedbottom

Next time I will talk about the LaTeX which actually generates the book, and about some of the resources I used to find all this myself.

Advertisements


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