Every \command in the LaTeX universe, explained

The global reference: hundreds of LaTeX commands and environments, from the kernel to amsmath, hyperref, TikZ, biblatex, and Beamer, each explained in one line.

Every \command in the LaTeX universe, explained

This page defines every LaTeX command and environment that appears in any lesson on Oleafly Learn, plus the wider standard vocabulary you will meet in real papers. Kernel, amsmath, hyperref, graphicx, booktabs, biblatex, TikZ, Beamer, and the packages researchers actually load. Skim it by category, or search the page with Ctrl/Cmd-F for the command you just met. Each entry is one line: what it does and, where it matters, which package it comes from.

Document classes and setup

CommandWhat it does
\documentclass{article}First line of every document: picks the overall layout; article is the default choice for papers.
\documentclass{report}Class for longer reports: adds \chapter and starts the abstract on its own page.
\documentclass{book}Class for books: chapters, two-sided layout, front/main/back matter.
\documentclass{letter}Class for correspondence, with \opening, \closing, and address commands.
\documentclass{beamer}Class for slide presentations built from frame environments.
\documentclass[11pt,a4paper]{article}Common class options: font size (10pt, 11pt, 12pt), paper (a4paper, letterpaper), twocolumn, twoside, landscape, draft, titlepage.
\usepackage{amsmath}Loads a package in the preamble to add features.
\usepackage[margin=1in]{geometry}Sets page margins and paper size (geometry).
\title{...}Stores the document title, printed later by \maketitle.
\author{...}Stores the author list for \maketitle; separate multiple authors with \and.
\andSeparator between author names inside \author{...}.
\date{...}Stores the date shown by \maketitle; \date{} hides it, \date{\today} shows today.
\todayPrints the current date at compile time.
\maketitlePrints the title block from \title, \author, and \date.
\thanks{...}Attaches a footnote to a title or author name, e.g. for funding or contact info.
\institute{...}Author affiliation command used by Beamer and the Springer LNCS class.
\inst{1}Affiliation superscript marker in LNCS and Beamer author lists: Ada Lovelace\inst{1}.
\keywords{...}Prints the paper’s keyword list in publisher classes like acmart and llncs.
\address{...}letter class: stores the sender’s address for the letterhead.
\signature{...}letter class: stores the name printed under the closing.
\opening{Dear ...}letter class: prints the salutation and starts the letter body.
\closing{Sincerely,}letter class: prints the sign-off and signature block.
\LaTeXPrints the LaTeX logo with its raised and lowered letters.
\TeXPrints the TeX logo with its lowered E.
\input{file}Pastes another .tex file in place, as if you had typed it there.
\include{chapter1}Inputs a chapter file starting on a new page; enables partial compiles via \includeonly.
\includeonly{chapter1,chapter3}Preamble list restricting which \include files actually compile.
\hypersetup{...}Configures hyperref options such as link colors and PDF metadata.
\AtBeginDocument{...}Runs code right after \begin{document}, useful for late setup.
\AtEndDocument{...}Runs code just before the document ends.
\makeatletterTemporarily makes @ a letter so you can use or patch internal commands.
\makeatotherRestores @ to normal after \makeatletter.
\typeout{...}Prints a message to the compile log and terminal, handy for debugging.
\protectShields a fragile command inside a moving argument like \caption or \section.
\listfilesPreamble command that logs every loaded file and its version, for bug reports.

Structure and sectioning

CommandWhat it does
\part{...}Highest-level division, above chapters, in book and report classes.
\chapter{...}Numbered chapter heading in book and report classes (not in article).
\section{...}Numbered top-level heading in an article.
\subsection{...}Numbered heading one level below \section.
\subsubsection{...}Numbered heading one level below \subsection.
\paragraph{...}Lowest-level heading: a run-in bold title at the start of a paragraph.
\subparagraph{...}One level below \paragraph, rarely needed.
\section*{...}Starred sectioning prints the heading without a number or TOC entry.
\appendixSwitches numbering so the following chapters or sections become Appendix A, B, C.
\appendixpagePrints a separate “Appendices” divider page (appendix package).
\tableofcontentsPrints the table of contents, built from your sectioning commands.
\listoffiguresPrints a list of all figure captions with page numbers.
\listoftablesPrints a list of all table captions with page numbers.
\frontmatterBook-class switch for the pre-content pages: roman page numbers, unnumbered chapters.
\mainmatterBook-class switch back to the main content: arabic page numbers, numbered chapters.
\backmatterBook-class switch for the end pages: chapters stop being numbered.
\addcontentsline{toc}{chapter}{...}Manually adds an entry to the table of contents (or a list of figures/tables).
\addtocontents{toc}{...}Writes arbitrary material (like spacing) into a contents file.
\setcounter{secnumdepth}{3}Controls how deep sectioning numbers go.
\setcounter{tocdepth}{2}Controls how deep the table of contents goes.

Defining commands and environments

CommandWhat it does
\newcommand{\R}{\mathbb{R}}Defines your own command; errors if the name already exists.
\renewcommand{...}{...}Redefines an existing command; errors if it does not exist.
\providecommand{...}{...}Defines a command only if it is not already defined; otherwise silently does nothing.
\NewDocumentCommandModern command definition with flexible optional arguments (LaTeX3/xparse).
\newenvironment{name}{begin code}{end code}Defines your own environment with code run at \begin and \end.
\renewenvironment{name}{...}{...}Redefines an existing environment.
\ensuremath{...}Makes a macro’s math content work both inside and outside math mode.
\DeclareMathOperator{\E}{E}Defines an upright operator name; the starred form puts limits below (amsmath).
\DeclareMathOperator*{\argmin}{arg\,min}Starred form: the operator takes limits below in display math (amsmath).
\newtheorem{lemma}{Lemma}Declares a theorem-like environment (amsthm).
\fooExample name for a user-defined macro in the \newcommand lesson, not a real LaTeX command.
\abs{x}Example user-defined macro from the custom commands lesson that typesets absolute-value bars.
\mat{A}Example user-defined macro from the custom commands lesson for a bold matrix symbol.
\vect{v}Example user-defined macro from the custom commands lesson for a bold vector symbol.
\set{...}Example user-defined macro from the custom commands lesson that typesets sized set braces.
\citepairExample user-defined citation helper macro from the custom commands lesson, not a standard command.
\EExample user-defined operator for expectation, typically defined with \DeclareMathOperator or \newcommand.
\RExample user-defined macro for the reals: \newcommand{\R}{\mathbb{R}}.
\argmax, \argminOperator names for arg max / arg min, defined in this course with \DeclareMathOperator* so subscripts sit below.

Counters and lengths

