Page Layout

  • JNext lesson
  • KPrevious lesson
  • FSearch lessons
  • EscClear search

A well-designed page is invisible. The reader doesn’t notice margins, headers, or spacing; they just find the text easy to read. This chapter covers the tools that make that happen.

LaTeX page layout is invisible when it’s right: margins, headers, and spacing that readers never consciously notice. This lesson covers the geometry package for dimensions, fancyhdr for headers and footers, and the spacing decisions that make a document feel deliberate.

The geometry Package

geometry is the standard way to set page dimensions:

% Simple: uniform margins
\usepackage[margin=1in]{geometry}

% Different margins
\usepackage[
    top=1in,
    bottom=1in,
    left=1.25in,
    right=1in
]{geometry}

% A5 with tight margins (for print)
\usepackage[
    a5paper,
    top=20mm,
    bottom=20mm,
    inner=15mm,
    outer=15mm
]{geometry}

% Specify text area dimensions
\usepackage[
    textwidth=5.5in,
    textheight=8.5in,
    centering
]{geometry}

Twoside Layouts

For two-sided printing (the default for book), use inner/outer instead of left/right:

\usepackage[
    twoside,
    inner=1.25in,   % Binding side (larger)
    outer=1in        % Outer edge
]{geometry}

The inner margin is where the binding goes. Make it slightly larger so text isn’t swallowed by the spine.

Tip: This book uses two layouts. The US Letter version: [margin=1in]. The A5 print version: [top=20mm, bottom=20mm, left=15mm, right=15mm]. Both share the same content through a common preamble file.

Headers and Footers with fancyhdr

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}                              % Clear all
\fancyhead[LE]{\small\textit{Book Title}}  % Left on even pages
\fancyhead[RO]{\small\textit{\leftmark}}   % Right on odd pages
\fancyfoot[C]{\thepage}                    % Centered page number
\renewcommand{\headrulewidth}{0.4pt}       % Header line
\renewcommand{\footrulewidth}{0pt}         % No footer line

The position codes:

  • L = Left, C = Center, R = Right
  • E = Even pages, O = Odd pages
  • LE = Left on even pages, RO = Right on odd pages

Automatic marks:

  • \leftmark — current chapter name
  • \rightmark — current section name

Plain Pages

Chapter opening pages use the plain style by default. To customize them:

\fancypagestyle{plain}{
    \fancyhf{}
    \fancyfoot[C]{\thepage}
    \renewcommand{\headrulewidth}{0pt}
}

Title Formatting with titlesec

\usepackage{titlesec}

% Chapter: "Chapter N" above, title below
\titleformat{\chapter}[display]
    {\huge\bfseries\color{ramanujanblue}}
    {\chaptertitlename\ \thechapter}
    {20pt}
    {\Huge}

% Section: number and title inline
\titleformat{\section}
    {\Large\bfseries\color{ramanujanblue}}
    {\thesection}
    {1em}
    {}

% Spacing: {left}{before}{after}
\titlespacing{\chapter}{0pt}{50pt}{40pt}
\titlespacing{\section}{0pt}{3.5ex plus 1ex minus 0.2ex}
                              {2.3ex plus 0.2ex}

Table of Contents

\tableofcontents
\listoffigures     % Optional
\listoftables      % Optional

Customizing TOC Depth

% Show down to subsections in TOC
\setcounter{tocdepth}{2}

% Number down to subsubsections
\setcounter{secnumdepth}{3}

For more advanced TOC styling, the tocloft package provides full control over fonts, spacing, and leader dots.

Multi-Column Layouts

Class Option

\documentclass[twocolumn]{article}

This sets the entire document in two columns.

Local Multi-Column

For multi-column sections within a single-column document, use multicol:

\usepackage{multicol}

\begin{multicols}{3}
  Content flows across three columns here.
  Column breaks happen automatically.
\end{multicols}

Title Pages

The Default Title

\title{My Document}
\author{Name \and Co-Author}
\date{\today}
\maketitle

Custom Title Pages

For full control, use the titlepage environment:

\begin{titlepage}
    \centering
    \vspace*{2cm}
    {\Huge\bfseries\color{ramanujanblue} Book Title}
    \vspace{1cm}
    {\Large Subtitle}
    \vspace{2cm}
    {\large\textbf{Author Name}}
    \vfill
    {\small Institution \\ \today}
\end{titlepage}

\vspace* works at the top of a page (unlike \vspace, which is ignored). \vfill pushes content to the bottom.

Footnotes and Margin Notes

This has a footnote\footnote{The footnote text appears
at the bottom of the page.}.

\marginpar{This appears in the margin.}

Spacing Commands

  • Command: \vspace{...} | Effect: Vertical space (flexible)
  • Command: \vspace*{...} | Effect: Vertical space (even at page top)
  • Command: \hspace{...} | Effect: Horizontal space
  • Command: \vfill | Effect: Fills remaining vertical space
  • Command: \hfill | Effect: Fills remaining horizontal space
  • Command: \newpage | Effect: Start new page
  • Command: \clearpage | Effect: Start new page, flush all floats
  • Command: \cleardoublepage | Effect: Start new right-hand page (book class)
  • Command: \phantom{...} | Effect: Invisible space matching text dimensions

    This Book as a Case Study

This book demonstrates the layout techniques from this chapter:

  • Class: book with [11pt,letterpaper,twoside,openright]
  • Margins: [margin=1in] via geometry
  • Fonts: STIX Two Text/Math via fontspec/unicode-math
  • Headers: Book title (even left) and chapter name (odd right) via fancyhdr
  • Colors: ramanujanblue for headings and links, accentgold for tips
  • Title formatting: Custom chapter/section styles via titlesec
  • Boxes: Seven custom tcolorbox environments for code, output, tips, warnings, exercises, keyboard shortcuts, and comparisons
  • Two variants: The same content compiles to both US Letter (11pt, 1in margins) and A5 (10pt, 15–20mm margins) through separate main files sharing a common preamble

Exercises:

  1. Create a document with custom margins (1.5in left for binding, 1in right, 0.75in top/bottom). Add headers with your document title on even pages and section name on odd pages.
  2. Design a title page for a fictional thesis using the titlepage environment. Include: university name, degree, title, author, advisor, date, and a university logo placeholder.
  3. Create two versions of the same document: one optimized for screen reading (wide margins, large text) and one for print (narrow margins, smaller text). Use separate main files with a shared preamble.
  4. Set up a multi-column index or glossary using the multicol package with three columns.

Layout plus typography covers document design end to end. With pages looking right, figures, tables, and graphics fills them with more than text.

Quick answers to common questions:

How do I change margins in LaTeX?

The geometry package: \usepackage[margin=1in]{geometry} sets all four at once, with per-side keys when you need asymmetry for binding. Never fight the layout with manual spacing commands; declare the geometry you want.

How do I get custom headers and footers?

fancyhdr: set the page style and assign content to the left, center, and right slots of header and footer. Standard academic setup is title or section in the header, page number centered in the footer.

Should I use double spacing for a thesis?

Only if your institution requires it; the setspace package makes it one line either way. Typographically, LaTeX’s default single spacing with proper margins is more readable, but submission rules beat typography every time.