How to Change Margins with the geometry Package in LaTeX
Set every margin with one preamble line: \usepackage[margin=1in]{geometry}. Use top, bottom, left, and right when the sides differ. Use \newgeometry when one section needs a different layout, then \restoregeometry to return. This page does not change a PDF by itself. Compile and read the PDF to check the margins.
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}Compile this geometry example
Sign up free, paste the sample, and compile. The PDF shows whether the 1 inch margin landed.
Compile this geometry exampleSet 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
- •Name the paper size, a4paper or letterpaper. The default depends on the TeX install.
- •Use inner and outer for a bound thesis. The binding side is usually wider.
- •\newgeometry changes the layout until \restoregeometry.
- •Sign up, paste the sample, and compile. The PDF is where you check the margins.
Questions
How do I set 1 inch margins in LaTeX?
Add \usepackage[margin=1in]{geometry} to the preamble, then compile.
How do I set different margins on each side?
Use \usepackage[top=2cm, bottom=2.5cm, left=3cm, right=2cm]{geometry}.
How do I change margins for one section?
Call \newgeometry{margin=0.5in} before that section and \restoregeometry after it.
Does this page change my PDF?
No. It shows the commands. Sign up and compile the example to see the margins on a PDF.
Try This in Bibby AI
Write LaTeX faster with AI auto-complete and instant compilation.
Start Writing FreeNeed help with your bibliography or citations?
Book a Free Call