CommandWhat it does
\newcounter{examples}Creates a new counter, optionally reset by a parent: \newcounter{examples}[section].
\setcounter{page}{1}Sets a counter’s value, here restarting page numbers.
\addtocounter{examples}{2}Adds a value to a counter without printing anything.
\stepcounter{examples}Increments a counter by one.
\refstepcounter{examples}Increments a counter and makes it the target for the next \label.
\value{examples}Reads a counter’s value for use in arithmetic or comparisons.
\arabic{examples}Prints a counter as arabic numerals: 1, 2, 3.
\roman{examples}, \Roman{examples}Prints a counter as lowercase or uppercase roman numerals.
\alph{examples}, \Alph{examples}Prints a counter as lowercase or uppercase letters.
\fnsymbol{footnote}Prints a counter as footnote symbols: asterisk, dagger, and so on.
\newlength{\mygap}Creates a new length register.
\setlength{\parskip}{6pt}Assigns a value to a length register.
\addtolength{\textheight}{1cm}Adds to an existing length.
\settowidth{\mygap}{text}Sets a length to the natural width of some text.
\parindentLength of the first-line paragraph indent; set with \setlength{\parindent}{0pt}.
\parskipLength of the vertical gap between paragraphs; set with \setlength.
\linewidthLength of the current line, handy for sizing: width=\linewidth.
\textwidthLength of the full text block width on the page.
\textheightLength of the full text block height on the page.
\columnwidthWidth of one column in a multi-column layout.
\baselineskipVertical distance between baselines of consecutive lines.
\linespread{1.3}Scales the leading (line spacing) for the whole document; needs \selectfont or a size command to take effect in place.

Paragraphs, line breaks, and hyphenation

CommandWhat it does
\\Ends the current line inside paragraphs, tables, and arrays.
\\[6pt]Line break with extra vertical space after it.
\newlineBreaks the line without justifying it and without allowing a page break.
\linebreakRequests a justified line break here; optional [0-4] sets insistence.
\nolinebreakDiscourages a line break at this point.
\parEnds the paragraph, same as a blank line in the source.
\noindentSuppresses the first-line indent of the paragraph that follows.
\indentForces the first-line indent where it would otherwise be suppressed.
\-Marks an allowed hyphenation point inside a word.
\hyphenation{data-set}Preamble list teaching LaTeX how to hyphenate specific words.
\sloppyLoosens spacing rules so lines break more easily, avoiding overfull boxes.
\fussyRestores strict spacing rules after \sloppy.
\raggedrightLeft-aligns the following text instead of justifying it.
\raggedleftRight-aligns the following text.
\centeringCenters everything that follows inside the current group, e.g. a figure’s image.
\samepageDiscourages page breaks within the current group.
\enlargethispage{\baselineskip}Makes only the current page a bit taller, to squeeze in one more line.
~Non-breaking space: Figure~1 keeps the number on the same line.

Spacing

CommandWhat it does
\quadInserts a horizontal space about the width of a capital M.
\qquadInserts twice the space of \quad.
\enspaceInserts half a \quad of horizontal space.
\hspace{1cm}Inserts horizontal space; disappears at a line break.
\hspace*{1cm}Horizontal space that survives even at a line break.
\vspace{1cm}Inserts vertical space of a given length.
\vspace*{1cm}Vertical space that survives even at a page break.
\smallskipInserts a small vertical gap between paragraphs.
\medskipInserts a medium vertical gap between paragraphs.
\bigskipInserts a large vertical gap between paragraphs.
\hfillStretchy horizontal space that pushes content apart to fill the line.
\vfillStretchy vertical space that pushes content apart to fill the page.
\dotfillFills the remaining line with dots, as in a menu or contents line.
\hrulefillFills the remaining line with a horizontal rule.
\stretch{2}Stretchy glue with a weight, for proportional spacing: \hspace{\stretch{2}}.
\fillThe unit stretchy length; \hspace{\fill} is what \hfill expands to.
\phantom{text}Takes up exactly the space of its argument but prints nothing.
\hphantom{text}Takes up only the width of its argument, with zero height.
\vphantom{text}Takes up only the height of its argument, with zero width.
\smash{...}Prints its argument but pretends it has zero height and depth.
\strutInvisible support the height of a normal line, to even out row heights.
\mathstrutMath-mode strut the size of a parenthesis, to align radicals and fractions.

Boxes and rules

CommandWhat it does
\mbox{...}Unbreakable horizontal box; also keeps its contents on one line.
\makebox[3cm][r]{...}Box of a set width with chosen alignment (l, c, r, s).
\fbox{...}Draws a frame around its contents.
\framebox[3cm][c]{...}Framed box of a set width with chosen alignment.
\parbox{5cm}{...}A paragraph box: a mini column of text of the given width.
\raisebox{2pt}{...}Shifts its contents up (or down with a negative length).
\rule{2cm}{0.4pt}Draws a filled rectangle; the workhorse for custom lines.
\colorbox{yellow}{...}Puts text on a colored background box (xcolor).
\fcolorbox{red}{yellow}{...}Colored box with a colored frame (xcolor).

Pages, numbering, and headers

CommandWhat it does
\newpageEnds the current page and starts a new one.
\clearpageStarts a new page after first flushing all pending figures and tables.
\cleardoublepageLike \clearpage but also ensures the next page is a right-hand (odd) page.
\pagebreakRequests a page break at this point, stretching the page to full height.
\nopagebreakDiscourages a page break at this point.
\pagenumbering{roman}Sets the page number style (arabic, roman, Roman, alph, Alph), resetting the counter to 1.
\pagestyle{fancy}Sets the running header/footer style (plain, empty, headings, myheadings, fancy) for all following pages.
\thispagestyle{empty}Overrides the header/footer style for the current page only.
\thepagePrints the current page number; used inside headers and footers.
\marginpar{...}Puts a note in the page margin next to the current line.
\fancyhf{}Clears all fancyhdr header and footer fields before setting your own.
\fancyhead[R]{...}Sets a fancyhdr header field, here the right-hand one.
\fancyfoot[C]{\thepage}Sets a fancyhdr footer field, here a centered page number.
\headrulewidthfancyhdr macro for the header rule thickness; renew to 0pt to remove the line.
\footrulewidthfancyhdr macro for the footer rule thickness, 0pt by default.
\newgeometry{margin=2cm}Changes page geometry mid-document (geometry).
\restoregeometryReturns to the preamble geometry after \newgeometry (geometry).

Special characters

The ten reserved characters and how to print them, plus common text symbols.

