MarkDone
Reference

LaTeX syntax guide

Updated June 2026 ยท 7 min read

This guide is a practical reference for writing LaTeX syntax: commands, arguments, math mode, symbols, equations, special characters, lists, tables, and the errors that usually break a document.

If you are still deciding whether LaTeX is the right tool, start with What is LaTeX?. This page assumes you want the syntax itself and need examples you can copy, edit, and use.

Basic LaTeX command syntax

Most LaTeX commands start with a backslash. A command may stand alone, take one required argument in curly braces, or take optional settings in square brackets.

\command
\command{required argument}
\command[optional setting]{required argument}

The braces tell LaTeX exactly what the command should apply to.

PatternExampleMeaning
Command only\LaTeXPrints the LaTeX logo.
Required argument\textbf{Important}Makes only the text inside braces bold.
Optional setting\includegraphics[width=0.8\textwidth]{chart.png}Includes an image with a width option.
Environment\begin{itemize} ... \end{itemize}Wraps a larger block such as a list, table, or equation.

Text formatting syntax

For normal text, LaTeX formatting commands usually wrap the text you want to style.

\textbf{bold text}
\textit{italic text}
\underline{underlined text}
\emph{emphasized text}

Use braces carefully. If you write \textbf important, LaTeX applies the command only to the next token, not to the full phrase. The predictable version is \textbf{important}.

Math mode syntax

LaTeX treats math differently from normal text. Inline math sits inside a sentence. Display math appears on its own line.

Use caseSyntaxExample
Inline math$...$The value is $x^2$.
Display math\[...\]\[E = mc^2\]
Numbered equationequation\begin{equation} ... \end{equation}
Aligned equationsalign\begin{align} ... \end{align}
Inline math: $a^2 + b^2 = c^2$

Display math:
\[
a^2 + b^2 = c^2
\]

Many Markdown tools also support LaTeX-style math. Inline formulas usually use $...$, while larger formulas often use $$...$$ or \[...\], depending on the renderer.

Equations, powers, fractions, and roots

These are the LaTeX math patterns you will use constantly.

ResultLaTeX syntax
Superscriptx^2
Subscriptx_i
Grouped superscriptx^{n+1}
Grouped subscripta_{ij}
Fraction\frac{a}{b}
Square root\sqrt{x}
Nth root\sqrt[n]{x}
Sum\sum_{i=1}^{n} i
Integral\int_0^1 x^2\,dx
\[
\frac{x^{n+1}}{n+1}
\]

\[
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
\]

\[
\int_0^1 x^2\,dx = \frac{1}{3}
\]

Use braces when a superscript, subscript, numerator, or denominator contains more than one character.

Greek letters and common symbols

Greek letters and mathematical symbols are written as commands. The command name usually matches the symbol name.

CategoryExamples
Greek letters\alpha, \beta, \gamma, \theta, \lambda, \pi, \sigma, \omega
Uppercase Greek\Delta, \Gamma, \Lambda, \Omega, \Sigma
Relations\leq, \geq, \neq, \approx, \equiv
Operators\times, \div, \cdot, \pm, \mp
Sets\in, \notin, \subset, \cup, \cap, \emptyset
Logic\forall, \exists, \Rightarrow, \Leftrightarrow, \neg
\[
\alpha + \beta \leq \gamma
\]

\[
x \in A \Rightarrow x \notin \emptyset
\]

Special characters and escaping

Some characters have special meaning in LaTeX. To print them as normal text, you usually need to escape them with a backslash.

CharacterMeaning in LaTeXPrint it with
%Starts a comment\%
$Starts or ends math mode\$
_Subscript in math mode\_
&Alignment marker\&
#Macro parameter\#
{ }Groups command arguments\{ \}
Use 100\% of the sample.
The file name is report\_final.md.
The price is \$10.

Lists, tables, figures, and links

LaTeX uses environments for structured blocks. Each environment begins with \begin{name} and ends with \end{name}.

Bulleted and numbered lists

\begin{itemize}
  \item First point
  \item Second point
\end{itemize}

\begin{enumerate}
  \item First step
  \item Second step
\end{enumerate}

Tables

\begin{tabular}{lll}
Name & Type & Value \\
x & variable & 10 \\
y & variable & 20
\end{tabular}

In a table, & separates columns and \\ starts a new row. The column definition {lll} means three left-aligned columns.

Figures and links

\includegraphics[width=0.8\textwidth]{chart.png}

\href{https://example.com}{Example link}

Images normally require the graphicx package. Links normally require the hyperref package.

Common LaTeX syntax errors

Most LaTeX syntax errors come from missing delimiters, unescaped special characters, or using math syntax outside math mode.

ErrorLikely causeFix
Missing $ insertedYou used math syntax in normal text.Wrap the expression in $...$ or \[...\].
Runaway argumentA closing brace is missing.Check commands like \textbf{...} and \frac{...}{...}.
Undefined control sequenceA command is misspelled or needs a package.Check spelling, then check whether the package is loaded.
Misplaced alignment tabAn & appears outside a table or align environment.Escape it as \& or move it into the right environment.
Extra alignment tabA table row has too many & markers.Match the number of cells to the column definition.
When a LaTeX document breaks, check braces first, math delimiters second, and special characters third. That catches a large share of syntax problems.

LaTeX syntax cheat sheet

TaskSyntax
Bold text\textbf{bold}
Italic text\textit{italic}
Inline math$x^2$
Display math\[x^2\]
Fraction\frac{a}{b}
Subscript and superscriptx_i^2
Greek letter\alpha
Square root\sqrt{x}
Bulleted list\begin{itemize} \item ... \end{itemize}
Numbered list\begin{enumerate} \item ... \end{enumerate}
Escape percent\%
Escape underscore\_
Write Markdown with LaTeX-style math Use Markdown for structure, add LaTeX syntax for formulas, and export the result to PDF in your browser.
Open Markdown to PDF

FAQ

Is LaTeX syntax the same in every tool?

The core math syntax is widely reused, but support varies. A full LaTeX compiler supports more packages and document commands than most Markdown editors, note apps, or browser renderers.

Should I use $...$ or \(...\) for inline math?

Both are common. Many Markdown tools prefer $...$ because it is short. In full LaTeX documents, \(...\) is also a clean inline math delimiter.

Why does an underscore break my text?

In math mode, _ creates a subscript. In normal text, an underscore often needs to be escaped as \_, especially in file names such as report\_final.md.

For the broader explanation of what LaTeX is and where it fits, read What is LaTeX?. If your formulas are already in Markdown, you can render them with Markdown to PDF or export repository docs with README to PDF.