LaTeX Page Layout
\documentclass is also used by LaTeX to format the LaTeX page layout of a LaTeX document.
Page Elements
The typical page elements are body, running header, running footer, and margin notes. Body is the type area of the LaTeX document. Above the type area is a runnng header and below the type area is a running footer. Both running header and running footer may be used for containing the page number, document and text information, and any other markers. The areas to the left and the right of body are margins, at which margin notes, such as remarks and annotations, can be contained.
Further, type area of body may be divided into columns in multi-column mode. And the margin area can also be divided into multiple margin note areas.
Examples
One-Sided Document
Code
\documentclass[a4paper]{article}
\usepackage[showframe]{geometry}
\geometry{paperheight=845pt,top=102pt,textheight=591pt}
\geometry{paperwidth=597pt,left=90pt,textwidth=418pt}
\geometry{paperheight=470pt,textheight=320pt}
\geometry{paperwidth=490pt,textwidth=310pt}
\usepackage{xcolor}
\usepackage{layout}
\colorlet{showframe}{red!50}
\makeatletter
\let\org@Gm@pageframes\Gm@pageframes
\renewcommand*{\Gm@pageframes}{%
\begingroup
\color{showframe}%
\org@Gm@pageframes
\endgroup
}
%\def\Gm@hrule{\color{red!20}\hrule height 1pt depth\z@ width\textwidth}%
%\def\Gm@vrule{\color{red!20}\vrule width 1pt height\textheight depth\z@}%
%\def\Gm@hruled{\color{red!20}\hrule height\z@ depth 1pt width\textwidth}%
\makeatother
\begin{document}
\pdfliteral{0 0 1 rg}
\layout
\pdfliteral{0 0 1 rg}
\end{document}
Output
Two-Sided Document
Code
\documentclass[a4paper,twoside]{article}
\usepackage[showframe]{geometry}
\geometry{paperheight=845pt,top=102pt,textheight=591pt}
\geometry{paperwidth=597pt,left=71.5pt,textwidth=418pt}
\geometry{paperheight=470pt,textheight=320pt}
\geometry{paperwidth=489.5pt,textwidth=310pt}
\usepackage{xcolor}
\usepackage{layout}
\colorlet{showframe}{red!50}
\makeatletter
\let\org@Gm@pageframes\Gm@pageframes
\renewcommand*{\Gm@pageframes}{%
\begingroup
\color{showframe}%
\org@Gm@pageframes
\endgroup
}
%\def\Gm@hrule{\color{red!20}\hrule height 1pt depth\z@ width\textwidth}%
%\def\Gm@vrule{\color{red!20}\vrule width 1pt height\textheight depth\z@}%
%\def\Gm@hruled{\color{red!20}\hrule height\z@ depth 1pt width\textwidth}%
\makeatother
\begin{document}
\pdfliteral{0 0 1 rg}
\layout
\pdfliteral{0 0 1 rg}
\end{document}
Output
Two-Columns and Two-MarginNotes Document
Code
\documentclass[a4paper]{article}
\usepackage[showframe]{geometry}
\geometry{paperheight=845pt,top=102pt,textheight=591pt}
\geometry{paperwidth=598pt,left=90pt,textwidth=418pt}
\geometry{paperheight=600pt,textheight=450pt}
\geometry{paperwidth=560pt,textwidth=380pt}
\usepackage{xcolor}
\usepackage{layouts}
\colorlet{showframe}{red!50}
\makeatletter
\let\org@Gm@pageframes\Gm@pageframes
\renewcommand*{\Gm@pageframes}{%
\begingroup
\color{showframe}%
\org@Gm@pageframes
\endgroup
}
%\def\Gm@hrule{\color{red!20}\hrule height 1pt depth\z@ width\textwidth}%
%\def\Gm@vrule{\color{red!20}\vrule width 1pt height\textheight depth\z@}%
%\def\Gm@hruled{\color{red!20}\hrule height\z@ depth 1pt width\textwidth}%
\makeatother
\begin{document}
%\the\paperwidth
\pdfliteral{0 0 1 rg}
\begin{figure}
%\oddpagelayoutfalse
\twocolumnlayouttrue
\pagediagram
%\caption{Left-hand two-column page layout parameters} %\label{fig:pplt}
\end{figure}
\pdfliteral{0 0 1 rg}
\end{document}
Output
Commands
Paper Dimensions
\paperheightHeight of the phsical paper
\paperwidthWidth of the physical paper
Geometrical Dimensions of Page Elements
\textheightHeight of type body
\textwidthWidth of type body
\headheightHeight of header
\headsepUpward displacement of header above the body
\topmarginThe extra vertical space added at the top of the header
\footskipDownward displacement of the baseline of the footer below the body
\marginparwidthWidth of maginal notes
\marginparsepHorizontal displacement of margin notes away from the body.
\oddsidemarginThe extra space added at the left of body for all odd-numbered pages of two-sided document or all pages of one-sided document
\evensidemarginThe extra space added at the left of body for all even-numbered pages of two-sided document
\marginparpushMinimal vertical space between two successive margin notes.
Geometrical Dimensions of Body elements
\columnwidthWidth of a single column in mlticolumn mode. (determined by \textwidth and \columnsep
columnsepWidth of space between type columns in multicolumn mode.
\columnsepruleWidth of a vertical line separating the two adjacent columns in multicolumn mode. (default=0pt, no visible rule)
\linewidthWidth of the current text line. Usually equals \columnwidth but might get different values in eniviroments that change the margins.
Source and Reference