CommandWhat it does
\%Prints a percent sign (bare % starts a comment).
\&Prints an ampersand (bare & is the table column separator).
\#Prints a hash (bare # marks macro arguments).
\_Prints an underscore (bare _ is a math subscript).
\{ and \}Print curly braces (bare braces group).
\$Prints a dollar sign (bare $ toggles math mode).
\textbackslashPrints a backslash in text.
\textasciitildePrints a tilde in text (bare ~ is a non-breaking space).
\textasciicircumPrints a caret in text (bare ^ is a math superscript).
\textbarPrints a vertical bar in text.
\textless, \textgreaterPrint < and > correctly in text mode.
\ldots, \dotsEllipsis with correct spacing; \dots adapts in math mode (amsmath).
\textellipsisThe text-mode ellipsis that \dots uses outside math.
\textemdash, \textendashNamed commands for the em and en dash (same output as --- and --).
\textquotedblleft, \textquotedblrightCurly double quotation marks (usually typed as backtick pairs and apostrophe pairs).
\guillemetleft, \guillemetrightFrench angle quotation marks (older spelling: \guillemotleft/\guillemotright).
\dag, \ddagDagger and double dagger in text, common for author affiliations.
\SSection sign, as in S 2.1 of a legal document.
\PParagraph (pilcrow) sign.
\poundsBritish pound sign.
\euroEuro sign (eurosym package; the kernel also provides \texteuro).
\copyrightCopyright sign.
\textregisteredRegistered trademark sign.
\texttrademarkTrademark sign.
\textdegreeDegree sign: 25\textdegree C.
\textmuUpright micro sign for text like microns.
\textperthousandPer-mille sign.

Accents and special letters

For pdfLaTeX-era text accents; with XeLaTeX/LuaLaTeX and UTF-8 input you can usually just type the character.

