This reference provides a comprehensive guide to LaTeX commands organized by category. Each command includes syntax, options, and practical examples.

Quick tip: Use Ctrl/Cmd + F to search for specific commands. Commands are organized alphabetically within each category.

Document Structure Commands

Document Class and Packages

% Document class
\documentclass[options]{class}
\documentclass[12pt,a4paper]{article}
\documentclass[11pt,twoside]{report}
\documentclass[letterpaper,draft]{book}

% Package loading
\usepackage[options]{package}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}

Sectioning Commands

CommandLevelNumberedExample
\part{}-1Yes\part{Part Title}
\chapter{}0Yes\chapter{Chapter Title}
\section{}1Yes\section{Section Title}
\subsection{}2Yes\subsection{Subsection}
\subsubsection{}3Yes\subsubsection{Subsubsection}
\paragraph{}4No*\paragraph{Paragraph}
\subparagraph{}5No*\subparagraph{Subparagraph}

*Can be numbered by adjusting secnumdepth

% Unnumbered sections
\section*{Introduction}
\subsection*{Background}

% With short title for TOC
\section[Short Title]{Long Descriptive Title for the Document}

% Adjusting numbering depth
\setcounter{secnumdepth}{3} % Number up to subsubsection
\setcounter{tocdepth}{2}    % TOC up to subsection

Document Parts

% Title commands
\title{Document Title}
\author{Author Name \and Second Author}
\date{\today} % or specific date
\maketitle

% Abstract
\begin{abstract}
Abstract content...
\end{abstract}

% Table of contents
\tableofcontents
\listoffigures
\listoftables

% Appendix
\appendix
\chapter{First Appendix}

% Bibliography
\bibliographystyle{plain}
\bibliography{references}
% or with biblatex
\printbibliography

Text Formatting Commands

Font Styles

CommandEffectExampleAlternative
\textbf{}Bold\textbf{bold text}{\bfseries text}
\textit{}Italic\textit{italic text}{\itshape text}
\textsl{}Slanted\textsl{slanted text}{\slshape text}
\textsc{}Small Caps\textsc{small caps}{\scshape text}
\texttt{}Monospace\texttt{monospace}{\ttfamily text}
\textrm{}Roman\textrm{roman text}{\rmfamily text}
\textsf{}Sans Serif\textsf{sans serif}{\sffamily text}
\emph{}Emphasis\emph{emphasized}{\em text}

Font Sizes

{\tiny tiny text}
{\scriptsize scriptsize text}
{\footnotesize footnotesize text}
{\small small text}
{\normalsize normalsize text}
{\large large text}
{\Large Large text}
{\LARGE LARGE text}
{\huge huge text}
{\Huge Huge text}

% As commands
\tiny
This text is tiny
\normalsize
Back to normal

Text Alignment

% Environments
\begin{center}
Centered text
\end{center}

\begin{flushleft}
Left-aligned text
\end{flushleft}

\begin{flushright}
Right-aligned text
\end{flushright}

% Commands
\centering
Centered paragraph

\raggedright
Left-aligned paragraph

\raggedleft
Right-aligned paragraph

Spacing Commands

Horizontal Spacing

CommandSpace TypeWidth
~Non-breaking spaceNormal space
\,Thin space3/18 em
\:Medium space4/18 em
\;Thick space5/18 em
\!Negative thin space-3/18 em
\ Normal spaceNormal space
\quadEm space1 em
\qquad2 em space2 em
\hspace{length}Custom spaceSpecified
\hfillStretchable spaceFill available

Vertical Spacing

% Fixed vertical space
\vspace{1cm}
\vspace*{1cm} % Not removed at page breaks

% Relative vertical space
\smallskip  % About 3pt
\medskip    % About 6pt
\bigskip    % About 12pt

% Fill vertical space
\vfill

% Page breaks
\newpage    % Start new page
\clearpage  % Clear floats and start new page
\cleardoublepage % For two-sided documents

% Line breaks
\\\\ % New line
\\\\[1cm] % New line with extra space
\\linebreak % Suggests line break
\\newline % Forces new line

Paragraph Formatting

% Paragraph indentation
\setlength{\parindent}{0pt} % No indent
\setlength{\parindent}{1cm} % 1cm indent
\noindent % No indent for one paragraph

% Paragraph spacing
\setlength{\parskip}{1em}

% Line spacing
\usepackage{setspace}
\singlespacing
\onehalfspacing
\doublespacing
\setstretch{1.5} % Custom

% Manual spacing
\par % End paragraph
\indent % Force indent

List Commands

Itemize, Enumerate, Description

