Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Chapter 6: Layouts and fonts

Section 6.1: Changing layout

The design of the page can be a very subjective matter, and also a rather subtle one. Many organisations large and small pay considerable sums to designers to come up with page layouts to suit their purposes. Styles in page layouts change with the years, as do fashions in everything else, so what may have looked attractive in 1978 or 1991 may look rather dated in 2020.

As with most aspects of typography, making the document readable involves making it consistent, so the reader is not interrupted or distracted too much by apparently random changes in margins, widths, or placement of objects. However, there are a number of different occasions where the layout usually does change, related to the frequency with which the format appears.

  • In books, the title page, the half-title, copyright and legal pages, dedication, acknowledgements, and other one-page preliminaries (if you use them) are usually designed individually, as the information on them only occurs once in that format anywhere in the document.

  • The Table of Contents and related lists like the List of Figures and List of Tables all need to share one design.

  • Longer prelims like a Foreword, Introduction, or Preface should likewise follow the same format between them.

  • Chapter and Appendix start pages always share a layout.

  • Other (normal) pages have a single layout, but within the page there will be individual variations to handle tables, lists, figures, sidebars, exercises, footnotes, etc.

The exceptions to this are newspapers and magazines, where page layout is done individually, page by page (or pairs of facing pages together), but even here, most publications have strict rules about what blocks of material can be placed where, and use a carefully-designed set of templates to achieve this.

If you are going to design a whole document yourself, it’s probably a good idea to read a couple of books on layout design first, to get a feel for the conventions which contribute to making the reader comfortable reading.

While unusual or radical layouts have an important role in attention-grabbing, or in making a socio-political statement (WIRED magazine is an obvious example), they are usually out of place in business reports, white papers, books, theses, and journals. In ephemera, on the other hand, as in advertising, they are probably critical.

6.1.1 Margins and spacing

We mentioned in § 5.2 and elsewhere the existence of the geometry package which lets you change margins. It also lets you set the text-area height and width and a lot of other layout settings: read the documentation for details (see § 3.1.3 for how to read package documentation). Here is an example:

\usepackage[a4paper,left=2cm,top=1cm,bottom=2cm,
  right=3cm,nohead,nofoot]{geometry}
        

Figure 6.1: Effect of changing margins on the same text

vnarrow.png narrow.png 

Bear in mind when using the geometry package that you only need to specify some of either the margins or the text height/width. Once it knows the paper size, if you give it the text width and the left-hand margin, for example, it can work out the right-hand margin. The package also provides the \newgeometry command, which lets you reset the margin settings in mid-document. This probably isn’t something you want to do very often, though.

The spacing around the individual textual components (paragraphs, lists, footnotes, tables, figures, etc) can also be changed on a document-wide basis, as we saw with paragraph spacing and indentation in the para ‘This will set the space between …’ in § 2.7. There are a lot of packages available to do various aspects of this, far too many to go into detail here: search CTAN to find what you need.

Changing the spacing of section headings for the whole document can be done with the sectsty or section packages, designed to let you adjust section-head spacing without having to know about the internal LATEX coding, which is quite complex.

The spacing for lists can be adjusted with the enumitem package. In both cases the user with highly specific requirements such as a publisher’s Compositor’s Specification should read the relevant sections in the The LATEX Companion or ask for expert help, as there are many extra settings which can also be changed to fine-tune your design, but which need some understanding of LATEX’s internals.

All the above are for automating changes so that they occur every time in a consistent manner. You can also make manual changes:

Flexible vertical space

There are three commands \smallskip, \medskip, and \bigskip. These output flexible (dynamic, or ‘rubber’) space, approximately 3pt, 6pt, and 12pt high respectively, so they will automatically compress or expand a little, depending on the demands of the rest of the page (for example to allow one extra line to fit, or a heading to be moved to the next page without anyone except a typographer noticing the change). These commands can only be used after a paragraph break (a blank line or the command \par).

Fixed vertical space

For a fixed-height space which will not stretch or shrink, use the command \vspace followed by a length in curly braces, eg \vspace{18pt} (again, this has to be after a paragraph break). Bear in mind that extra space which ends up at a page-break when the document is formatted will get discarded entirely to make the bottom and top lines fall in the correct places. To force a vertical space to remain and be taken into account even after a page break (very rare), use the starred variant, eg \vspace*{19pt}.

Double line-spacing

LATEX’s \baselinestretch value governs the amount of extra line-spacing based on the current font size (see § 6.2.7). By default it is null, meaning no extra space. It is possible to set it to a multiplier, like \renewcommand{\baselinestretch}{1.75} to make it 1.75 times normal. However...

Double-spacing normal lines of text is usually A Bad Idea, as it looks very ugly, but increased line-spacing does become important if you are typesetting very wide lines, otherwise the reader’s eye will not be able to pick up the start of a new line easily.

Double-spacing is still a requirement in many universities for thesis submission, partly because of the tendency of writers to use very wide lines on office-type paper sizes, and partly because the reviewers needed space to write in corrections. With the growth of electronic submission and editorial corrections in PDF files, it should become less necessary. Nowadays, 1⅓ or 1½ line spacing is considered acceptable, according to your font size.

Use the setspace package to do this. It has commands \doublespacing for double line-spacing and \onehalfspacing for one-and-a-half line spacing (the command \singlespacing resets them). There is also a spacing environment to let you specify a different multiple as the argument:

\begin{spacing}{1.333}
...
\end{spacing}
	      