CommandWhat it does
\'{e}Acute accent: e-acute as in cafe with an accent.
\`{e}Grave accent.
\^{o}Circumflex accent.
\"{u}Umlaut/dieresis.
\~{n}Tilde accent, as in Spanish n-tilde.
\c{c}Cedilla, as in French c-cedilla.
\v{s}Caron (hacek), common in Czech and Croatian names.
\H{o}Hungarian double acute accent.
\k{a}Ogonek, as in Polish a-ogonek.
\b{o}Bar-under accent.
\d{u}Dot-under accent, used in transliteration.
\r{a}Ring accent, as in Scandinavian a-ring.
\u{o}Breve accent.
\.{o}Dot-over accent.
\t{oo}Tie accent joining two letters.
\i, \jDotless i and j, for stacking accents: \'{\i}.
\ae, \AEThe ae ligature, lowercase and uppercase.
\oe, \OEThe oe ligature, as in French oeuvre.
\ssGerman sharp s (eszett).
\o, \OSlashed o, as in Danish and Norwegian names.
\l, \LPolish slashed l.
\aa, \AAA-ring as a standalone letter, as in Angstrom’s name.

Fonts and sizes

CommandWhat it does
\textbf{...}Bold text.
\textit{...}Italic text.
\emph{...}Emphasis that adapts to context: italic in upright text, upright in italic text.
\textsc{...}Small caps text.
\texttt{...}Typewriter (monospace) text, good for code and filenames.
\textrm{...}Roman (serif) family text.
\textsf{...}Sans-serif family text.
\textmd{...}Medium (normal) weight, undoing bold.
\textup{...}Upright shape, undoing italic or slanted.
\textsl{...}Slanted (oblique) shape, distinct from true italic.
\textnormal{...}Resets to the document’s default font in one step.
\underline{...}Underlines text; use sparingly, emphasis is usually \emph.
\rmfamily, \sffamily, \ttfamilyDeclarations switching the font family (serif, sans, mono) until the group ends.
\bfseries, \mdseriesDeclarations switching to bold or back to medium weight.
\itshape, \slshape, \scshape, \upshapeDeclarations switching shape: italic, slanted, small caps, upright.
\normalfontDeclaration resetting family, series, and shape to the defaults.
\emDeclaration form of \emph: {\em like this}.
\tinySmallest of the ten size commands.
\scriptsizeSecond smallest size, roughly subscript sized.
\footnotesizeThe size used for footnotes.
\smallSlightly smaller than normal.
\normalsizeThe document’s base size.
\large, \Large, \LARGEOne, two, and three steps larger than normal.
\huge, \HugeThe two largest standard sizes.
\fontsize{14}{17}\selectfontSets an arbitrary font size and baseline skip, then activates it.
\selectfontActivates pending font attribute changes (NFSS).
\textsuperscript{...}Raised small text, as in 1st or footnote-style markers.
\textsubscript{...}Lowered small text in text mode.
\familydefaultMacro holding the default font family; renew it to change the whole document’s font.
\sfdefaultMacro naming the sans-serif family; \renewcommand{\familydefault}{\sfdefault} makes the document sans.
\setmainfont{...}Sets the main body font by name under XeLaTeX or LuaLaTeX (fontspec).
\setsansfont{...}Sets the sans-serif font by name under XeLaTeX or LuaLaTeX (fontspec).
\setmonofont{...}Sets the monospace font by name under XeLaTeX or LuaLaTeX (fontspec).

Color (xcolor)

CommandWhat it does
\textcolor{red}{...}Colors a piece of text.
\color{blue}Declaration form: colors everything until the group ends.
\definecolor{brand}{HTML}{2F6F4F}Defines a named color for later use.
\pagecolor{gray!10}Sets the background color of the whole page.
\rowcolor{gray!20}Colors one table row (xcolor with the table option, via colortbl).
\cellcolor{gray!20}Colors one table cell (colortbl).
\rowcolors{2}{gray!10}{white}Alternating row colors starting at a given row (xcolor table option).

Graphics (graphicx)

CommandWhat it does
\includegraphics[width=\linewidth]{plot.pdf}Inserts an image file; key options: width, height, scale, angle, trim+clip, page.
\graphicspath{{figures/}}Tells LaTeX which folders to search for image files.
\rotatebox[origin=c]{90}{...}Rotates its contents by an angle.
\scalebox{0.8}{...}Scales its contents by a factor.
\resizebox{5cm}{!}{...}Resizes contents to a target width and/or height; ! keeps the aspect ratio.
\reflectbox{...}Mirrors its contents horizontally.
\includepdf[pages=-]{paper.pdf}Inserts whole pages from another PDF (pdfpages).

Entering math mode

CommandWhat it does
$...$Inline math within a sentence.
\(...\)LaTeX’s official inline math delimiters, equivalent to $...$.
\[...\]Unnumbered displayed equation on its own line.
$$...$$Plain TeX display math; discouraged in LaTeX, use \[...\] instead.
x^2, x_i^ makes superscripts and _ makes subscripts; brace multi-character scripts: x^{10}.

Math: Greek letters

All of these work only in math mode. Uppercase forms exist where the Greek capital differs from the Latin one.

CommandWhat it does
\alpha \beta \gamma \deltaGreek letters alpha, beta, gamma, delta.
\epsilon \zeta \eta \thetaGreek letters epsilon, zeta, eta, theta.
\iota \kappa \lambda \mu \nuGreek letters iota, kappa, lambda, mu, nu.
\xi \pi \rho \sigma \tauGreek letters xi, pi, rho, sigma, tau.
\upsilon \phi \chi \psi \omegaGreek letters upsilon, phi, chi, psi, omega.
\Gamma \Delta \Theta \Lambda \Xi \PiUppercase Greek letters Gamma through Pi.
\Sigma \Upsilon \Phi \Psi \OmegaUppercase Greek letters Sigma through Omega.
\varepsilon \vartheta \varpiVariant forms of epsilon (the curly one most papers use), theta, and pi.
\varrho \varsigma \varphiVariant forms of rho, sigma (word-final), and phi (open curly).
\varGamma \varDelta \varTheta \varLambdaItalic uppercase Greek variants (amsmath).
\varXi \varPi \varSigma \varUpsilon \varPhi \varPsi \varOmegaThe remaining italic uppercase Greek variants (amsmath).

Math: binary operators

CommandWhat it does
\pm, \mpPlus-minus and minus-plus signs.
\timesMultiplication cross, also used for dimensions like 3 x 3.
\divDivision (obelus) sign.
\cdotCentered dot for multiplication.
\ast, \star, \bullet, \circAsterisk, star, bullet, and small-circle operators; \circ is also function composition.
\oplus, \ominusCircled plus (direct sum, XOR) and circled minus.
\otimes, \oslash, \odotCircled times (tensor product), circled slash, circled dot.
\wedge, \veeWedge (logical AND, exterior product) and vee (logical OR, join).
\land, \lorAliases of \wedge and \vee named for their logical reading.
\cap, \cupSet intersection and union signs.
\setminusSet difference backslash: A \setminus B.
\uplusUnion with a plus, for multiset or disjoint union.
\sqcap, \sqcupSquare cap and cup, meet and join in lattice theory.
\amalgAmalgamation (upside-down product), used for coproducts.
\dagger, \ddaggerDagger and double dagger as math operators, e.g. conjugate transpose A^\dagger.
\bigtriangleup, \bigtriangledownTriangle operators, e.g. symmetric difference.
\triangleleft, \trianglerightSideways triangles, e.g. normal subgroup relation.

Math: relations

CommandWhat it does
\leq, \leLess-than-or-equal sign (\le is the short alias).
\geq, \geGreater-than-or-equal sign (\ge is the short alias).
\neq, \neNot-equal sign (\ne is the short alias).
\ll, \ggMuch-less-than and much-greater-than signs.
\approxApproximately-equal sign.
\simTilde relation, read as ‘is distributed as’ or ‘is similar to’.
\simeqAsymptotically-equal sign (tilde over equals).
\congCongruent-to sign (tilde over two bars), used for isomorphism.
\equivIdentical-to (triple bar) sign, also used for congruence.
\proptoProportional-to sign.
\asympAsymptotically-equivalent relation (stacked curves).
\doteqEquals sign with a dot, read as ‘approaches’ or ‘is defined as’.
\prec, \succPrecedes and succeeds relations, curved orderings.
\preceq, \succeqPrecedes-or-equals and succeeds-or-equals.
\subset, \subseteqProper subset and subset-or-equal signs.
\supset, \supseteqProper superset and superset-or-equal signs.
\sqsubseteq, \sqsupseteqSquare subset and superset relations, used for information order.
\in, \notinSet membership and its negation: x \in A.
\niReversed membership: the set contains the element.
\vdash, \dashvTurnstile ‘proves’ and its reverse.
\modelsDouble turnstile, semantic entailment.
\perpPerpendicular / independence relation.
\parallelParallel bars relation.
\midVertical bar with relation spacing, as in set-builder notation or ‘divides’.
\notNegates the following relation by overprinting a slash: \not\subset.

Math: arrows

CommandWhat it does
\to, \rightarrowRight arrow, as in function types f: A \to B and limits x \to 0.
\gets, \leftarrowLeft arrow, also used for assignment in pseudocode.
\leftrightarrowTwo-headed single arrow.
\RightarrowDouble right arrow, read as ‘implies’.
\LeftarrowDouble left arrow, read as ‘is implied by’.
\LeftrightarrowDouble two-headed arrow, read as ‘if and only if’.
\implies, \impliedbySpaced-out \Rightarrow and \Leftarrow for logic (amsmath).
\iffSpaced-out \Leftrightarrow for ‘if and only if’.
\mapstoMaps-to arrow with a bar tail: x \mapsto x^2.
\longmapstoLong version of \mapsto.
\hookrightarrowRight arrow with a hook tail, for inclusions/embeddings.
\rightharpoonupRight harpoon (half-arrow), used for weak convergence.
\rightleftharpoonsPaired opposing harpoons, as in chemical equilibrium.
\leadstoSquiggly right arrow, ‘leads to’ (amssymb).
\uparrow, \downarrowUpward and downward arrows.
\updownarrowDouble-headed vertical arrow.
\Uparrow, \Downarrow, \UpdownarrowDouble-lined vertical arrows.
\nearrow, \searrowDiagonal arrows northeast and southeast, e.g. increasing/decreasing to a limit.
\swarrow, \nwarrowDiagonal arrows southwest and northwest.
\longrightarrow, \longleftarrowLong single arrows.
\Longrightarrow, \Longleftarrow, \LongleftrightarrowLong double arrows.
\xrightarrow{f}Extensible right arrow with a label on top, growing to fit (amsmath).
\xleftarrow{f}Extensible left arrow with a label on top (amsmath).

Math: big operators

CommandWhat it does
\sum_{i=1}^{n}Summation sign with limits.
\prod_{i=1}^{n}Product sign with limits.
\coprodCoproduct (upside-down product) sign.
\int_0^1Integral sign with bounds.
\iintDouble integral sign (amsmath).
\iiintTriple integral sign (amsmath).
\ointContour (closed loop) integral sign.
\bigcap, \bigcupBig intersection and union over a family of sets.
\bigsqcupBig square-cup (disjoint union).
\bigvee, \bigwedgeBig OR and big AND over an index set.
\bigoplus, \bigotimes, \bigodotBig circled plus, times, and dot for indexed sums and products of structures.
\biguplusBig union-with-plus over an index set.
\limitsForces the following operator’s sub/superscripts above and below: \int\limits_0^1.
\nolimitsForces sub/superscripts to the side instead of above and below.

Math: delimiters and sizing

CommandWhat it does
\left( ... \right)Auto-sized delimiter pair that grows to fit its contents.
\left. and \right.Invisible partner when only one side of a sized pair is wanted, as in evaluation bars.
`\middle`
\big( \Big( \bigg( \Bigg(Manually sized delimiters, from slightly big to very big.
\bigl(...\bigr)Sized delimiters with correct open/close spacing (also \Bigl, \biggl, \Biggl).
\lfloor, \rfloorFloor brackets.
\lceil, \rceilCeiling brackets.
\langle, \rangleLeft and right angle bracket delimiters.
|Double vertical bar delimiter (norm bars).
\lvert, \rvertAbsolute-value bars with correct delimiter spacing (amsmath).
\lVert, \rVertDouble bars for norms, with correct delimiter spacing (amsmath).
\backslashBackslash as a math symbol or delimiter.

Math: accents and decorations

CommandWhat it does
\hat{x}Small hat accent over one symbol.
\check{x}Caron (inverted hat) accent.
\breve{x}Breve (rounded) accent.
\acute{x}, \grave{x}Acute and grave accents in math.
\tilde{x}Tilde accent over one symbol.
\bar{x}Short bar over one symbol.
\vec{v}Small arrow over one symbol.
\dot{x}, \ddot{x}One or two dots over a symbol, common for time derivatives.
\dddot{x}Three dots over a symbol (amsmath).
\mathring{x}Ring accent over a symbol.
\widehat{abc}Wide hat that stretches over several symbols.
\widetilde{abc}Wide tilde that stretches over several symbols.
\overrightarrow{AB}Stretching right arrow over an expression, as in vectors from A to B.
\overleftarrow{AB}Stretching left arrow over an expression.
\overline{x + y}Line over a whole expression.
\underline{x + y}Line under a whole expression (also works in text).
\overbrace{...}^{n}Horizontal brace above an expression, with an optional label on top.
\underbrace{...}_{n}Horizontal brace below an expression, with an optional label underneath.
\overset{!}{=}Places a symbol above another, e.g. ‘must equal’ (amsmath).
\underset{i}{\max}Places a symbol below another (amsmath).
\stackrel{\text{def}}{=}Older kernel command stacking a symbol over a relation.
\boldsymbol{\beta}Bold math that also bolds Greek letters and symbols (amsmath).
\primePrime symbol; x' is the usual shorthand for x^{\prime}.

Math: log-like operators

All typeset upright with correct spacing; the limit-taking ones put subscripts below in display math.

CommandWhat it does
\sin, \cos, \tan, \cotThe basic trigonometric functions.
\sec, \cscSecant and cosecant.
\arcsin, \arccos, \arctanInverse trigonometric functions.
\sinh, \cosh, \tanh, \cothHyperbolic functions.
\exp, \ln, \log, \lgExponential and logarithms (\lg is log base 2 or 10 by convention).
\det, \dim, \ker, \degDeterminant, dimension, kernel, degree.
\gcd, \hom, \arg, \PrGreatest common divisor, hom-sets, complex argument, probability.
\lim_{x \to 0}Limit operator, upright with the subscript below in display math.
\limsup, \liminfLimit superior and inferior.
\inf, \supInfimum and supremum operators, typeset upright.
\min, \maxMinimum and maximum operators, typeset upright with limits below in display math.
\bmodBinary mod operator with operator spacing: a \bmod n.
\pmod{n}Parenthesized trailing ‘(mod n)’.
\mod{n}Trailing ‘mod n’ without parentheses (amsmath).
\operatorname{lcm}One-off upright operator name without a preamble declaration (amsmath).
\operatorname*{ess\,sup}One-off operator that takes limits below (amsmath).

Math: fractions, binomials, and stacking

CommandWhat it does
\frac{a}{b}Stacked fraction: numerator over denominator.
\dfrac{a}{b}Fraction forced to full display size, even inline (amsmath).
\tfrac{a}{b}Fraction forced to small inline size, even in display math (amsmath).
\cfrac{a}{b}Continued fraction with full-size nested levels (amsmath).
\sqrt{x}, \sqrt[3]{x}Square root; the optional argument gives an nth root.
\binom{n}{k}Binomial coefficient in parentheses (amsmath).
\dbinom{n}{k}, \tbinom{n}{k}Display-size and text-size forced binomials (amsmath).
{n \choose k}Plain TeX binomial primitive; discouraged in LaTeX, use \binom.
{a \over b}Plain TeX fraction primitive; discouraged in LaTeX, use \frac.
{a \atop b}Plain TeX stacking primitive without a bar; discouraged, use \substack or \genfrac.
\genfrac{(}{)}{0pt}{}{a}{b}General fraction builder behind \frac, \binom, and friends (amsmath).
\substack{i < n \\ j < m}Multi-line subscript under a big operator (amsmath).
\sideset{_a^b}{_c^d}{\prod}Attaches indices to all four corners of a big operator (amsmath).
\prescript{a}{b}{X}Left-hand super/subscripts, as in isotope notation (mathtools).

Math: spacing and styles

CommandWhat it does
\,Thin math space, as between a number and its unit.
\:Medium math space.
\;Thick math space.
\!Negative thin space, pulling symbols closer.
\quad, \qquadOne-em and two-em spaces, in math or text.
\displaystyleForces full display-math sizing, e.g. big limits inside inline math.
\textstyleForces inline-math sizing inside display math.
\scriptstyle, \scriptscriptstyleForce subscript and sub-subscript sizing.

Math: letters, alphabets, and misc symbols

CommandWhat it does
\mathbb{R}Blackboard bold letters for number sets (amssymb).
\mathbf{x}Bold upright letters in math, common for vectors and matrices.
\mathcal{L}Calligraphic capital letters, e.g. a loss or Lagrangian.
\mathfrak{g}Fraktur letters, used in algebra and logic.
\mathscr{F}Script capital letters, curlier than \mathcal (mathrsfs).
\mathrm{d}xUpright (roman) letters in math, for units and multi-letter names.
\mathit{diff}Italic multi-letter identifier with word-like spacing.
\mathsf{T}, \mathtt{x}Sans-serif and typewriter letters in math.
\bm{\beta}Bold math symbols, an alternative to \boldsymbol (bm package).
\text{if } x > 0Normal upright text inside math with proper spacing (amsmath).
\inftyInfinity sign.
\partialPartial derivative (curly d) sign.
\nablaNabla (del) operator for gradients and divergence.
\hbarReduced Planck constant, h with a bar.
\ellScript lowercase l, used to avoid confusion with the digit 1.
\wpWeierstrass p.
\Re, \ImReal and imaginary part symbols (Fraktur R and I).
\alephAleph, for infinite cardinals.
\emptysetEmpty set sign.
\varnothingRounder empty-set variant many authors prefer (amssymb).
\angleAngle symbol.
\measuredangleMeasured-angle symbol with an arc (amssymb).
\triangleTriangle symbol.
\square, \blacksquareOpen and filled squares; the filled one often ends proofs (amssymb).
\diamond, \lozengeSmall diamond operator; lozenge symbol (amssymb for the latter).
\top, \botTop (true) and bottom (false/undefined) symbols.
\forall, \existsUniversal (‘for all’) and existential (‘there exists’) quantifiers.
\nexistsNegated existential quantifier (amssymb).
\negLogical NOT sign.
\therefore, \becauseThree-dot ‘therefore’ and ‘because’ signs (amssymb).
\flat, \natural, \sharpMusical accidentals, also used in math notation.
\surdBare radical symbol without an argument.
\checkmarkCheck mark (amssymb).
\cdotsCentered dots, between operators: x_1 + \cdots + x_n.
\vdots, \ddotsVertical and diagonal dots, mostly in matrices.
\dotsb, \dotscSemantic dots: between binary operators, and between commas (amsmath).

amsmath and mathtools display tools

CommandWhat it does
\tag{...}Replaces the automatic equation number with your own label (amsmath).
\tag*{...}Like \tag but without the surrounding parentheses (amsmath).
\notagSuppresses the equation number on one line of a numbered environment (amsmath).
\nonumberOlder synonym of \notag.
\numberwithin{equation}{section}Numbers equations per section: (2.1), (2.2) (amsmath).
\intertext{...}Interrupts an align block with a full-width line of text, keeping alignment (amsmath).
\shortintertext{...}Like \intertext with less vertical space (mathtools).
\allowdisplaybreaksLets multi-line displays break across pages (amsmath).
\displaybreakRequests a page break at this point of a display (amsmath).
\smashoperator{\sum_{i=1}^{n}}Lets wide operator limits overhang so they do not push content apart (mathtools).
\mathclap{...}Zero-width math content, for wide under/overscripts (mathtools).
\coloneqqColon-equals definition sign := with correct spacing (mathtools).
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}Defines a delimiter macro with a starred auto-sizing form (mathtools).
\eqref{eq:loss}Prints an equation number with its parentheses (amsmath).
\qedhereMoves the end-of-proof square onto the current line, e.g. after a displayed equation (amsthm).

Math environments

EnvironmentWhat it does
equationOne displayed, numbered equation.
equation*One displayed, unnumbered equation (amsmath).
alignMultiple displayed equations aligned at & marks, each numbered (amsmath).
align*Aligned equations without numbers (amsmath).
gatherMultiple centered equations without alignment, each numbered (amsmath).
alignatAligned equations with manually controlled spacing between columns (amsmath).
flalignAligned equations pushed to the left and right margins (amsmath).
splitSplits one long equation across aligned lines under a single number, inside equation (amsmath).
multlineOne long equation broken across lines: first line left, last line right (amsmath).
aligned, gatheredBuilding-block versions of align/gather usable inside another display (amsmath).
subequationsNumbers the equations inside as 1a, 1b, 1c (amsmath).
casesBrace-grouped case distinctions, as in piecewise functions (amsmath).
dcasescases with display-style entries so fractions stay full size (mathtools).
matrixBare matrix with no delimiters (amsmath).
pmatrixMatrix wrapped in parentheses (amsmath).
bmatrixMatrix wrapped in square brackets (amsmath).
BmatrixMatrix wrapped in curly braces (amsmath).
vmatrixMatrix wrapped in vertical bars, standard determinant notation (amsmath).
VmatrixMatrix wrapped in double bars (amsmath).
smallmatrixCompact matrix sized for inline use (amsmath).
arrayMath-mode grid with per-column alignment, the math cousin of tabular.
eqnarrayOld three-column equation environment; discouraged, its spacing is wrong, use align.
CommandWhat it does
\label{fig:setup}Names a spot (equation, figure, section) so you can refer to it.
\ref{fig:setup}Prints the number of a labeled item.
\pageref{fig:setup}Prints the page number where the label lives.
\cref{fig:setup}Prints the number AND its type name automatically: ‘fig. 1’ (cleveref).
\Cref{fig:setup}Capitalized \cref for the start of a sentence: ‘Figure 1’ (cleveref).
\crefrange{eq:a}{eq:d}Prints a range: ‘eqs. 1 to 4’ (cleveref).
\labelcref{fig:setup}Prints just the label number in cleveref style, without the type name (cleveref).
\vref{fig:setup}Reference plus an automatic ‘on the next page’ phrase when needed (varioref).
\autoref{fig:setup}hyperref’s typed reference: ‘Figure 1’, with the whole phrase linked.
\nameref{sec:intro}Prints the title text of the referenced section (hyperref).
\href{https://example.com}{link text}Makes a clickable link with custom text (hyperref).
\url{https://example.com}Typesets a URL in typewriter type and makes it clickable.
\hyperref[sec:intro]{that section}Makes arbitrary text link to a label (hyperref).
\hypertarget{spot}{...}Creates a named link target anywhere in the document (hyperref).
\hyperlink{spot}{text}Links to a \hypertarget (hyperref).
\phantomsectionCreates an anchor so links to unnumbered headings land in the right place (hyperref).
\texorpdfstring{$\alpha$}{alpha}Gives a plain-text alternative for math in headings so PDF bookmarks stay valid (hyperref).
\pdfbookmark[1]{Title}{name}Adds a manual PDF bookmark entry (hyperref).

Citations and bibliography

CommandWhat it does
\cite{knuth1984}Cites a bibliography entry by key.
\nocite{key}Adds an entry to the bibliography without citing it in the text; \nocite{*} adds everything.
\citep{knuth1984}Parenthetical citation ‘(Knuth, 1984)’ in natbib author-year style.
\citet{knuth1984}Textual citation ‘Knuth (1984)’ in natbib author-year style.
\citeauthor{knuth1984}Prints just the author names (natbib and biblatex).
\citeyear{knuth1984}Prints just the year (natbib and biblatex).
\citealp{knuth1984}natbib parenthetical citation without the parentheses, for building your own.
\citealt{knuth1984}natbib textual citation without parentheses around the year.
\parencite{knuth1984}biblatex’s parenthetical citation, the analogue of \citep.
\textcite{knuth1984}biblatex’s textual citation, the analogue of \citet.
\autocite{knuth1984}biblatex citation that follows the style’s preferred form (parenthetical, footnote, etc.).
\footcite{knuth1984}biblatex citation placed in a footnote.
\fullcite{knuth1984}Prints the entry’s full bibliography text inline (biblatex).
\citetitle{knuth1984}Prints the work’s title (biblatex).
\bibliography{refs}BibTeX: prints the reference list from a .bib file.
\bibliographystyle{plainnat}BibTeX: picks the reference format; classic styles include plain, unsrt, alpha, abbrv, ieeetr, acm, apalike.
\addbibresource{refs.bib}biblatex: registers a .bib file in the preamble.
\printbibliographybiblatex: prints the reference list where you place it.
\bibitem{key}One hand-written entry inside a thebibliography environment.
thebibliography (environment)Hand-written reference list used when you skip BibTeX entirely.

Floats, figures, and tables

Command or environmentWhat it does
figure (environment)Floating container for an image plus caption; LaTeX picks the final position.
figure* (environment)Figure spanning both columns in a two-column document.
table (environment)Floating container for a tabular plus caption; LaTeX picks the final position.
table* (environment)Table spanning both columns in a two-column document.
\begin{figure}[htbp]Placement hints: here, top, bottom, own page; ! relaxes rules, [H] (float package) means exactly here.
tabular (environment)The actual grid of rows and columns: cells split by &, rows end with \\.
tabular* (environment)Tabular stretched to a specified total width.
tabularx (environment)Fixed-width table whose X columns share the leftover space (tabularx).
array (environment)Math-mode grid with per-column alignment.
longtable (environment)Table that can break across pages, with repeating headers (longtable).
minipage (environment)Fixed-width mini page inside the page, used to place content side by side.
subfigure (environment)One sub-panel with its own caption, like (a) and (b), inside a figure (subcaption).
wrapfigure (environment)Figure with body text wrapping around it (wrapfig).
sidewaysfigure, sidewaystable (environments)Floats rotated 90 degrees onto their own page (rotating).
landscape (environment)Rotates whole pages to landscape, with the PDF page auto-rotated (pdflscape).
threeparttable (environment)Wraps a table so footnotes align with the table width (threeparttable).
tablenotes (environment)The notes list under a threeparttable, marked with \tnote{a}.
adjustbox (environment and \adjustbox)Scales, resizes, or crops any content with key-value options (adjustbox).
\caption{...}Adds a numbered caption to a figure or table; put \label after it.
\caption*{...}Caption without a number or list entry (caption package).
\captionsetup{...}Configures caption fonts, labels, and spacing (caption package).
\topruleHeavy rule at the top of a booktabs table.
\midruleMedium rule between a booktabs table’s header and body.
\bottomruleHeavy rule at the bottom of a booktabs table.
\cmidrule(lr){2-3}Partial rule spanning selected columns (booktabs).
\addlinespaceSmall extra vertical space between booktabs rows, instead of a rule.
\hlineFull-width horizontal line in a plain tabular; booktabs rules usually look better.
\cline{2-3}Horizontal line spanning selected columns in a plain tabular.
\vlineVertical line at this point of a table row; column `
\multicolumn{2}{c}{Header}Merges cells across columns in one row.
\multirow{2}{*}{Label}Merges cells vertically across rows (multirow).
\arraystretchFactor for table row height; set with \renewcommand{\arraystretch}{1.3}.
\tabcolsepLength of the padding on each side of a tabular column.
\newcolumntype{C}{>{\centering\arraybackslash}X}Defines a reusable column specifier (array package).
\endfirstheadlongtable: marks the end of the header shown on the first page only.
\endheadlongtable: marks the end of the header repeated on every following page.
\endfootlongtable: marks the end of the footer shown at each page break.
\endlastfootlongtable: marks the end of the footer shown only at the very end.
\FloatBarrierStops floats drifting past this point (placeins).

