Skip to main content
HomeCheat sheetsData Science

LaTeX Cheat Sheet

Learn everything you need to know about LaTeX in this convenient cheat sheet!
May 2024

Have this cheat sheet at your fingertips

Download PDF

Comments

Insert a comment with%

% this text is ignored

Environments

Environments are sections in a document that apply special behavior rules to the enclosed text.

\begin{environment-name}
% environment contents
\end{environment-name}

Equations

Description

Code

Output

Insert inline equation with $

The equation is $e=mc^2$

Insert inline equation with \(

The equation is \(e=mc^2\)

Insert unnumbered equation with $$

The equation is

$$

e=mc^2

$$

Insert unnumbered equation with \[

The equation is

\[

e=mc^2

\]

Insert numbered equation with \begin{equation}

\begin{equation}

e=mc^2

\end{equation}

Document Structure

Preamble

Preamble content must appear before \begin{document}.

Define the document class with \documentclass.

\documentclass[options]{class}

Common class values

Class

Description

article

Default class for composing an article.

report

Typeset a multi-chapter report.

book

A class for typesetting books.

beamer

For producing presentations and slides.

Common class options

Option

Default value

Available values

fontsize

11pt

20pt, 12.5pt, etc.

paper

a4, portrait

a3, letter, landscape

toc

nolistof

listof, listofnumbered

captions

tablebelow, figurebelow

tableabove, figureabove

twocolumn

false

true

Loading Packages

Load a package with \usepackage.

\usepackage[options]{package}

Common package examples

Functionality

Code

Mathematical typesetting

\usepackage{amsmath}

Set the text encoding

\usepackage[utf8]{inputenc}

Multilingual support

\usepackage[english, spanish, portuguese]{babel}

Document

Include the entire document in a document environment.

\begin{document}
% The complete document contents
\end{document}

Title Page

Element

Code

Title of document

\title{text}

Author name

\author{text}

Date

\date{\today}

Generate the title page

\maketitle

Content Listings

Element

Code

Table of contents

\tableofcontents

List of tables

\listoftables

List of figures

\listoffigures

Headings

Element

Code

Chapter

\chapter{The Last Chapter}

Section

\section{Conclusion}

Subsection

\subsection{Final thoughts}

Text Justification

Description

Code

Output

Left align

\begin{flushleft}

On the left

Center align

\begin{center}

In the middle

Right align

\begin{flushright}

On the right

Lists

Description

Code

Output

Bulleted list

\begin{itemize}

\item flour

\item milk

\item eggs

\end{itemize}

  • flour
  • milk
  • eggs

Numbered list

\begin{enumerate}

\item Learn LaTeX

\item ???

\item Profit

\end{enumerate}

  1. Learn LaTeX
  2. ???
  3. Profit

Named elements in list

\begin{description}

\item[datum] Single piece of information

\item[data] Plural of datum

\end{description}

Text Mode

Formatting

Description

Code

Output

Bold

\textbf{To boldly go}

Italic

\textit{Leaning Tower of Pisa}

Small caps

C\textsc{anidae}

Spaces

Description

Code

Output

Thinnest space

very\,close

Thin space

quite\:close

Medium space

fairly\;close

1 em space

quite\quadfar

2 em space

very\qquadfar

Accents

Description

Code

Output

Hat

\hat{a}

Bar

\bar{a}

Tilde

\tilde{a}

Math Mode

Mathematical Arithmetic Operators

Description

Code

Output

Plus

2 + 3

Minus

9 - 6

Plus or Minus

\pm 1.53

Multiplication (times)

6 \times 7

Multiplication (dot)

6 \dot 7

Division (slash)

7 / 22

Division (symbol)

7 \div 22

Numeric Comparison Operators

Description

Code

Output

Equal

1 + 2 = 3

Not equal

1 + 2 \ne 4

Approximately equal

\pi \approx 3.14

Less than

6 < 7

Less than or equal to

6 \leq 7

Greater than

8 > 7

Greater than or equal to

8 \geq 7

Equations

Description

Code

Output

Fraction

\frac{7}{22}

Square root

\sqrt{49}

Nth root

\sqrt[5]{243}

Subscript

x_{i}

Superscript

x^{3}

Absolute values

|x|

Natural logarithm

\ln(5)

Logarithm

\log_{2}8

Exponential

\exp(x)

Sine, cosecant

\sin(x)=\frac{1}{csc(x)}

Cosine, secant

\cos(x)=\frac{1}{sec(x)}

Tangent, cotangent

\tan(x)=\frac{1}{cot(x)}

Greek and Hebrew Letters

Description

Code

Output

Lowercase delta

\delta

Uppercase delta

\Delta

Aleph

\Aleph

Set Theory

Description

Code

Output

Union

\cup

Intersection

\cap

Is a member of

\in

Empty set

\emptyset

Logic Operators

Description

Code

Output

Not

\neg A

And

A \land B

Or

A \lor B

Topics
Related

blog

The Ultimate List of Data Science Podcasts to Listen to Right Now

We’ve hand-picked the ultimate list of top data science podcasts for you to gain a deeper understanding of data science and analytics. Add them to your playlist now!
Shaun Edmond's photo

Shaun Edmond

8 min

blog

Data Science In The Trucking Industry (Transcript)

Discover how data science is being used to revolutionize the trucking industry, from A/B Testing and econometrics to machine learning and self-driving cars.
Hugo Bowne-Anderson's photo

Hugo Bowne-Anderson

48 min

blog

Top 32 AWS Interview Questions and Answers For 2024

A complete guide to exploring the basic, intermediate, and advanced AWS interview questions, along with questions based on real-world situations. It covers all the areas, ensuring a well-rounded preparation strategy.
Zoumana Keita 's photo

Zoumana Keita

15 min

podcast

Avoiding Burnout for Data Professionals with Jen Fisher, Human Sustainability Leader at Deloitte

Jen and Adel cover Jen’s own personal experience with burnout, the role of a Chief Wellbeing Officer, the impact of work on our overall well-being, the patterns that lead to burnout, the future of human sustainability in the workplace and much more.
Adel Nehme's photo

Adel Nehme

44 min

podcast

Becoming Remarkable with Guy Kawasaki, Author and Chief Evangelist at Canva

Richie and Guy explore the concept of being remarkable, growth, grit and grace, the importance of experiential learning, imposter syndrome, finding your passion, how to network and find remarkable people, measuring success through benevolent impact and much more. 
Richie Cotton's photo

Richie Cotton

55 min

podcast

The Venture Mindset with Ilya Strebulaev, Economist Professor at Stanford Graduate School of Business

Richie and Ilya explore the venture mindset, the importance of embracing unknowns, how VCs deal with unpredictability, how our education affects our decision-making ability, venture mindset principles and much more. 
Richie Cotton's photo

Richie Cotton

59 min

See MoreSee More