% Itemize (bullets)
\begin{itemize}
  \item First item
  \item Second item
  \item[$\diamond$] Custom bullet
\end{itemize}

% Enumerate (numbered)
\begin{enumerate}
  \item First item
  \item Second item
  \item[3a.] Custom label
\end{enumerate}

% Description
\begin{description}
  \item[Term] Description of term
  \item[Another term] Its description
\end{description}

% Nested lists
\begin{enumerate}
  \item First level
  \begin{enumerate}
    \item Second level
    \begin{enumerate}
      \item Third level
    \end{enumerate}
  \end{enumerate}
\end{enumerate}

List Customization

\usepackage{enumitem}

% Customize itemize
\begin{itemize}[label=$\star$, itemsep=0pt]
  \item Starred item
\end{itemize}

% Customize enumerate
\begin{enumerate}[label=\alph*), start=5]
  \item Fifth item (labeled 'e)')
\end{enumerate}

% Inline lists
\begin{itemize*}[label=\textbullet]
  \item One \item Two \item Three
\end{itemize*}

% Resume numbering
\begin{enumerate}[resume]
  \item Continues from before
\end{enumerate}

Math Commands

Math Environments

% Inline math
$E = mc^2$
\(E = mc^2\)
\begin{math}E = mc^2\end{math}

% Display math
$$E = mc^2$$
\[E = mc^2\]
\begin{displaymath}E = mc^2\end{displaymath}

% Numbered equation
\begin{equation}
  E = mc^2
\end{equation}

% Aligned equations
\begin{align}
  a &= b + c \\
  d &= e + f
\end{align}

% Cases
\begin{cases}
  x, & \text{if } x \geq 0 \\
  -x, & \text{if } x < 0
\end{cases}

Common Math Commands

CommandOutputUsage
\frac{a}{b}a/bFractions
\sqrt{x}√xSquare root
\sqrt[n]{x}ⁿ√xnth root
x^{2}Superscript
x_{i}xᵢSubscript
\sum_{i=1}^{n}∑ᵢ₌₁ⁿSummation
\int_{a}^{b}∫ₐᵇIntegral
\lim_{x \to 0}lim x→0Limit
\prod_{i=1}^{n}∏ᵢ₌₁ⁿProduct

Greek Letters

% Lowercase
\alpha \beta \gamma \delta \epsilon \zeta \eta \theta
\iota \kappa \lambda \mu \nu \xi \pi \rho
\sigma \tau \upsilon \phi \chi \psi \omega

% Uppercase
\Gamma \Delta \Theta \Lambda \Xi \Pi
\Sigma \Upsilon \Phi \Psi \Omega

% Variants
\varepsilon \vartheta \varpi \varrho \varsigma \varphi

Table Commands

Basic Tables

% Tabular
\begin{tabular}{lcr}
Left & Center & Right \\
1 & 2 & 3 \\
\end{tabular}

% Table float
\begin{table}[htbp]
  \centering
  \caption{Table caption}
  \label{tab:label}
  \begin{tabular}{|l|c|r|}
    \hline
    A & B & C \\
    \hline
    1 & 2 & 3 \\
    \hline
  \end{tabular}
\end{table}

Table Commands

CommandPurposeExample
&Column separatorA & B & C
\\Row endA & B & C \\
\hlineHorizontal lineFull width
\cline{i-j}Partial line\cline{2-3}
\multicolumn{n}{align}{text}Span columns\multicolumn{2}{c}{Centered}
\multirow{n}{width}{text}Span rows\multirow{2}{*}{Text}

Figure Commands

Including Graphics

% Basic inclusion
\includegraphics{image}
\includegraphics[width=5cm]{image}
\includegraphics[height=3cm]{image}
\includegraphics[scale=0.5]{image}

% Figure environment
\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.8\textwidth]{image}
  \caption{Figure caption}
  \label{fig:label}
\end{figure}

% Subfigures
\usepackage{subcaption}
\begin{figure}
  \begin{subfigure}{0.45\textwidth}
    \includegraphics[width=\textwidth]{image1}
    \caption{First}
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.45\textwidth}
    \includegraphics[width=\textwidth]{image2}
    \caption{Second}
  \end{subfigure}
  \caption{Main caption}
\end{figure}

Reference Commands

Labels and References

% Creating labels
\label{sec:intro}
\label{fig:diagram}
\label{tab:results}
\label{eq:einstein}

% Basic references
\ref{sec:intro}     % 1.1
\pageref{sec:intro} % 5

% With packages
\usepackage{hyperref}
\autoref{sec:intro} % Section 1.1

\usepackage{cleveref}
\cref{sec:intro}    % section 1.1
\Cref{sec:intro}    % Section 1.1
\cref{fig:a,fig:b}  % figures 1 and 2

