Documentation/Spacing & Layout/How to Change Margins with the geometry Package in LaTeX
Spacing & Layout

How to Change Margins with the geometry Package in LaTeX

LaTeX's default margins are generous — often too generous for many purposes. The geometry package is the standard, powerful way to control page margins, paper size, and text area dimensions. With a single line in your preamble, you can set uniform or per-side margins for any paper size. Bibby AI lets you adjust margins with a visual slider and see the layout update in real time, which is significantly faster than the compile-check-adjust cycle in Overleaf.

Set Uniform Margins

The simplest usage sets all margins to the same value. You can also specify the paper size:

\documentclass{article}

% Uniform 1-inch margins on all sides
\usepackage[margin=1in]{geometry}

% Or: A4 paper with 2cm margins
% \usepackage[a4paper, margin=2cm]{geometry}

% Or: Letter paper with 1.5cm margins
% \usepackage[letterpaper, margin=1.5cm]{geometry}

\begin{document}
Your content here with custom margins.
\end{document}

Set Individual Margins Per Side

Specify different margins for top, bottom, left, and right independently:

% Different margins per side
\usepackage[top=2cm, bottom=2.5cm, left=3cm, right=2cm]{geometry}

% For bound documents: use inner/outer instead of left/right
\usepackage[
    top=2.5cm,
    bottom=2.5cm,
    inner=3cm,   % binding side
    outer=2cm    % outer side
]{geometry}

% Also control header/footer space
\usepackage[
    margin=1in,
    headheight=14pt,
    headsep=0.5cm,
    footskip=1cm
]{geometry}

Change Margins Mid-Document and Landscape Pages

Use \newgeometry to change margins for specific pages, and the landscape option for rotated pages:

\usepackage{geometry}
\geometry{margin=1in}

\begin{document}

% Normal margins here
Regular content...

% Change margins for a wide table
\newgeometry{margin=0.5in}
Wide content goes here...
\restoregeometry

% Back to original margins
More regular content...

% For a landscape page
\newgeometry{landscape, margin=1in}
Landscape content (wide tables, figures)...
\restoregeometry

\end{document}

💡 Tips

  • Always specify the paper size (a4paper, letterpaper) explicitly — the default varies by LaTeX distribution.
  • Use \newgeometry{} and \restoregeometry to change margins for specific sections like appendices or wide tables.
  • For thesis formatting, check your university's exact margin requirements — binding margins are usually larger.
  • Bibby AI's layout panel shows margin dimensions visually on the page preview, so you can fine-tune without guesswork.

Try This in Bibby AI

Write LaTeX faster with AI auto-complete and instant compilation.

Start Writing Free

Related Tutorials

How to Change Margins with the geometry Package in LaTeX | Bibby AI