LaTeX Tutorial
Introduction
This tutorial was born in 2012 as a set of personal notes — things I was learning about LaTeX and didn't want to forget. Over the years I kept it as a reference, and now in 2026 I decided to rewrite it from scratch — updating tools, workflows, and examples — while keeping the original spirit: a practical guide written by someone who actually uses LaTeX, not a textbook.
What is LaTeX?
LaTeX is a document preparation system built on top of the TeX typesetting program. Unlike Word or Google Docs, you don't see the result as you type — you write plain text with formatting marks, then compile the document to get the final PDF. It's closer to programming than to using a word processor.
That might sound complicated at first, but it's exactly what makes it powerful.
What is it used for?
LaTeX is primarily used for academic documents, technical books, and scientific papers. But it's also excellent for memos, CVs, formal letters, and professional reports — any document where presentation matters.
If you've ever opened a math or physics paper and wondered how they achieve that clean, precise typography, the answer is almost always LaTeX.
Total control over your document
One of the things I like most about LaTeX is that it completely separates content from formatting. You write the text in a plain text editor, define the sections, and control the style in a centralized way. Changing the font, margins, or heading style across the entire document is a matter of modifying a few lines — not selecting text page by page.
Portability and file size
.tex files are plain text. That means you can edit them on any operating system — Linux, Mac, Windows — with any editor. It also means they're tiny, you can version them with git, and collaborating with others doesn't depend on proprietary formats.
I work primarily on Linux, and LaTeX fits perfectly into that workflow: text editor, command line, git.
Professional quality typography
The visual quality of LaTeX documents is noticeably superior to that of any word processor, especially when mathematical formulas are involved. LaTeX automatically applies professional typographic rules — letter spacing, paragraph separation, text justification — things you have to adjust manually in Word and that never quite look right anyway.
Installation
Linux
sudo apt-get install texlive-full
texlive-full installs everything. It's large (~4GB), but it saves you from missing packages at the worst possible moment. If disk space is a concern, texlive-latex-extra is a reasonable middle ground.
Mac
Download MacTeX — it's the equivalent of texlive-full for macOS.
Windows
Install MiKTeX or TeX Live for Windows.
Online (no installation needed)
Overleaf is an online LaTeX editor that runs directly in the browser. It's ideal for getting started, for collaborating, or for working on a machine where you can't install software. Today it's probably the most common way to work with LaTeX, especially in academic settings.
Editors
If you prefer to work locally, these are the most widely used options today:
- TexMaker — the one I used when I wrote the original version of this tutorial. Cross-platform, free, with an integrated PDF viewer. Still a solid choice.
- VS Code + LaTeX Workshop extension — if you already use VS Code for other things, this extension turns it into a very capable LaTeX environment with autocompletion, automatic compilation, and an integrated viewer.
- Overleaf — the online option mentioned above.
Your First Document
Create a file with a .tex extension and write this:
\documentclass[12pt, letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{margin=2.5cm}
\title{My First Document}
\author{Guillermo Garr\'{o}n}
\date{June, 2026}
\begin{document}
\maketitle
\section{Introduction}
This is my first document in \LaTeX{}.
\section{Conclusion}
That wasn't so hard.
\end{document}
To compile it and get the PDF:
pdflatex my_document.tex
That generates my_document.pdf directly. The old workflow (latex → dvipdf) is no longer necessary in most cases.
Control Sequences and Special Characters
Commands in LaTeX are called control sequences and start with \. For example, \textbf{text} makes text bold.
The following characters have special meaning and can't be used directly in regular text:
| Character | Use |
|---|---|
\ |
Starts control sequences |
{} |
Delimits the scope of a command |
$ |
Opens and closes math formulas |
^ |
Superscript (inside formulas) |
_ |
Subscript (inside formulas) |
% |
Comment — the rest of the line is ignored |
& |
Column separator in tables |
# |
Argument in command definitions |
~ |
Non-breaking space |
To write these characters literally in the text, most of them are escaped with \: for example \% produces %.
Text Formatting
\textbf{bold}
\textit{italic}
\underline{underlined}
\texttt{monospace font}
Sections:
\section{Main Section}
\subsection{Subsection}
\subsubsection{Sub-subsection}
Lists:
% Bullet list
\begin{itemize}
\item First item
\item Second item
\end{itemize}
% Numbered list
\begin{enumerate}
\item First item
\item Second item
\end{enumerate}
Margins
Instead of calculating margins manually as was done in the old days, today there's the geometry package that makes it much simpler:
\usepackage{geometry}
\geometry{
top=2.5cm,
bottom=2.5cm,
left=3cm,
right=2.5cm
}
Figures and Images
\usepackage{graphicx}
Then, where you want to insert the image:
\begin{figure}[h]
\centering
\includegraphics[width=0.8\textwidth]{my_image.png}
\caption{Image description}
\label{fig:my_image}
\end{figure}
The [h] parameter tells LaTeX to place the figure here. The options are h (here), t (top of page), b (bottom) and p (separate page).
With pdflatex you can use PNG, JPG and PDF files directly. Converting to EPS is no longer necessary.
Tables
Tables in LaTeX are more verbose than in Word, but far more controllable:
\begin{table}[h]
\centering
\begin{tabular}{|l|c|r|}
\hline
\textbf{Country} & \textbf{Capital} & \textbf{Population} \\
\hline
Bolivia & Sucre & 12 million \\
Paraguay & Asunción & 7 million \\
Uruguay & Montevideo & 3.5 million \\
\hline
\end{tabular}
\caption{South American Countries}
\label{tab:countries}
\end{table}
Column specifiers are: l (left-aligned), c (centered), r (right-aligned). The | adds vertical lines.
Math Formulas
This is perhaps the most compelling reason to use LaTeX. For inline formulas use $...$, and for block formulas use the equation environment:
% Inline
Euler's formula is $e^{i\pi} + 1 = 0$.
% Block, numbered
\begin{equation}
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
\end{equation}
% Block, unnumbered
\begin{equation*}
f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty} \left( a_n \cos\frac{n\pi x}{L} + b_n \sin\frac{n\pi x}{L} \right)
\end{equation*}
Add \usepackage{amsmath} to access the full set of math tools.
Bibliography
For academic or technical documents, BibLaTeX is the modern standard:
\usepackage[backend=biber, style=apa]{biblatex}
\addbibresource{references.bib}
The references.bib file contains the bibliographic entries:
@book{knuth1984,
author = {Donald E. Knuth},
title = {The TeXbook},
year = {1984},
publisher = {Addison-Wesley}
}
In the text you cite with \cite{knuth1984}, and print the bibliography with \printbibliography.
An Alternative: Pandoc
If you already write in Markdown — which is much simpler — you can write your content there and convert it to LaTeX or directly to PDF using Pandoc:
pandoc -s document.md -o document.pdf
pandoc -s document.md -o document.tex
It's a very practical option for documents where content matters more than fine typographic control. I use it regularly for that reason.
Created: November, 2012
Last edited: June, 2026
By: Guillermo Garron