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.

44 commands found
Filter by category:

\documentclass{}

Document Structure

Define 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 layout

Notes:

Common classes: article, book, report, letter, beamer (presentations)

\begin{document}

Document Structure

Start the document content

Syntax:

\begin{document} ... \end{document}

Examples:

\begin{document} Hello, world! \end{document} Basic document structure

Notes:

Everything between \begin{document} and \end{document} is the document body

\usepackage{}

Document Structure

Include 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 bookmarks

Notes:

Place in the preamble (before \begin{document})

\title{} \author{}

Document Structure

Set 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 authors

Notes:

Use \maketitle to actually display the title information

\textbf{}

Text Formatting

Make 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 Formatting

Make 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 Formatting

Underline text

Syntax:

\underline{text}

Examples:

\underline{Underlined text} Creates underlined text

Notes:

Use sparingly; italics or bold are usually preferred for emphasis

\large

Text Formatting

Change 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 size

Notes:

Sizes: \tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, \LARGE, \huge, \Huge

\textrm{}

Text Formatting

Change 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 font

Notes:

Default families: rm (roman), sf (sans serif), tt (monospace)

$...$

Mathematics

Inline mathematical expressions

Syntax:

$expression$

Examples:

The formula is $E = mc^2$. Inline equation within text
We have $x + y = z$ and $a \neq b$. Multiple inline expressions

Notes:

Use single $ for inline math, \(...\) is an alternative

$$...$$

Mathematics

Display mathematical expressions (centered)

Syntax:

$$expression$$

Examples:

$$E = mc^2$$ Centered display equation
$$\int_{0}^{\infty} e^{-x} dx = 1$$ Integral with limits

Notes:

Use $$...$$ or \[...\] for display math. Consider \begin{equation} for numbered equations

\begin{equation}

Mathematics

Numbered 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{}{}

Mathematics

Create 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 fraction

Notes:

Use \tfrac{}{} for smaller fractions in inline math

^{} _{}

Mathematics

Superscripts 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 subscript

Notes:

Use curly braces for multi-character super/subscripts

\alpha

Mathematics

Greek 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 approximation

Notes:

Common: \alpha, \beta, \gamma, \delta, \epsilon, \pi, \sigma, \phi, \psi, \omega

\infty

Mathematics

Mathematical 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 operators

Notes:

Requires amsmath package for many advanced symbols

\begin{matrix}

Mathematics

Create 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 notation

Notes:

Types: matrix (none), pmatrix ( ), bmatrix [ ], Bmatrix { }, vmatrix | |, Vmatrix ‖ ‖

\begin{itemize}

Lists

Create 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 points

Notes:

Use \item[symbol] to customize bullet points

\begin{enumerate}

Lists

Create 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}

Lists

Create 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 descriptions

Notes:

Perfect for glossaries and term definitions

nested lists

Lists

Create 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 lists

Notes:

You can nest itemize, enumerate, and description lists

\begin{tabular}

Tables

Create 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 borders

Notes:

Alignment: l (left), c (center), r (right). | for vertical lines, \hline for horizontal lines

\begin{table}

Tables

Floating 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 label

Notes:

Position options: h (here), t (top), b (bottom), p (separate page)

\multicolumn{}{}{}

Tables

Span 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 columns

Notes:

Useful for creating complex table headers and merged cells

\includegraphics{}

Figures & Graphics

Include 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 image

Notes:

Requires graphicx package. Supports PDF, PNG, JPG, EPS formats

\begin{figure}

Figures & Graphics

Floating 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 label

Notes:

Use \label{} after \caption{} for referencing with \ref{}

\subfigure{}

Figures & Graphics

Multiple 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 subcaptions

Notes:

Requires subfigure package (or modern subcaption package)

\label{} \ref{}

References

Create 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 reference

Notes:

Use descriptive prefixes: sec:, fig:, tab:, eq: for clarity

\cite{}

References

Cite bibliography entries

Syntax:

\cite{key}

Examples:

According to Smith \cite{smith2023}... Simple citation
Several studies \cite{smith2023,jones2022,brown2021} show... Multiple citations
As shown by \cite[p. 42]{smith2023}... Citation with page number

Notes:

Requires bibliography setup with \bibliography{} or biblatex

\begin{thebibliography}

References

Create 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 entry

Notes:

For automatic bibliography, use BibTeX or biblatex with .bib files

\pageref{}

References

Reference page numbers

Syntax:

\pageref{label}

Examples:

See Figure \ref{fig:plot} on page \pageref{fig:plot}. Reference both figure number and page

Notes:

Useful for longer documents where page numbers matter

\section{}

Sectioning

Create document sections

Syntax:

\section{Section Title}

Examples:

\section{Introduction} Numbered section
\section*{Acknowledgments} Unnumbered section (with *)
\subsection{Background} \subsubsection{Previous Work} Nested sections

Notes:

Hierarchy: \part, \chapter (books), \section, \subsection, \subsubsection, \paragraph

\tableofcontents

