geometry
Provides intuitive control over document page layout, margins, and paper dimensions with minimal configuration required.
Overview
Simplifies the often complex task of customizing document dimensions and page layouts through an intuitive interface that requires minimal user input. The package automatically handles centering and balancing of page elements.
- Offers straightforward commands for setting margins, headers, footers, and paper size using natural measurements.
- Includes built-in support for standard paper sizes (like A4, letter, legal) without requiring manual dimension specifications.
- Automatically communicates page dimensions to PDF and DVI outputs for proper document rendering.
- Popular in academic papers, books, and professional documents where precise page layout control is essential.
- Enables quick layout adjustments through simple key-value options, making it ideal for both beginners and advanced users who need precise document formatting.
Getting Started
To use geometry
, include it in your document preamble:
\documentclass{article}
\usepackage[options]{geometry}
Common options include:
\documentclass{article}
\usepackage[margin=2cm]{geometry} % Sets all margins to 2cm
% or
\usepackage[left=3cm, right=2cm, top=2.5cm, bottom=2.5cm]{geometry} % Individual margins
% or
\usepackage[a4paper, margin=1in]{geometry} % A4 paper with 1 inch margins
Examples
Setting custom margins for a document.
\documentclass{article}
\usepackage[margin=1in]{geometry}
\begin{document}
This document has 1-inch margins on all sides. The geometry package makes it easy to customize page dimensions without having to manually adjust individual margin parameters.
The content area is automatically adjusted based on the margin settings.
\end{document}
Creating a document with specific paper size and layout settings.
\documentclass{article}
\usepackage[a4paper, landscape, left=2cm, right=2cm, top=3cm, bottom=3cm, includeheadfoot]{geometry}
\usepackage{lipsum} % For sample text
\begin{document}
\section{Landscape Document with Custom Layout}
This document demonstrates:
\begin{itemize}
\item A4 paper in landscape orientation
\item Left and right margins of 2cm
\item Top and bottom margins of 3cm
\item Header and footer areas included in the page layout
\end{itemize}
\lipsum[1-3]
\end{document}
Creating a two-column document with specific dimensions.
\documentclass{article}
\usepackage[letterpaper, total={6.5in, 9in}, top=1in, twocolumn, columnsep=0.5in]{geometry}
\usepackage{lipsum} % For sample text
\begin{document}
\section{Two-Column Layout with Specific Dimensions}
This example demonstrates:
\begin{itemize}
\item US Letter paper size
\item Total text area of 6.5 × 9 inches
\item Two-column layout with 0.5 inch separation
\item 1 inch top margin
\end{itemize}
\lipsum[1-6]
\end{document}