Pages and PDF
Paper, margins and columns, heads and feet, and what goes into the PDF file.
Paper and margins
The class's options
The class's options set the paper (a4paper, letterpaper, a5paper, b5paper, legalpaper, executivepaper, and landscape to turn it) and the type size. See Documents and Classes.
geometry
geometry sets the rest, as package options or later with \geometry:
\usepackage[a4paper, margin=2cm]{geometry}
\geometry{left=3cm, right=2cm}| Key | What it sets |
|---|---|
paperwidth, paperheight | The paper's size. |
margin | Every margin. |
hmargin, vmargin | The left and right, or top and bottom. |
left, right | One side. |
top, bottom | The top or bottom. |
A later, more specific key wins over an earlier, more general one, as in LaTeX.
LaTeX's own lengths
LaTeX's page lengths mean what they mean there too: \setlength{\topmargin}{...}, \oddsidemargin, \textwidth, \headsep and \footskip. fullpage and a4wide are accepted.
Columns
Two columns
twocolumn as a class option sets the whole document in two columns. \twocolumn[...] starts two columns with a full-width part above, such as a title and abstract, and \onecolumn goes back to one.
multicol
multicol's multicols block sets part of a page in columns:
\usepackage{multicol}
\begin{multicols}{3}
Three columns of text, balanced on the last page.
\end{multicols}Columns are balanced on the last page.
Floats across columns
figure* and table* span both columns.
Heads and feet
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\textit{Annual report}}
\fancyhead[R]{\leftmark}
\fancyfoot[C]{Page \thepage\ of \pageref{LastPage}}Page styles
\pagestyle{style} sets every page's head and foot from then on, and \thispagestyle{style} only the current page's. LaTeX's styles are plain, with the number in the foot, empty, with nothing, and headings, with running heads.
fancyhdr
\pagestyle{fancy} uses fancyhdr's head and foot. \fancyhf{} clears them, and \fancyhead[L], [C] and [R] and \fancyfoot fill each part. fancyhdr's older spellings, \lhead, \chead, \rhead, \lfoot, \cfoot and \rfoot, work too, and \renewcommand{\headrulewidth}{0pt} removes the rule under the head.
Other packages
KOMA-Script's scrlayer-scrpage and titleps set heads and feet too.
Running heads
\markboth{left}{right} and \markright{right} set what \leftmark and \rightmark show, on that page and the pages after it until another is set.
Page numbers
\pagenumbering{roman} switches to roman numbers (arabic, roman, Roman, alph and Alph), starting again at one. \setcounter{page}{n} sets the current page's number.
Page breaks
Breaking pages
\newpage, \clearpage, \cleardoublepage and \pagebreak break pages. \cleardoublepage breaks as \clearpage does, without adding a blank page to reach a right-hand one.
Filling a page
\vfill and \vspace{\fill} share out what a page leaves.
Empty pages
A page holding nothing but a numbering change or a contents entry is never shipped as a blank page.
The PDF
mLaTeX writes the PDF itself.
Fonts
Fonts are embedded, cut down to the glyphs the document uses.
Pictures
JPEGs are embedded unchanged; PNG and WebP are compressed; PDF pages, EPS and SVG pictures are embedded as vectors.
Links and bookmarks
Links and bookmarks come with hyperref; see References and Links.
Information
\hypersetup's pdftitle, pdfauthor, pdfsubject and pdfkeywords are the file's title, author, subject and keywords:
\usepackage{hyperref}
\hypersetup{pdftitle={Energy Estimates}, pdfauthor={Mara Ellison}}The same document gives the same file
The PDF's identifier is made from its own bytes, so compiling the same document twice gives the same file.
PDF/A
For archiving, mLaTeX writes PDF/A-2b when asked, with the document's information as XMP metadata and an sRGB output intent:
\DocumentMetadata{pdfstandard=A-2b}
\documentclass{article}pdfx's a-2b option and its kin do the same.
No file but the PDF
mLaTeX writes only the PDF: no .aux, .log, .toc, .out or .bbl. The PDF goes beside the document, or into the folder --output-directory names, under the document's name or the one --job-name gives. A program embedding mLaTeX can receive the PDF as bytes in memory instead; see Embedding.
Related packages
- Documents and Pages: every package, with its commands and an example.