Footnotes

CommandWhat it does
\footnote{...}Puts a note at the bottom of the page, marked with an automatic number.
\footnotemarkPrints just the footnote marker, for places where \footnote is not allowed.
\footnotetext{...}Supplies the text for an earlier \footnotemark.

Theorems and proofs

Command or environmentWhat it does
\newtheorem{lemma}{Lemma}Declares a theorem-like environment (amsthm).
\newtheorem*{remark}{Remark}Declares an unnumbered theorem-like environment (amsthm).
\theoremstyle{definition}Sets the look (plain, definition, remark) for following \newtheorem declarations (amsthm).
theorem (environment)Numbered theorem block, created by \newtheorem{theorem}{Theorem}.
proof (environment)Proof block that prints ‘Proof.’ and ends with the QED square (amsthm).

Verbatim, code, and listings

Command or environmentWhat it does
`\verbcode
verbatim (environment)Block of text printed exactly as typed, in typewriter font.
\verbatiminput{file.txt}Prints a whole file verbatim (verbatim package).
lstlisting (environment)Source code listing with optional syntax highlighting (listings).
`\lstinlinecode
\lstset{language=Python}Configures listings defaults: language, numbering, colors (listings).
\lstinputlisting{script.py}Typesets a whole source file as a listing (listings).
minted (environment)Pygments-powered highlighted code blocks; needs -shell-escape at compile time (minted).
`\mintinline{python}code

Beamer (slides)

Command or environmentWhat it does
frame (environment)One Beamer slide: \begin{frame}{Slide title} ... \end{frame}.
\frame{...}Beamer’s one-command slide form; the frame environment is the usual way.
\frametitle{...}Sets the slide title from inside a frame.
\framesubtitle{...}Sets a smaller subtitle under the frame title.
\titlepageBeamer: inside a frame, prints the title slide from your title metadata.
\tableofcontents[currentsection]Outline slide highlighting the section you are in.
\pauseBeamer: reveals the rest of the frame on the next slide step.
\onslide<2->Content appears from a given overlay step onward.
\only<2>{...}Content exists only on the given steps and takes no space elsewhere.
\uncover<2->{...}Content is invisible before its step but always reserves its space.
\visible<2->{...}, \invisible<2>{...}Show or hide content on given steps without changing layout.
\alert{...}Highlights text in the theme’s alert color, usually red.
block (environment)Titled box in the theme’s standard color.
alertblock (environment)Titled box in the alert color, for warnings or key points.
exampleblock (environment)Titled box in the example color, usually green.
columns (environment) and \column{0.5\textwidth}Side-by-side layout regions on a slide.
\usetheme{Madrid}Beamer: picks the presentation theme in the preamble.
\usecolortheme{seahorse}Swaps only the color palette of the theme.
\usefonttheme{serif}Swaps only the font choices of the theme.
\setbeamertemplate{navigation symbols}{}Overrides one theme element, here removing the navigation icons.
\setbeamercolor{title}{fg=black}Overrides one theme color.
\note{...}Speaker notes attached to a frame, shown only in notes output.

TikZ and diagrams

Command or environmentWhat it does
tikzpicture (environment)Canvas for TikZ drawings; all \draw and \node commands go inside it.
\tikzOne-shot inline picture: \tikz \draw (0,0) circle (2pt);.
\draw (0,0) -- (1,1);TikZ path command that draws lines and shapes; options like [thick, red, ->] style it.
\fillTikZ path command that fills a shape instead of stroking it.
\filldrawTikZ path command that both fills and outlines a shape.
\shadeTikZ path command that fills with a gradient.
\clipTikZ path that restricts all later drawing to its interior.
\pathTikZ path that computes coordinates without drawing, e.g. for placing nodes.
\node at (0,0) {label};TikZ command that places text or shapes at coordinates.
\coordinate (a) at (1,2);Names a point for reuse in later paths.
\foreach \i in {1,...,5}Loop that repeats drawing code over a list (TikZ/pgffor).
\tikzset{mystyle/.style={...}}Defines reusable TikZ styles the modern way.
\tikzstyleOld style-definition syntax; deprecated, use \tikzset.
\usetikzlibrary{positioning}Loads extra TikZ features in the preamble.
\matrix (TikZ)Grid-aligned arrangement of nodes inside a tikzpicture.
tikzcd (environment)Grid for commutative diagrams; cells split by & (tikz-cd).
\arrow[r, "f"]Draws an arrow between cells in a tikz-cd commutative diagram.

Units (siunitx)

CommandWhat it does
\num{12345.678}Formats a number with proper digit grouping and decimal markers.
\qty{9.8}{\metre\per\second\squared}Number with unit, correctly spaced (siunitx v3 name).
\unit{\kilo\gram}Unit alone (siunitx v3 name).
\SI{9.8}{\metre\per\second\squared}v2 name of \qty; still widely seen in papers.
\si{\kilo\gram}v2 name of \unit.
\sisetup{...}Global siunitx configuration.
\DeclareSIUnit{\parsec}{pc}Defines a custom unit (siunitx).

Glossaries and acronyms

CommandWhat it does
\gls{svm}Prints a glossary or acronym entry, expanding it on first use (glossaries).
\Gls{svm}Capitalized form for sentence starts (glossaries).
\glspl{svm}Plural form of the entry (glossaries).
\newglossaryentry{tree}{name=tree, description={...}}Declares a glossary term (glossaries).
\newacronym{svm}{SVM}{support vector machine}Declares an acronym with short and long forms (glossaries).
\acrshort{svm}, \acrlong{svm}Force the short or long form regardless of first use (glossaries).
\makeglossariesPreamble command that activates glossary/acronym processing (glossaries).
\printglossaryPrints one glossary list where you place it (glossaries).
\printglossariesPrints the glossary and acronym lists where you place it (glossaries).

Algorithms and pseudocode

Keyword commands are from algpseudocode (algorithmicx); the algorithm float wraps them.

Command or environmentWhat it does
algorithm (environment)Floating container for pseudocode, with a caption and number (algorithm).
algorithmic (environment)The pseudocode body itself, holding the keyword commands (algpseudocode).
\StateOne statement line of pseudocode.
\If{...}, \ElsIf{...}, \Else, \EndIfConditional block keywords.
\For{...}, \ForAll{...}, \EndForLoop keywords over a range or a set.
\While{...}, \EndWhileWhile-loop keywords.
\Function{Name}{args}, \EndFunctionFunction definition block.
\Procedure{Name}{args}, \EndProcedureProcedure definition block.
\ReturnThe return keyword.
\Comment{...}Right-aligned comment on a pseudocode line.
\Require, \EnsurePreconditions and postconditions lines at the top of an algorithm.

Language, quoting, and editorial packages

CommandWhat it does
\selectlanguage{german}Switches the active language: hyphenation, captions, dates (babel).
\foreignlanguage{french}{...}Typesets a short passage under another language’s rules (babel).
\enquote{...}Context-aware quotation marks that nest and localize correctly (csquotes).
\todo{Fix this}Margin note flagging work to do (todonotes).
\listoftodosPrints a list of all todo notes (todonotes).
\missingfigure{...}Placeholder box for a figure you have not made yet (todonotes).
\xspaceAt the end of a macro, adds a space unless punctuation follows (xspace).
\patchcmd{\cmd}{find}{replace}{ok}{fail}Patches an existing macro’s definition in place (etoolbox).
\apptocmd, \pretocmdAppend or prepend code to an existing macro (etoolbox).
\newtoggle{draft}, \toggletrue{draft}, \iftoggle{draft}{...}{...}Lightweight boolean flags (etoolbox).

Layout and typography packages in one line

Package or commandWhat it does
\setstretch{1.25}Sets an exact line-spacing factor (setspace).
\doublespacingSwitches to double line spacing (setspace).
\onehalfspacingSwitches to one-and-a-half line spacing (setspace).
\singlespacingSwitches back to single line spacing (setspace).
spacing (environment)Sets a custom line-spacing factor for its contents (setspace).
\titleformat{\section}{...}{...}{...}{...}Redesigns how a sectioning heading looks (titlesec).
\titlespacing{\section}{0pt}{12pt}{6pt}Adjusts the space around a heading (titlesec).
\setlist[itemize]{noitemsep}Configures list spacing and labels globally or per level (enumitem).
parskip (package)Switches the document to block paragraphs: space between, no indent.
microtype (package)Subtle protrusion and expansion that improves justification; just load it.
multicols (environment)Balanced multi-column text without the twocolumn class option (multicol).

Chemistry, physics, and domain notation

CommandWhat it does
\ce{H2O}Typesets a chemical formula or reaction (mhchem).
\chemfig{...}Draws a chemical structure diagram (chemfig).
`\braket{\phi\psi}`

Publisher class commands

Command or environmentWhat it does
\IEEEauthorblockN{...}IEEEtran: formats an author name block in the IEEE conference title area.
\IEEEauthorblockA{...}IEEEtran: formats an author affiliation block in the IEEE conference title area.
\ccsdesc[500]{...}acmart: declares one ACM CCS concept for the paper’s classification.
CCSXML (environment)acmart: holds the machine-readable ACM CCS concepts XML from the ACM classification tool.
\University{...}Class-specific metadata command seen in thesis templates, not standard LaTeX.

Environments in general

An environment is a region opened with \begin{name} and closed with \end{name}; everything between the two gets that environment’s behavior. The full story is in commands vs environments. The general-purpose ones:

EnvironmentWhat it does
documentThe body of every document lives between \begin{document} and \end{document}.
abstractPrints the paper’s abstract with the class’s standard heading and layout.
titlepageWraps a hand-made full title page; the page is unnumbered.
centerCenters its contents horizontally.
flushleftLeft-aligns its contents, ragged right.
flushrightRight-aligns its contents, ragged left.
itemizeBulleted list; each entry starts with \item.
enumerateNumbered list; each entry starts with \item.
descriptionLabeled list; entries start with \item[Label].
\itemStarts one entry inside itemize, enumerate, or description lists.
quoteIndented block for short quotations, no paragraph indent.
quotationIndented block for longer quotations, with paragraph indents.
verseIndented block for poetry, where \\ ends each verse line.
sloppyparParagraphs typeset with relaxed line-breaking, the environment form of \sloppy.
listThe general list builder that itemize and friends are defined from.
trivlistBare-bones list with no labels or margins, used inside macro definitions.
filecontentsWrites its body out to a file at compile time, e.g. to ship a .bib inside the .tex.
appendicesWraps the appendix chapters, enabling \appendixpage and per-appendix tools (appendix package).

Where to go next

This page is the dictionary. The lessons are the grammar. For a paste-ready one-pager, keep the cheatsheet open. For the difference between \command{...} and \begin{...} blocks, read commands vs environments. For a symbol you can picture but cannot name, use math symbols. To see what any math-mode command looks like, paste it into the live preview and watch it render.

Back to Desk reference