Be aware that you may not want footnotes to be spaced by the same multiple as your normal text, and you may want other elements like lists, tables, figures, or quotations spaced differently.

As with theses, there are some perfectly genuine and normal reasons for wanting bigger line spacing, for example when typesetting a proof of a critical or variorum edition, where editors and contributors are going to want to add notes manually, or where the text is going to be overprinted by something else like Braille, or in advertising or display text for special effects.

Horizontal space

There is a horizontal equivalent to the \vspace command which works in the same way, so \hspace{1in} will insert a 1″ space like this\hspace*{1in}in mid-paragraph. There are also some predefined (shorter) spaces available:

  • \thinspace (⅙em), which we saw between single and double quotes in the last para ‘When typing one quotation inside another, …’ in § 1.7. It’s also sometimes used between the full point after abbreviations and a following number, as in page references like p. 42, where a word space would look too big, and setting it solid would look too tight.

  • \enspace (½em). There is no direct equivalent predefined in LATEX for ‘mid’ and ‘thick’ spaces as used by metal typesetters, although it would be possible to define them. The en as a unit is used as the width of a single digit in many fonts, as a convenience so that numbers in listings are easier to line up.

  • \quad (1em) was originally the width of a capital M in metal type.

  • \qquad (2em) is double a \quad.

Beyond this, all horizontal space within paragraphs is automatically flexible, as this is what LATEX uses to achieve justification. Never be tempted to try and change the spacing between letters unless you have some professional training in typography. Some systems use adjustable inter-letter spacing (incorrectly called ‘tracking’) as an aid to justification and it is almost always wrong to do so (and looks it). While it is of course possible to change letterspacing in LATEX (with the soul package), it should only be done by a typographer, and then only very rarely, as the settings are very subtle and beyond the scope of this book.

6.1.2 Headers and footers

LATEX has built-in settings to control the page style of its default page layouts, and space at the top and bottom of the page is provided automatically for them (it can also be adjusted or turned off in the geometry package). These settings are implemented with the \pagestyle command, which can take one of the following arguments in curly braces:

plain

for a page number centered at the bottom — this is the default;

empty

for nothing at all, not even a page number — use this when you are doing one-page documents like posters or handouts, where a page number has no meaning;

headings

for running heads based on the current chapter and section — this is common for articles, books, and reports, so that every page is identifiable even if extracted or printed or copied separately;

myheadings

lets you use your own [re]programmed definitions of how to use the \markright and \markboth commands, which control how chapter and section titles get into page headers.

The command \thispagestyle (taking the same arguments) can be used to force a specific style for the current page only.

However, the easiest way to get specialist running heads is to use the fancyhdr package, which lets you redefine the left-hand, centre, and right-hand headers and footers for both odd-numbered (left-hand) and even-numbered (right-hand) pages (twelve objects in all).

Table 6.1: Header and footer locations in the fancyhdr package

bottom left, evenbottom centre, evenbottom right, evenbottom left, oddbottom centre, oddbottom right, odd
top left, eventop centre, eventop right, eventop left, oddtop centre, oddtop right, odd
\vrule height1cm width0ptLH page, even-numberedRH page, odd-numbered\vrule depth2cm width0pt

These areas can contain a page number, fixed text, variable text (like the current chapter or section title, or the catch-words of a dictionary), or even a small image. They can also be used to do page backgrounds and frames, by making one of them the top corner of an invisible box which ‘hangs’ text or images down over the whole page.

The settings for the typeset version of this document can be used as an example: for the whole story you have to read the documentation.

\pagestyle{fancy}\fancyhead{}
\renewcommand\headrulewidth{.1pt}
\fancyhead[LO,RE]{\footnotesize\sffamily\leftmark}
\fancyhead[LE,RO]{\footnotesize\sffamily\itshape
                  \rightmark}
\fancyfoot[C]{}
\fancyfoot[LE,RO]{\setlength{\fboxsep}{2pt}\ovalbox%
                  {\footnotesize\sffamily\thepage}}
\fancyfoot[LO,RE]{\footnotesize\sffamily\@title}
\fancypagestyle{plain}{\fancyhf{}
  \fancyfoot[R]{\setlength{\fboxsep}{2pt}\ovalbox{%
                \footnotesize\sffamily\thepage}}
  \fancyfoot[L]{\footnotesize\sffamily\@title}
  \renewcommand{\headrulewidth}{0pt}}
        

This is probably more complex than most documents, but it illustrates some common requirements:

  1. Settings are prefixed by making the \pagestyle ‘fancy’ and setting the \fancyhead to null to zap any predefined values.

  2. The thickness of the rule at the top of the page can be changed (or set to 0pt to make it disappear).

  3. The header and footer settings are specified with L, C, and R for left, centre, and right; and with O and E for Odd and Even numbered pages. In each setting, the typeface style, size, and font can be specified along with commands which implement various dynamic texts (here, the current chapter and section titles, which LATEX stores in \rightmark and \leftmark).

  4. The ‘plain’ variant is used for chapter starts, and resets some of the parameters accordingly.

  1. Some authors — and perhaps some designers — believe that consistency is undesirable, and that double-page layouts in printed books should each be designed independently. Valerie Kirschenbaum’s magnificent Goodbye Gutenberg expresses this both eloquently and attractively, but the cost of such design labour and the cost of four-colour printing on all pages places it beyond the reach of most publishers’ budgets until the economics of on-demand four-colour ‘printing’ makes it possible. 

  2. This does not apply for the German technique in blackletter type of using letter-spacing instead of (non-existent) italics. The defaults in the soul package were designed to cater for this.