Skip to content
EasyLaTeXDocs

Math Environments and Symbols

Use \(...\) for inline formulas in the body text, and use \[...\] to display formulas separately. Spaces, letters, and symbols in math mode follow mathematical typesetting rules, unlike those in ordinary body text.

EasyLaTeX compiler setting: pdfLaTeX + article. Basic math mode requires no additional packages; when \text, alignment, or complex structures are needed, load amsmath.

Inline Formulas

Place the short formula between \( and \):

latex
Mass-energy equivalence is  \(E = mc^2\).

Inline formulas and text appear in the same paragraph, making them suitable for variables, short equations, and a small number of symbols. Do not force very long derivations into inline text, as this will result in unattractive line breaks.

Standalone Formulas

Place formulas that need to be displayed separately and not numbered between \[ and \]:

latex
\[
  f(x) = x^2 + 2x + 1.
\]

Standalone equations will be centered. If you need to cite one in the body text later, use the equation environment; see Equation Numbering and References.

Variables, Text, and Units

In math mode, English letters are treated as variables by default and displayed in italics:

latex
Let  \(x\)  be the independent variable; \(y = f(x)\).

When inserting ordinary text within a formula, after loading amsmath, use \text{...}:

latex
\usepackage{amsmath}

\[
  x > 0 \quad\Longrightarrow\quad \sqrt{x} \text{ is defined.}
\]

Units are not variables; they are usually set upright, with an appropriate space after the numerical value:

latex
\[
  v = 20\,\mathrm{m/s}.
\]

\, is a small mathematical space; \mathrm typesets units in upright text. Complex unit typesetting can use dedicated packages in later specialized topics, but units should not be written directly as a string of letters that look like variables.

Common Symbols

The following commands must all be used in math mode:

MeaningSyntaxEffect
Greek letters\alpha, \beta, \Gammaα, β, Γ
Operational relations\leq, \geq, \neq, \approx≤, ≥, ≠, ≈
Set relations\in, \subseteq, \cup, \cap∈, ⊆, ∪, ∩
Arrows\to, \Rightarrow, \leftrightarrow→, ⇒, ↔
Large operators\sum, \prod, \int∑, ∏, ∫

For example:

latex
\[
  A \subseteq B \Rightarrow A \cap B = A.
\]

Symbol commands should use English names; do not copy seemingly identical Unicode symbols from PDFs as substitutes. Commands are easier to search for and more stable.

Spaces and Punctuation

Mathematical mode ignores ordinary spaces:

latex
\(a    +    b\)

The spacing is the same as \(a+b\). Use \,, \:, \;, or \! only when fine-tuning is needed. English full stops, commas, and other punctuation are usually placed outside math mode:

latex
When  \(x = 0\), the function reaches its minimum.

Common Misuses

Surround all formulas with dollar signs

$...$ can also enable inline math mode, but the boundaries of \(...\) are clearer and less likely to be confused with currency symbols or complex Markdown. This tutorial consistently uses \(...\).

Writing English Directly in Formulas

Writing words directly in math mode, such as \[x greater than 0\], treats them as mathematical variables and gives incorrect spacing. Write the relation as \[x > 0\]. For words within a formula, load amsmath and use \text{...}; otherwise put the explanation in the surrounding prose.

Displaying formulas with $$...$$

$$...$$ is plain TeX syntax and may conflict with LaTeX environments and spacing mechanisms. Use \[...\], or use equation when numbering is needed.

Complete Example

latex
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}

\begin{document}

Mass-energy equivalence:  \(E = mc^2\).

\[
  A \subseteq B \Rightarrow A \cap B = A.
\]

\[
  v = 20\,\mathrm{m/s}.
\]

\[
  x > 0 \quad\Longrightarrow\quad \sqrt{x} \text{ is defined.}
\]

\end{document}
Math Environments and Symbols | EasyLaTeX | EasyLaTeX