Sunday, 6 March 2011

Packing in the text

I write many documents in LaTeX, and it is great for things like bibliographies, cross-referencing, and defining styles. But the default styles, such as 'article', are a bit wasteful of space. For example
\documentclass[a4paper]{article}
\title{Your Title Here}
\date{}

\begin{document}
\maketitle
\begin{abstract}
Lorem ipsum ...
\end{abstract}
\section*{Introduction}
...
\end{document}
gives the page shown on the right.

This is particularly a problem if you are preparing a document with strict page limits, such as a research proposal or a conference paper. Those places often put their own style requirements. Some provide a LaTeX style file, which is fine (provide the style actually works!), but others are a little less helpful.

Here is a typical requirement:
Font size 11 is the minimum font that is acceptable, and the minimum margin in all directions is 2cm. For accessibility purposes, a sans-serif font style such as Arial or Helvetica should be used as these are more easily readable to those with visual impairment. For the same reason, type should be justified only on the left hand side.
How do we get LaTeX to meet these requirements? Well, there are a few useful packages. 'geometry.sty' lets the margins be easily set. So we can get a conformant document with:
\documentclass[a4paper,11pt]{article} % 11pt font
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry} %min margins

\renewcommand{\sfdefault}{cmss} % sans serif
\renewcommand{\familydefault}{\sfdefault} % for whole doc

\raggedright % left justified
\parindent 1em % because \raggedright stops indenting

\begin{document}
...as above
\end{document}

Not only is it conformant, it also has more text on it than the plain `article' version. But we can do better. One reason the article style is so fascistic about its left and right margins (try to get more text by dropping a point size, and it reduces the line length!) is that very long lines are hard to read: you lose your place as you track back at the end of a line. A "11pt text, 2cm margin" format results in lines too long to read comfortably. So let's do what the newspapers do, and go to multi (here, two) columns. This actually saves space, as short section titles no longer take up a whole full width line.

Also, let's take the title and abstract into the main body, and tighten up the space around section headings using the 'titlesec.sty' package. Finally, use some 'negative leading' to get the lines a little closer together (without looking cramped), and we get:
\documentclass[a4paper,twocolumn,11pt]{article}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}

\renewcommand{\sfdefault}{cmss}
\renewcommand{\familydefault}{\sfdefault}
\raggedright
\parindent 1em

\usepackage[small,compact]{titlesec} % section headings in smaller font size, less whitespace
\renewcommand{\baselinestretch}{0.9} % closer lines
\begin{document}
\section*{\Large Your Title Here}
\section*{Executive summary}
Lorem ipsum ...
\section*{Introduction}
...
\end{document}
The result has about twice as much text as the original 'article' style, and is fully conformant to the stated requirements.

The 'titlesec' package also allows some fancier formatting of section headers (for example, when things get a little squashed, I like to put a rule over major section titles, to aid the eye), but that's another story.

No comments:

Post a Comment