LaTeX Cheat Sheet
Master LaTeX with this comprehensive command reference. Search and find the exact syntax you need with examples and practical usage tips.
What is LaTeX?
LaTeX is a high-quality typesetting system designed for the production of technical and scientific documentation. It's the de facto standard for academic papers, theses, books, and any document requiring professional mathematical notation.
Perfect for: Academic papers, Mathematical formulas, Scientific documents, Books and reports, Presentations (Beamer), and Professional typesetting.
\documentclass{}
Document StructureDefine the document type and options
Syntax:
\documentclass[options]{class}
Examples:
\documentclass{article}
Standard article document class\documentclass[12pt,a4paper]{report}
Report with 12pt font on A4 paper\documentclass[twocolumn]{article}
Two-column article layoutNotes:
Common classes: article, book, report, letter, beamer (presentations)
\begin{document}
Document StructureStart the document content
Syntax:
\begin{document}
...
\end{document}
Examples:
\begin{document}
Hello, world!
\end{document}
Basic document structureNotes:
Everything between \begin{document} and \end{document} is the document body
\usepackage{}
Document StructureInclude LaTeX packages for additional functionality
Syntax:
\usepackage[options]{package}
Examples:
\usepackage{amsmath}
Advanced math typesetting\usepackage{graphicx}
Include graphics and images\usepackage[utf8]{inputenc}
UTF-8 input encoding\usepackage{hyperref}
Hyperlinks and PDF bookmarksNotes:
Place in the preamble (before \begin{document})
\title{} \author{}
Document StructureSet document title and author information
Syntax:
\title{Title}
\author{Author}
\date{Date}
\maketitle
Examples:
\title{My Document}
\author{John Doe}
\date{\today}
\maketitle
Complete title page setup with current date\title{Research Paper}
\author{Jane Smith \and Bob Johnson}
\maketitle
Multiple authorsNotes:
Use \maketitle to actually display the title information
\textbf{}
Text FormattingMake text bold
Syntax:
\textbf{text}
Examples:
\textbf{Bold text}
Creates bold text{\bf Old style bold}
Alternative bold command (deprecated)Notes:
\textbf{} is preferred over {\bf} in modern LaTeX
\textit{}
Text FormattingMake text italic
Syntax:
\textit{text}
Examples:
\textit{Italic text}
Creates italic text\emph{Emphasized text}
Semantic emphasis (usually italic)Notes:
\emph{} provides semantic emphasis, \textit{} is purely visual
\underline{}
Text FormattingUnderline text
Syntax:
\underline{text}
Examples:
\underline{Underlined text}
Creates underlined textNotes:
Use sparingly; italics or bold are usually preferred for emphasis
\large
Text FormattingChange font size
Syntax:
{\size text}
Examples:
{\tiny Tiny text}
Smallest font size{\small Small text}
Small font size{\large Large text}
Large font size{\huge Huge text}
Largest font sizeNotes:
Sizes: \tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, \LARGE, \huge, \Huge
\textrm{}
Text FormattingChange font family
Syntax:
\textfamily{text}
Examples:
\textrm{Roman (serif) text}
Roman/serif font\textsf{Sans serif text}
Sans serif font\texttt{Monospace text}
Monospace/typewriter fontNotes:
Default families: rm (roman), sf (sans serif), tt (monospace)
$...$
MathematicsInline mathematical expressions
Syntax:
$expression$
Examples:
The formula is $E = mc^2$.
Inline equation within textWe have $x + y = z$ and $a \neq b$.
Multiple inline expressionsNotes:
Use single $ for inline math, \(...\) is an alternative
$$...$$
MathematicsDisplay mathematical expressions (centered)
Syntax:
$$expression$$
Examples:
$$E = mc^2$$
Centered display equation$$\int_{0}^{\infty} e^{-x} dx = 1$$
Integral with limitsNotes:
Use $$...$$ or \[...\] for display math. Consider \begin{equation} for numbered equations
\begin{equation}
MathematicsNumbered equation environment
Syntax:
\begin{equation}
expression
\end{equation}
Examples:
\begin{equation}
E = mc^2
\end{equation}
Numbered equation\begin{equation*}
F = ma
\end{equation*}
Unnumbered equation (with amsmath)Notes:
Requires amsmath package for equation* (unnumbered version)
\frac{}{}
MathematicsCreate fractions
Syntax:
\frac{numerator}{denominator}
Examples:
$\frac{1}{2}$
Simple fraction one-half$\frac{x^2 + 1}{x - 1}$
Complex fraction with polynomials$\frac{\partial f}{\partial x}$
Partial derivative fractionNotes:
Use \tfrac{}{} for smaller fractions in inline math
^{} _{}
MathematicsSuperscripts and subscripts
Syntax:
base^{superscript} base_{subscript}
Examples:
$x^2$
Simple superscript$x_{i,j}$
Multiple subscripts$x^{2n+1}$
Complex superscript$x_1^2 + x_2^2$
Both superscript and subscriptNotes:
Use curly braces for multi-character super/subscripts
\alpha
MathematicsGreek letters for mathematical notation
Syntax:
\lettername
Examples:
$\alpha, \beta, \gamma$
Lowercase Greek letters$\Delta, \Theta, \Omega$
Uppercase Greek letters$\pi \approx 3.14159$
Pi symbol with approximationNotes:
Common: \alpha, \beta, \gamma, \delta, \epsilon, \pi, \sigma, \phi, \psi, \omega
\infty
MathematicsMathematical symbols and operators
Syntax:
\symbolname
Examples:
$\infty$
Infinity symbol$\pm, \mp$
Plus-minus, minus-plus$\leq, \geq, \neq$
Less/greater than or equal, not equal$\sum_{i=1}^{n} x_i$
Summation with limits$\int, \partial, \nabla$
Integral, partial, nabla operatorsNotes:
Requires amsmath package for many advanced symbols
\begin{matrix}
MathematicsCreate matrices and arrays
Syntax:
\begin{matrix}
a & b \\
c & d
\end{matrix}
Examples:
$\begin{pmatrix}
1 & 2 \\
3 & 4
\end{pmatrix}$
Matrix with parentheses$\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}$
Matrix with square brackets$\begin{vmatrix}
\cos\theta & -\sin\theta \\
\sin\theta & \cos\theta
\end{vmatrix}$
Determinant notationNotes:
Types: matrix (none), pmatrix ( ), bmatrix [ ], Bmatrix { }, vmatrix | |, Vmatrix ‖ ‖
\begin{itemize}
ListsCreate bulleted lists
Syntax:
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
Examples:
\begin{itemize}
\item First item
\item Second item
\item Third item
\end{itemize}
Simple bulleted list\begin{itemize}
\item[--] Custom bullet
\item[$\star$] Star bullet
\end{itemize}
Custom bullet pointsNotes:
Use \item[symbol] to customize bullet points
\begin{enumerate}
ListsCreate numbered lists
Syntax:
\begin{enumerate}
\item Item 1
\item Item 2
\end{enumerate}
Examples:
\begin{enumerate}
\item First item
\item Second item
\item Third item
\end{enumerate}
Simple numbered list\begin{enumerate}[a)]
\item Item a
\item Item b
\end{enumerate}
Custom numbering (requires enumitem package)Notes:
Use enumitem package for advanced numbering customization
\begin{description}
ListsCreate description lists with terms
Syntax:
\begin{description}
\item[Term] Description
\end{description}
Examples:
\begin{description}
\item[LaTeX] A document preparation system
\item[PDF] Portable Document Format
\end{description}
Definition list with terms and descriptionsNotes:
Perfect for glossaries and term definitions
nested lists
ListsCreate nested lists within lists
Syntax:
\begin{itemize}
\item Item
\begin{enumerate}
\item Nested
\end{enumerate}
\end{itemize}
Examples:
\begin{itemize}
\item Fruits
\begin{enumerate}
\item Apple
\item Orange
\end{enumerate}
\item Vegetables
\end{itemize}
Mixed nested listsNotes:
You can nest itemize, enumerate, and description lists
\begin{tabular}
TablesCreate basic tables
Syntax:
\begin{tabular}{|c|c|}
\hline
Col1 & Col2 \\
\hline
\end{tabular}
Examples:
\begin{tabular}{|l|c|r|}
\hline
Left & Center & Right \\
\hline
A & B & C \\
\hline
\end{tabular}
Table with borders and alignment\begin{tabular}{cc}
Name & Age \\
John & 25 \\
Jane & 30 \\
\end{tabular}
Simple table without bordersNotes:
Alignment: l (left), c (center), r (right). | for vertical lines, \hline for horizontal lines
\begin{table}
TablesFloating table environment with caption
Syntax:
\begin{table}[h]
\centering
\begin{tabular}{cc}
...
\end{tabular}
\caption{Caption}
\end{table}
Examples:
\begin{table}[h]
\centering
\begin{tabular}{|c|c|}
\hline
A & B \\
\hline
\end{tabular}
\caption{My Table}
\label{tab:mytable}
\end{table}
Complete floating table with caption and labelNotes:
Position options: h (here), t (top), b (bottom), p (separate page)
\multicolumn{}{}{}
TablesSpan multiple columns in tables
Syntax:
\multicolumn{num_cols}{alignment}{content}
Examples:
\begin{tabular}{|c|c|c|}
\hline
\multicolumn{3}{|c|}{Header} \\
\hline
A & B & C \\
\hline
\end{tabular}
Header spanning all three columnsNotes:
Useful for creating complex table headers and merged cells
\includegraphics{}
Figures & GraphicsInclude images and graphics
Syntax:
\includegraphics[options]{filename}
Examples:
\includegraphics{image.png}
Include image at natural size\includegraphics[width=0.5\textwidth]{image.jpg}
Scale image to half text width\includegraphics[height=5cm,angle=90]{image.pdf}
Set height and rotate imageNotes:
Requires graphicx package. Supports PDF, PNG, JPG, EPS formats
\begin{figure}
Figures & GraphicsFloating figure environment
Syntax:
\begin{figure}[position]
\centering
\includegraphics{image}
\caption{Caption}
\end{figure}
Examples:
\begin{figure}[h]
\centering
\includegraphics[width=0.8\textwidth]{plot.png}
\caption{Results plot}
\label{fig:results}
\end{figure}
Complete figure with caption and labelNotes:
Use \label{} after \caption{} for referencing with \ref{}
\subfigure{}
Figures & GraphicsMultiple figures side by side
Syntax:
\subfigure[subcaption]{\includegraphics{image}}
Examples:
\begin{figure}
\subfigure[Left]{\includegraphics[width=0.45\textwidth]{left.png}}
\subfigure[Right]{\includegraphics[width=0.45\textwidth]{right.png}}
\caption{Two subfigures}
\end{figure}
Two images side by side with subcaptionsNotes:
Requires subfigure package (or modern subcaption package)
\label{} \ref{}
ReferencesCreate and reference labels
Syntax:
\label{key} ... \ref{key}
Examples:
\section{Introduction}\label{sec:intro}
As discussed in Section \ref{sec:intro}...
Section reference\begin{equation}
E = mc^2
\label{eq:einstein}
\end{equation}
Equation \ref{eq:einstein} is famous.
Equation referenceNotes:
Use descriptive prefixes: sec:, fig:, tab:, eq: for clarity
\cite{}
ReferencesCite bibliography entries
Syntax:
\cite{key}
Examples:
According to Smith \cite{smith2023}...
Simple citationSeveral studies \cite{smith2023,jones2022,brown2021} show...
Multiple citationsAs shown by \cite[p. 42]{smith2023}...
Citation with page numberNotes:
Requires bibliography setup with \bibliography{} or biblatex
\begin{thebibliography}
ReferencesCreate bibliography manually
Syntax:
\begin{thebibliography}{99}
\bibitem{key} Author. Title. Year.
\end{thebibliography}
Examples:
\begin{thebibliography}{99}
\bibitem{smith2023}
Smith, J. (2023). \textit{LaTeX Guide}. Publisher.
\end{thebibliography}
Manual bibliography entryNotes:
For automatic bibliography, use BibTeX or biblatex with .bib files
\pageref{}
ReferencesReference page numbers
Syntax:
\pageref{label}
Examples:
See Figure \ref{fig:plot} on page \pageref{fig:plot}.
Reference both figure number and pageNotes:
Useful for longer documents where page numbers matter
\section{}
SectioningCreate document sections
Syntax:
\section{Section Title}
Examples:
\section{Introduction}
Numbered section\section*{Acknowledgments}
Unnumbered section (with *)\subsection{Background}
\subsubsection{Previous Work}
Nested sectionsNotes:
Hierarchy: \part, \chapter (books), \section, \subsection, \subsubsection, \paragraph
\tableofcontents
SectioningGenerate table of contents
Syntax:
\tableofcontents
Examples:
\tableofcontents
\newpage
\section{Introduction}
Table of contents on separate pageNotes:
Compile twice to generate TOC. Use \listoffigures and \listoftables for figure/table lists
\chapter{}
SectioningCreate chapters (book/report classes)
Syntax:
\chapter{Chapter Title}
Examples:
\chapter{Introduction}
Numbered chapter\chapter*{Preface}
Unnumbered chapterNotes:
Only available in book and report document classes
\newpage
Page LayoutStart a new page
Syntax:
\newpage
Examples:
End of page content.
\newpage
Start of new page.
Force page breakNotes:
Use \clearpage to also flush floats, \pagebreak allows some stretch
\usepackage{geometry}
Page LayoutControl page margins and layout
Syntax:
\usepackage[options]{geometry}
Examples:
\usepackage[margin=1in]{geometry}
Set all margins to 1 inch\usepackage[top=2cm,bottom=2cm,left=3cm,right=3cm]{geometry}
Custom margins\usepackage[a4paper,landscape]{geometry}
Landscape orientationNotes:
Very flexible package for page layout control
\usepackage{fancyhdr}
Page LayoutCustom headers and footers
Syntax:
\usepackage{fancyhdr}
\pagestyle{fancy}
Examples:
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[L]{Left Header}
\fancyfoot[C]{\thepage}
Custom header and centered page numberNotes:
Options: L (left), C (center), R (right) for head and foot
\&
Special CharactersSpecial characters that need escaping
Syntax:
\character
Examples:
\& \% \$ \# \{ \}
Common special characters\textbackslash
Backslash character\~{} \^{}
Tilde and caret charactersNotes:
Characters & % $ # { } ^ ~ \ _ have special meaning in LaTeX
\'{}
Special CharactersAccented characters
Syntax:
\accent{letter}
Examples:
\'e \`a \^o \"u
Acute, grave, circumflex, umlaut accents\~n \c{c}
Tilde and cedillacaf\'e, na\"ive
Accented wordsNotes:
Use inputenc package with utf8 option for direct Unicode input
\quad
Special CharactersHorizontal spacing commands
Syntax:
\spacingcommand
Examples:
word1\quad word2
Quad space (1em)word1\qquad word2
Double quad space (2em)word1\hspace{2cm}word2
Custom horizontal spaceword1~word2
Non-breaking spaceNotes:
Spacing: \, (thin), \: (medium), \; (thick), \quad, \qquad, \hspace{}
\\
Special CharactersLine breaks and vertical spacing
Syntax:
\\[space]
Examples:
Line 1\\Line 2
Simple line breakLine 1\\[0.5cm]Line 2
Line break with extra space\vspace{1cm}
Vertical spaceNotes:
Use \newline for line breaks that don't end paragraphs
\begin{center}
EnvironmentsCenter text horizontally
Syntax:
\begin{center}
text
\end{center}
Examples:
\begin{center}
Centered text
\end{center}
Center a block of textNotes:
Also available: flushleft, flushright environments
\begin{quote}
EnvironmentsFormat quotations
Syntax:
\begin{quote}
quoted text
\end{quote}
Examples:
\begin{quote}
To be or not to be, that is the question.
\end{quote}
Block quotation with indentation\begin{quotation}
Longer quote...
\end{quotation}
Quotation environment for longer quotesNotes:
quote for shorter quotes, quotation for longer multi-paragraph quotes
\begin{verbatim}
EnvironmentsDisplay text exactly as typed
Syntax:
\begin{verbatim}
code or text
\end{verbatim}
Examples:
\begin{verbatim}
#include <stdio.h>
int main() {
printf("Hello\n");
}
\end{verbatim}
Code block with exact formatting\verb|inline code|
Inline verbatim textNotes:
Use \verb|text| for inline verbatim. Choose delimiter that doesn't appear in text
Complete LaTeX Reference
Below is the complete visual reference guide showing LaTeX syntax with explanations and practical examples.
Basic Document Structure
LaTeX Code
Explanation
documentclass: Defines document type (article, book, report)
usepackage: Loads additional functionality
title/author/date: Document metadata
maketitle: Creates the title page
section: Creates numbered sections
begin/end document: Document body container
Text Formatting
LaTeX Code
Result
Bold text
Italic text
Underlined text
Emphasized text
Large text
Small text
Huge text
Roman font
Sans serif font
Monospace font
Mathematical Expressions
LaTeX Code
Description
Inline math: Use $...$ for math within text
Display math: Use $$...$$ for centered equations
equation environment: Numbered equations with labels
Fractions: \\frac{numerator}{denominator}
Superscripts/subscripts: ^ and _ operators
Greek letters: \\alpha, \\beta, etc.
Matrices: pmatrix, bmatrix, vmatrix environments
Lists and Tables
LaTeX Code
Result
Bulleted list:
- First item
- Second item
Numbered list:
- Numbered item
- Another item
Table with borders:
Left | Center | Right |
A | B | C |
Document Structure
LaTeX Code
Description
tableofcontents: Automatic table of contents
section hierarchy: section → subsection → subsubsection
labels: Create reference points with \\label{}
cross-references: Use \\ref{} to reference labels
figures: Include images with captions
positioning: [h] here, [t] top, [b] bottom, [p] separate page
Bibliography and Citations
LaTeX Code
Description
\\cite{}: Create citations in text
thebibliography: Manual bibliography environment
\\bibitem{}: Individual bibliography entries
BibTeX: Automatic bibliography from .bib files
Citation styles: plain, alpha, unsrt, abbrv, and many more
Modern option: Use biblatex package for advanced features
📚 About LaTeX
LaTeX (pronounced "LAH-tech" or "LAY-tech") is a document preparation system based on the TeX typesetting program. Created by Leslie Lamport in the 1980s, LaTeX provides a high-level, descriptive markup language that automates many typographical and layout tasks, allowing authors to focus on content rather than formatting.
🎯 Why Use LaTeX?
- ✓ Professional typography: Exceptional output quality
- ✓ Mathematical excellence: Superior math typesetting
- ✓ Consistent formatting: Automatic layout and numbering
- ✓ Cross-references: Automatic figure, table, equation numbering
- ✓ Bibliography management: Automatic citations and references
📊 Perfect For
- • Academic papers: Theses, dissertations, journal articles
- • Scientific documents: Research papers with complex math
- • Books and reports: Multi-chapter documents
- • Presentations: Beamer class for slides
- • Technical documentation: Manuals with precise formatting
🚀 Getting Started
1. Install LaTeX Distribution
Windows: MiKTeX or TeX Live • Mac: MacTeX • Linux: TeX Live from package manager
2. Choose an Editor
Beginner-friendly: TeXworks, TeXStudio, Overleaf (online) • Advanced: VS Code with LaTeX Workshop, Vim, Emacs
3. Learn the Basics
Start with document structure, sections, and basic formatting • Practice mathematical notation • Experiment with figures and tables
💡 LaTeX Best Practices
Document Organization
- • Use semantic markup (\\emph vs \\textit)
- • Organize content with clear section hierarchy
- • Use labels for all figures, tables, equations
- • Keep source code well-commented
- • Use separate files for large documents
Mathematical Writing
- • Use equation environments for important formulas
- • Define custom commands for repeated expressions
- • Use proper spacing in math mode
- • Number equations consistently
- • Load amsmath for advanced math features
Master LaTeX: "LaTeX rewards patience and precision with unmatched typographical quality. Start simple, build complexity gradually, and focus on content while LaTeX handles the beautiful formatting." Use this reference as your guide to LaTeX mastery! 🎓