The best Latex editor

LaTeX Tutorial — Lesson 3

Typesetting Math and Tables in LaTeX

Lesson 3: Typesetting Math and Tables in LaTeX

One of the biggest reasons people use LaTeX is its outstanding support for mathematical notation and structured tables. From basic equations to complex formulas and perfectly aligned tables, LaTeX gives you powerful tools to format technical content with precision and elegance.

In this lesson, you’ll learn:

  • How to write math formulas using math mode

  • How to format inline and display equations

  • How to build clean, readable tables using the tabular environment

Writing Math in LaTeX

LaTeX uses math mode to typeset formulas. There are two types of math environments:

Inline Math

Used when math appears in the middle of a sentence.

Output: Einstein said E = mc² in his paper.

Wrap the formula in single dollar signs $...$ to render inline.

Display Math

Used when you want to show a formula on its own line, centered and (optionally) numbered.

\[ e^{i\pi} + 1 = 0 \]

This displays the famous identity centered on the page. You can also use $$...$$ (an older syntax), or the equation environment for numbered equations:


You can reference this equation later using:

Math Syntax and Examples

Symbol

Syntax

Output

Fractions

\frac{1}{2}

½ 

Square root

\sqrt{x}

√x

nth root

\sqrt[n]{x}

ⁿ√x 

Superscript

$x^2$

x² 

Subscript

$x_1$

x₁ 

Combined

$x_{avg}^2$

x²_avg 

Summation

\sum_{n=1}^{\infty} n^{-2}

∑ₙ₌₁^∞ n⁻² 

Integral

\int_0^1 x^2 \, dx

∫₀¹ x² dx 

Greek letters

\alpha, \beta, \pi

α, β, π 

Need special symbols? You can find comprehensive symbol sheets online or use tools like Detexify to draw a symbol and get its command.

Creating Tables in LaTeX

LaTeX’s tabular environment lets you define rows and columns for precise tables.

Basic Table
\begin{tabular}{|c|c|c|}
  \hline
  Cell1 & Cell2 & Cell3 \\
  \hline
  A & B & C \\
  \hline
  X & Y & Z \\

How It Works:
  • \begin{tabular}{|c|c|c|} → Creates a table with 3 centered columns (c) and vertical lines (|)

  • Cells in each row are separated by &

  • Each row ends with \\

  • \hline adds horizontal lines

You can change column alignment by replacing c with:

  • l → left-aligned

  • r → right-aligned

Remove | and \hline if you prefer no borders.

Table with Header
\begin{tabular}{l r}
  \textbf{Item} & \textbf{Price} \\
  \hline
  Coffee & \$2.50 \\
  Donut & \$1.25 \\

Use \textbf{} for bold headers. Escape the dollar sign as \$ if you’re not in math mode.

Table with Caption and Label

To reference a table and add a caption, wrap it in the table environment:

\begin{table}[h]
  \centering
  \begin{tabular}{l r}
    \textbf{Item} & \textbf{Price} \\
    \hline
    Coffee & \$2.50 \\
    Donut & \$1.25 \\

  • \caption{...} adds a numbered caption under the table

  • \label{...} lets you reference it later:
    "See Table~\ref{tab:menu} for the price list."

  • [h] suggests placing the table “here” (LaTeX may move it for layout reasons)

Tips for Table Alignment
  • Each row must have the same number of columns (same number of &)

  • \hline is optional — use it for visual clarity

  • To nest math inside a table, wrap it in $...$ like: $x^2$

  • For larger tables, packages like tabularx, longtable, or booktabs can help (covered in advanced lessons)

Recap

In this lesson, you learned how to:

  • Use inline and display math modes

  • Format fractions, roots, exponents, Greek letters, and more

  • Number and reference equations with \label and \ref

  • Build basic tables with borders, headers, and references

Practice by adding a formula and a small table to your Crixet document. Try combining both in one document — maybe a list of formulas in a table?

Up Next

In Lesson 4, we’ll learn how to format and style your document — customizing fonts, adding spacing, aligning content, and more. These tools will help make your document not just functional, but beautiful.

Let’s move on!