LogoLogo
Terminal
  • Attic Lab
  • Getting Started
  • Crest Gold
  • Crest Silver
  • Videos on Computation
  • PI PICO (CIRCUITPYTHON)
    • Getting Started
    • Pin Out Diagram
    • Breadboards
    • 1. Led Blink
    • 2. RGB
    • 3. OLED
    • 4. Sensors
    • 5. Wifi
    • 6. Servos
  • Arduino
    • Getting Started
    • Pin Out Diagrams
      • Mega2560 R3
    • Programming
      • Arduino C - Cheat Sheet
    • Buttons
      • Momentary Switches
    • Display
      • LEDs
      • 7 Segment Displays
      • LCD Displays (GPIO)
      • LCD Displays (SPI)
      • OLEDs
    • Communication
      • Antenna Theory
      • Lora
      • Wifi
        • Boards
    • Project Ideas
    • Motion
      • DC Motors
      • Servo Motors
      • Stepper Motors
  • Microsoft Office
    • Word
    • Powerpoint
    • Excel
  • The Terminal
    • Basics
    • Cheat Sheet
    • Games
      • Level 1 - Bashcrawl
      • Level 2 - Bandit
  • TinkerCad
    • Gallery
    • Getting Started
    • Basic Operations
    • Basic Skills
    • Projects
      • Locking Container
  • Python
    • Hello World
    • Turtle Graphics
      • Strings in Turtle Graphics
      • Cheat Sheet
    • Variables
    • Loops
    • If Statements
    • Functions
    • Games
      • Pong
  • Raspberry Pi
    • Setup
      • Changing The Hostname
      • Headless Setup
      • Kiosk Mode
    • Remote Connections
    • Displays
      • Memory
        • External HD
      • HyperPixel 4.0
  • Ultimaker 3D Printing
    • The Thingiverse
    • Preparing the File
    • Printing
    • Calibration Prints
    • Print Set
  • Fusion 360
    • Getting Started
    • Design Tutorials
      • Tweezers
      • Mars Rover Wheel
    • Surface Modeling
  • Electronics
    • References
    • Antenna Theory
    • LoRa
  • PCB Milling
    • FlatCam
    • Candle
    • PCB Milling
  • Projects
  • Projects
    • Star Map Necklace
    • Ideas Respository
  • Latex
    • What is LaTeX?
    • Getting Started
    • Structure
    • Page Size & Margins
    • Styling
    • Images
    • Lists
    • Tables
    • Mathematics
      • Superscript and Subscripts
      • List of Symbols
      • Fractions and Binomials
      • Integrals, Sums & Limits
    • Colors
  • Web Development
    • The Internet
    • Intro to HTML
    • Basic Elements
    • Basic Styling
Powered by GitBook
On this page
  • Paper size, orientation and margins
  • Fine tuning your LATEX page dimensions
  • Reference guide

Was this helpful?

  1. Latex

Page Size & Margins

PreviousStructureNextStyling

Last updated 3 years ago

Was this helpful?

Suppose you have to create a document in a4paper and the text shouldn't exceed 6 in width and 8 in height. To create it with geometry is easy, include this one line in the preamble:

\usepackage[a4paper, total={6in, 8in}]{geometry}

The parameters passed to the command determine the layout. In this case a4paper establishes the paper size and the total parameter determines the size of the text area. Note that Overleaf uses a European LaTeX distribution, which produces documents in A4 size by default.

Paper size, orientation and margins

Paper size, orientation and margins are the most common page elements that must be changed depending on the type of document. To set the desired values there are two ways, either you pass them as parameters to the \includepackage statement as in the example above, or use a \geometry command in the preamble.

For example, let's create a document with legal paper size, landscape orientation and a 2 in margin:

\usepackage[legalpaper, landscape, margin=2in]{geometry}

You can achieve the same thing in a slightly different way:

\usepackage{geometry}
\geometry{legalpaper, landscape, margin=2in}

As you see, the parameters are comma separated. For a complete list of predefined paper sizes, see the . The second parameter is the orientation, its default value is portrait. Finally, each margin is set to 2 in.

Fine tuning your LATEX page dimensions

The regular LATEX page dimensions are presented (with example values) in picture at the right of this section.

The geometry package provides a flexible and easy interface to change page dimensions. You can change the page layout with intuitive parameters:

Next is a list of document elements whose length can be changed. The parameters have to be written in the form parameter=value, use standard LATEX units. (mm, cm, pt, in)textwidthCorresponds to element 8 in the figure.textheightElement 7 in the figure.totalDepends on other parameters, by default defines the dimensions of the Body, but can be combined with the includehead, includefoot, includeheadfoot and includemp commands to change the dimensions of Header, the Body, the Footer and the Margin Notes altogether.left, lmargin, innerThese three parameters change the length of the left margin. Elements 1 and 3 in the figure, combined.right, rmargin, outerThese three parameters change the length of the right margin. Elements 9 and 10 in the figure, combined.top, tmarginThese two parameters represent elements 2 and 6 in the figure, combined.bottom, bmarginThese two parameters set the distance from the bottom edge of the document to its baseline.headheightHeight of the headerheadsepSeparation between header (baseline) and text body. Element 6 in the figure.footnotesepSeparation between the bottom of text body (baseline) and the top of footnote text.footskipDistance separation between baseline of last line of text and baseline of footer.marginparwidth, marginparWidth of the margin notes. Element 10 in the figure.

The paper size can be set to any size you need by means of the command papersize={⟨width⟩,⟨height⟩}.

Let's see an example with some of the aforementioned options:

\usepackage{geometry}
 \geometry{
 a4paper,
 total={170mm,257mm},
 left=20mm,
 top=20mm,
 }

Here the text area, the left margin and the top margin are set. The right and bottom margins are automatically computed to fit the page.

Reference guide

parameter

description

values

papersize

Determines the size of the paper

a0paper, a1paper, a2paper, a3paper, a4paper, a5paper, a6paper,b0paper, b1paper, b2paper, b3paper, b4paper, b5paper, b6paper,c0paper, c1paper, c2paper, c3paper, c4paper, c5paper, c6paper,b0j, b1j, b2j, b3j, b4j, b5j, b6j,ansiapaper, ansibpaper, ansicpaper, ansidpaper, ansiepaper,letterpaper, executivepaper, legalpaper

Layout-dimensions.png

Open an example of the geometry package in Overleaf
reference guide
Open an example of the geometry package in Overleaf
Open an example of the geometry package in Overleaf