How to Use LaTeX
Open a free Overleaf account (or install TeX Live or MiKTeX), create a blank project and type a document: \documentclass{article}, then text between \begin{document} and \end{document}. Add headings with \section{}, math between dollar signs like $x^2$, and click Recompile to get the PDF.
The first commands you need
- Text mode, no math preview
\documentclass{article}What kind of document: article, report, book, beamer (slides).
- Text mode, no math preview
\begin{document} ... \end{document}Everything printed goes between these two lines.
- Text mode, no math preview
\section{Introduction}A numbered heading.
- Text mode, no math preview
\textbf{bold} \textit{italic}Text styles.
$a^2 + b^2 = c^2$Math in a sentence.
\[ \sum_{k=1}^{n} k \]Math on its own line.
- Text mode, no math preview
\begin{itemize} \item A \item B \end{itemize}A bullet list.
Try it live
Change the formula and the preview redraws as you type. Copy the LaTeX, download a PNG or SVG, copy it for Word, or use Edit here on any example below to load it.
How to use LaTeX examples
Each result below is drawn from the LaTeX under it. Copy the code, edit it on this page, or open it in the full editor.
Inline-style formula
LaTeXa^2 + b^2 = c^2Normal distribution
LaTeXf(x) = \frac{1}{\sigma\sqrt{2\pi}}\, e^{-\frac{(x-\mu)^2}{2\sigma^2}}Derivative
LaTeX\frac{d}{dx} \sin x = \cos xSystem of equations
LaTeX\begin{cases} x + y = 3 \\ x - y = 1 \end{cases}
In a LaTeX document
These commands work in the text of a .tex document (Overleaf, TeX Live, MiKTeX), not inside math. The box on the right shows what the compiled PDF looks like.
Your first document
LaTeX\documentclass{article} \usepackage{amsmath} \usepackage{graphicx} \title{My First Document} \author{Your Name} \begin{document} \maketitle \section{Introduction} This is \textbf{bold} and this is \textit{italic}. \section{Some Math} Pythagoras: $a^2 + b^2 = c^2$. A displayed formula: \[ \int_0^1 x^2 \, dx = \frac{1}{3} \] \begin{itemize} \item First point \item Second point \end{itemize} \end{document}A small table
LaTeX\begin{tabular}{lr} Item & Price \\ \hline Book & 12.00 \\ Pen & 1.50 \\ \end{tabular}Compiled resultItem Price Book 12.00 Pen 1.50 Reading an error
LaTeX! Undefined control sequence. l.12 \textbf{bold} and \textitt {italic}
Where to write LaTeX
The easiest start is Overleaf in the browser: nothing to install, packages are ready, and the PDF appears next to the source. To work offline, install TeX Live (Windows, Linux), MacTeX (Mac) or MiKTeX, and an editor such as TeXstudio or VS Code with LaTeX Workshop.
LaTeX is not a word processor. You write plain text with commands, then compile it into a PDF. The source is the document; the PDF is the result.
How a document is built
Everything before \begin{document} is the preamble: the document class and the packages (\usepackage{amsmath} for math, graphicx for images). Inside the document, a blank line starts a new paragraph, \section makes headings, and environments (\begin{…} … \end{…}) make lists, tables, figures and multi-line equations.
Math is where LaTeX shines: put formulas between $ … $ inside sentences or \[ … \] on their own line. Use ^ for powers, _ for indices, \frac{}{} for fractions and named commands like \alpha and \sum for symbols.
Compiling and fixing errors
Click Recompile in Overleaf, or run pdflatex file.tex locally. When it fails, read the first error: it names the problem ("Undefined control sequence", "Missing $ inserted") and the line number after l.. Fix the first error first; later ones are often caused by it.
Already have formulas in a PDF, a photo or on paper? The image to LaTeX converter on this site turns a screenshot into LaTeX you can paste into your document.
Common mistakes
The document class must be the first command; anything printed before it fails.
Instead ofText before \documentclassWrite\documentclass{article} firstMath commands only work in math mode.
Instead ofx^2 written in textWrite$x^2$Packages can only be loaded before the document starts.
Instead of\usepackage{graphicx} after \begin{document}WritePackages in the preamble
In Overleaf, MathJax and Word
Overleaf and pdfLaTeX
Overleaf is the quickest start: New Project › Blank Project gives a working template; Recompile builds the PDF.
MathJax and KaTeX
On websites and in apps such as Notion, Obsidian and Jupyter, only the math part of LaTeX is used, rendered by MathJax or KaTeX; there is no document to compile.
Microsoft Word
Word for Microsoft 365 accepts LaTeX math in its equation editor (Equation › LaTeX), but not whole LaTeX documents.
Already have the whole document?
Move complete papers between PDF, Word and LaTeX without retyping; every equation stays editable.
- PDF to LaTeXTurn a paper or textbook PDF into a .tex project with every equation.10 credits per page
- Word to LaTeXA .docx with Word equations becomes LaTeX ready for Overleaf.10 credits per page
- LaTeX to WordA whole .tex file becomes a .docx whose equations open in Word.5 credits per file
Single printed formulas are free: 3 a day without an account, 6 with a free account. New accounts get 30 credits to try handwriting, pages and documents; failed conversions return their credits. See plans and credit prices.
How to use LaTeX in LaTeX: questions
- Is LaTeX hard to learn?
- The basics take an afternoon: a document skeleton, sections, lists and simple math. Tables and figures take a little longer.
- Is LaTeX a programming language?
- It is a markup language for typesetting. It has commands and macros, but you mostly write text and formulas.
- Do I need to install anything?
- No. Overleaf runs in the browser. Install TeX Live, MacTeX or MiKTeX only if you want to work offline.
- Is LaTeX still worth learning?
- Yes for math-heavy writing: journals, theses and lecture notes in STEM use it, and its math syntax works in Word, Notion, Markdown and many apps.
Related LaTeX reference
- Math Mode in LaTeXInline math with $…$ or \(…\), displayed math with \[…\], numbered equation environments, references and \text inside formulas.
- LaTeX SymbolsThe most-used math symbols in one table: relations, operators, sets, logic, arrows, Greek letters and accents, each with its command.
- LaTeX equation editorSymbol panel, live preview, and PNG, SVG, MathML or Word export.
- All LaTeX reference pagesSymbols, math structures and text formatting in one list.
Have the formula as a picture?
Paste a screenshot or photo of the equation and get its LaTeX, ready to copy or open in the editor.
Convert an image to LaTeX