Spacing, Layout, Beamer & TeX Internals
Fine-tune page margins, spacing lengths, Beamer presentation slides, collaborative drafting annotations, and low-level macro expansion.
Spacing & Page Layout
Comprehensive syntax, arguments, options, and copyable snippets for spacing & page layout.
\quad
Horizontal space (1 em)
$a \quad b$
\qquad
Horizontal space (2 em)
$a \qquad b$
\,
Thin space
$dx\,dy$
\:
Medium space
$a\:b$
\;
Thick space
$a\;b$
\!
Negative thin space
$a\!b$
\hspace{length}
Inserts horizontal space of given length
\hspace{1cm}
\vspace{length}
Inserts vertical space of given length
\vspace{1cm}
\hspace*{length}
Horizontal space that is not removed at line breaks
\hspace*{1cm}
\vspace*{length}
Vertical space that is not removed at page breaks
\vspace*{1cm}
\smallskip
Small vertical space
\smallskip
\medskip
Medium vertical space
\medskip
\bigskip
Large vertical space
\bigskip
\noindent
Suppresses paragraph indentation
\noindent This paragraph is not indented.
\indent
Forces paragraph indentation
\indent This paragraph is indented.
\setlength{\cmd}{length}
Sets a length register
\setlength{\parindent}{0pt}
\addtolength{\cmd}{length}
Adds to a length register
\addtolength{\textwidth}{2cm}
\newlength{\cmd}
Defines a new length register
\newlength{\mylength}
\parindent
Length register for paragraph indentation
\setlength{\parindent}{15pt}
\parskip
Length register for space between paragraphs
\setlength{\parskip}{6pt}
\baselineskip
Length register for line spacing
\setlength{\baselineskip}{14pt}
\textwidth
Length register for text block width
\includegraphics[width=\textwidth]{fig.png}
\textheight
Length register for text block height
\setlength{\textheight}{22cm}
\linewidth
Length register for current line width
\includegraphics[width=0.5\linewidth]{fig.png}
Beamer Presentations
Comprehensive syntax, arguments, options, and copyable snippets for beamer presentations.
\frame{content}
Creates a beamer slide (short form)
\frame{\frametitle{Intro}Content here.}
\begin{frame}...\end{frame}
Creates a beamer slide
\begin{frame}
\frametitle{Introduction}
Slide content.
\end{frame}
\frametitle{text}
Sets the title of a beamer frame
\frametitle{Results}
\pause
Pauses slide reveal in beamer
First point.
\pause
Second point.
\usetheme{name}
Sets the beamer presentation theme
\usetheme{Madrid}
\usecolortheme{name}
Sets the beamer color theme
\usecolortheme{beaver}
Drafting & Annotations (todonotes)
Comprehensive syntax, arguments, options, and copyable snippets for drafting & annotations (todonotes).
\todo{text}
Inserts a visible margin note for draft revisions (todonotes package)
\todo{Check this citation}
\listoftodos
Generates a list of all \todo notes (todonotes package)
\listoftodos
\marginpar{text}
Places a note in the page margin (base LaTeX)
\marginpar{See note}
\linenumbers
Turns on line numbering for the document (lineno package)
\linenumbers
Miscellaneous Utilities
Comprehensive syntax, arguments, options, and copyable snippets for miscellaneous utilities.
\newif\ifname
Defines a new boolean/conditional
\newif\ifdraft
\ifthenelse{cond}{true}{false}
Conditional logic (ifthen package)
\ifthenelse{\value{page}=1}{First page}{Other page}
\today
Inserts the current date
\today
\LaTeX
Typesets the LaTeX logo
Typeset with \LaTeX.
\TeX
Typesets the TeX logo
Built on \TeX.
\thanks{text}
Adds a footnote to the title/author
\author{Deb\thanks{Corresponding author}}
\protect
Protects a fragile command
\section{A \protect\footnote{note} here}
\verb|text|
Inline verbatim text
\verb|print(x)|
\newcounter{name}
Defines a new counter
\newcounter{example}
\setcounter{name}{value}
Sets a counter's value
\setcounter{example}{5}
\addtocounter{name}{value}
Adds to a counter's value
\addtocounter{example}{1}
\stepcounter{name}
Increments a counter by one
\stepcounter{example}
\arabic{counter}
Prints counter in Arabic numerals
\arabic{page}
\roman{counter}
Prints counter in lowercase Roman numerals
\roman{page}
\Roman{counter}
Prints counter in uppercase Roman numerals
\Roman{chapter}
\alph{counter}
Prints counter as lowercase letter
\alph{enumi}
\Alph{counter}
Prints counter as uppercase letter
\Alph{enumi}
Low-Level TeX & Macro Expansion
Comprehensive syntax, arguments, options, and copyable snippets for low-level tex & macro expansion.
\makeatletter
Allows @ to be used in internal command names, for redefining package internals
\makeatletter
\makeatother
Restores @ to its normal catcode after \makeatletter
\makeatother
\expandafter
Delays expansion of the following token by one step (TeX primitive)
\expandafter\def\csname foo\endcsname{bar}
\csname...\endcsname
Builds a control sequence name from text, useful for dynamic command names (TeX primitive)
\csname mycommand\endcsname
\let\name=\other
Makes one command an alias/copy of another
\let\oldsection\section
\def\name{def}
Low-level TeX command definition (plain TeX primitive)
\def\half{\frac{1}{2}}
\global
Makes the following assignment or definition apply globally, ignoring group scope
\global\def\name{value}
\NewDocumentCommand{\name}{args}{def}
Modern flexible command definition with typed arguments (xparse package)
\NewDocumentCommand{\greet}{m}{Hello, #1!}