Sectioning

Generate table of contents

Syntax:

\tableofcontents

Examples:

\tableofcontents \newpage \section{Introduction} Table of contents on separate page

Notes:

Compile twice to generate TOC. Use \listoffigures and \listoftables for figure/table lists

\chapter{}

Sectioning

Create chapters (book/report classes)

Syntax:

\chapter{Chapter Title}

Examples:

\chapter{Introduction} Numbered chapter
\chapter*{Preface} Unnumbered chapter

Notes:

Only available in book and report document classes

\newpage

Page Layout

Start a new page

Syntax:

\newpage

Examples:

End of page content. \newpage Start of new page. Force page break

Notes:

Use \clearpage to also flush floats, \pagebreak allows some stretch

\usepackage{geometry}

Page Layout

Control 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 orientation

Notes:

Very flexible package for page layout control

\usepackage{fancyhdr}

Page Layout

Custom 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 number

Notes:

Options: L (left), C (center), R (right) for head and foot

\&

Special Characters

Special characters that need escaping

Syntax:

\character

Examples:

\& \% \$ \# \{ \} Common special characters
\textbackslash Backslash character
\~{} \^{} Tilde and caret characters

Notes:

Characters & % $ # { } ^ ~ \ _ have special meaning in LaTeX

\'{}

Special Characters

Accented characters

Syntax:

\accent{letter}

Examples:

\'e \`a \^o \"u Acute, grave, circumflex, umlaut accents
\~n \c{c} Tilde and cedilla
caf\'e, na\"ive Accented words

Notes:

Use inputenc package with utf8 option for direct Unicode input

\quad

Special Characters

Horizontal spacing commands

Syntax:

\spacingcommand

Examples:

word1\quad word2 Quad space (1em)
word1\qquad word2 Double quad space (2em)
word1\hspace{2cm}word2 Custom horizontal space
word1~word2 Non-breaking space

Notes:

Spacing: \, (thin), \: (medium), \; (thick), \quad, \qquad, \hspace{}

\\

Special Characters

Line breaks and vertical spacing

Syntax:

\\[space]

Examples:

Line 1\\Line 2 Simple line break
Line 1\\[0.5cm]Line 2 Line break with extra space
\vspace{1cm} Vertical space

Notes:

Use \newline for line breaks that don't end paragraphs

\begin{center}

Environments

Center text horizontally

Syntax:

\begin{center} text \end{center}

Examples:

\begin{center} Centered text \end{center} Center a block of text

Notes:

Also available: flushleft, flushright environments

\begin{quote}

Environments

Format 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 quotes

Notes:

quote for shorter quotes, quotation for longer multi-paragraph quotes

\begin{verbatim}

Environments

Display 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 text

Notes:

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

\\documentclass{article} \\usepackage[utf8]{inputenc} \\usepackage{amsmath} \\title{My Document} \\author{Your Name} \\date{\\today} \\begin{document} \\maketitle \\section{Introduction} This is the introduction. \\end{document}

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

\\textbf{Bold text} \\textit{Italic text} \\underline{Underlined text} \\emph{Emphasized text} {\\large Large text} {\\small Small text} {\\huge Huge text} \\textrm{Roman font} \\textsf{Sans serif font} \\texttt{Monospace font}

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

Inline: $E = mc^2$ Display: $$\\int_{0}^{\\infty} e^{-x} dx = 1$$ \\begin{equation} \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a} \\label{eq:quadratic} \\end{equation} Greek letters: $\\alpha, \\beta, \\gamma$ Symbols: $\\infty, \\sum, \\prod, \\int$ Matrix: $$\\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}$$

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

\\begin{itemize} \\item First item \\item Second item \\end{itemize} \\begin{enumerate} \\item Numbered item \\item Another item \\end{enumerate} \\begin{tabular}{|l|c|r|} \\hline Left & Center & Right \\\\ \\hline A & B & C \\\\ \\hline \\end{tabular}

Result

Bulleted list:

  • First item
  • Second item

Numbered list:

  1. Numbered item
  2. Another item

Table with borders:

LeftCenterRight
ABC

Document Structure

LaTeX Code

\\tableofcontents \\section{Introduction} \\label{sec:intro} \\subsection{Background} \\subsubsection{Previous Work} \\section{Methodology} As mentioned in Section \\ref{sec:intro}... \\begin{figure}[h] \\centering \\includegraphics[width=0.5\\textwidth]{image.png} \\caption{My figure} \\label{fig:example} \\end{figure} See Figure \\ref{fig:example}...

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

According to Smith \\cite{smith2023}... \\begin{thebibliography}{99} \\bibitem{smith2023} Smith, J. (2023). \\textit{LaTeX Guide}. Academic Press. \\bibitem{jones2022} Jones, A. (2022). Document Preparation. \\textit{Journal of Typography}, 15(2), 123-145. \\end{thebibliography} % Or use BibTeX: % \\bibliography{references} % \\bibliographystyle{plain}

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! 🎓