Citations

% With natbib
\cite{key}          % [1]
\citep{key}         % (Author, Year)
\citet{key}         % Author (Year)
\citeauthor{key}    % Author
\citeyear{key}      % Year

% With biblatex
\cite{key}
\parencite{key}
\textcite{key}
\footcite{key}
\fullcite{key}

% Multiple citations
\cite{key1,key2,key3}

Special Characters

Escaped Characters

CharacterCommandOutput
#\##
$\$$
%\%%
&\&&
_\__
{\{{
}\}}
~\textasciitilde~
^\textasciicircum^
\\textbackslash\

Quotes and Dashes

% Quotes
`single quotes'
``double quotes''
\textquoteleft text\textquoteright
\textquotedblleft text\textquotedblright

% Dashes
- % Hyphen
-- % En dash (ranges)
--- % Em dash (punctuation)

% Special spaces
Non~breaking~space
Thin\,space

Box Commands

Text Boxes

% Horizontal boxes
\mbox{unbreakable text}
\makebox[5cm][c]{centered in 5cm}
\fbox{framed text}
\framebox[5cm][r]{right-aligned frame}

% Vertical boxes
\parbox{5cm}{Paragraph in 5cm box}
\parbox[t]{5cm}{Top-aligned}
\parbox[b]{5cm}{Bottom-aligned}

% Minipage
\begin{minipage}{0.5\textwidth}
Content in half-width box
\end{minipage}

% Save boxes
\newsavebox{\mybox}
\savebox{\mybox}{Saved content}
\usebox{\mybox}

Color Commands

Using Colors

\usepackage{xcolor}

% Text color
\textcolor{red}{Red text}
\textcolor{blue}{Blue text}
\textcolor[RGB]{255,128,0}{Orange text}

% Background color
\colorbox{yellow}{Highlighted}
\fcolorbox{red}{yellow}{Framed}

% Define colors
\definecolor{myblue}{RGB}{0,114,189}
\definecolor{mygreen}{HTML}{00A86B}

% Page/text color
{\color{blue} Blue paragraph}
\pagecolor{gray!10}

Length Commands

Setting Lengths

% Define new length
\newlength{\mylength}
\setlength{\mylength}{2cm}
\addtolength{\mylength}{1cm}

% Common lengths
\setlength{\parindent}{0pt}
\setlength{\parskip}{1em}
\setlength{\textwidth}{15cm}
\setlength{\textheight}{25cm}

% Calculations
\setlength{\mylength}{0.5\textwidth}
\setlength{\mylength}{\textwidth-2cm}

% Using calc package
\usepackage{calc}
\setlength{\mylength}{\widthof{Sample text}+1cm}

Counter Commands

Using Counters

% New counter
\newcounter{mycounter}
\setcounter{mycounter}{0}
\stepcounter{mycounter}
\addtocounter{mycounter}{5}

% Display counter
\arabic{mycounter}    % 1, 2, 3
\roman{mycounter}     % i, ii, iii
\Roman{mycounter}     % I, II, III
\alph{mycounter}      % a, b, c
\Alph{mycounter}      % A, B, C

% Page numbering
\pagenumbering{roman}
\setcounter{page}{1}

Environment Commands

Custom Environments

% Define environment
\newenvironment{myenv}
  {\begin{center}\bfseries}  % Begin
  {\end{center}}             % End

% Usage
\begin{myenv}
Bold centered text
\end{myenv}

% With arguments
\newenvironment{mybox}[1]
  {\begin{center}\fbox{\begin{minipage}{#1}}}
  {\end{minipage}}\end{center}}

\begin{mybox}{5cm}
Content in 5cm box
\end{mybox}

Useful Macros

Common Custom Commands

% Simple macros
\newcommand{\R}{\mathbb{R}}
\newcommand{\vect}[1]{\mathbf{#1}}
\newcommand{\norm}[1]{\left\|#1\right\|}

% With optional arguments
\newcommand{\myitem}[1][\textbullet]{#1~}

% Renewing commands
\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\arraystretch}{1.5}

% Conditional commands
\newcommand{\ie}{\textit{i.e.}}
\newcommand{\eg}{\textit{e.g.}}

Quick Reference Card

Essential Commands

CategoryCommands
Structure\section, \subsection, \chapter
Formatting\textbf, \textit, \emph
Math$...$, \[...\], \frac, \sqrt
Listsitemize, enumerate, description
References\label, \ref, \cite
Spacing\\, \vspace, \hspace
Special\%, \&, \_, \#

Next: Explore essential LaTeX packages to extend functionality and add features to your documents.