Skip to content
LaTeX Inline Math: $...$, \(...\) and Display Math

07 Oct 2026

6 min read

LaTeX Inline Math

Inline math is an equation that sits inside a sentence, like "the roots are x = ±2" or "the loss is O(n log n)". LaTeX has two ways to write it, and a separate mode for equations that should stand on their own line. This guide covers both, what changes when math is inline, and how inline equations work outside a LaTeX document, in Markdown, Jupyter and Confluence.

Short answer:

  • Inline math: wrap the expression in single dollar signs, $E = mc^2$, or in \(E = mc^2\).
  • Display math (its own centered line): use \[E = mc^2\]. Avoid $$...$$ in LaTeX documents.

$...$ or \(...\)?

Both produce exactly the same inline equation:

The area of a circle is $A = \pi r^2$.
The area of a circle is \(A = \pi r^2\).

$...$ is shorter and is what almost everyone types. \(...\) is the LaTeX form: the opening and closing delimiters are different, so a missing one gives a clear error instead of silently swapping text and math for the rest of the paragraph. Pick one and use it consistently in a document.

To print a literal dollar sign in text, escape it: \$5.

Display math: \[...\], not $$...$$

When an equation needs its own line, use display math:

The solutions are
\[
  x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
\]
for any quadratic with a ≠ 0.

$$...$$ also produces display math, but it is plain TeX syntax. In a LaTeX document it can give inconsistent spacing above and below the equation and doesn't work with the fleqn option, so \[...\] (or an environment such as equation or align from amsmath) is the recommended form. Many Markdown renderers and web tools do accept $$...$$, which is why you see it so often online.

What changes when math is inline

LaTeX shrinks inline math so it doesn't push the lines of the paragraph apart:

  • Sums, products and limits put their limits to the side instead of above and below. $\sum_{i=1}^{n} x_i$ shows the i = 1 and n next to the sigma, not over and under it.
  • Fractions are set smaller, with the numerator and denominator in a smaller font.
  • Big operators such as integrals are smaller.

That is usually what you want. When it isn't, you can override it:

Goal Write
Limits above and below a sum, inline $\sum\limits_{i=1}^{n} x_i$
A full-size fraction inline $\dfrac{a}{b}$ (amsmath)
A small fraction in display math \[\tfrac{1}{2}\] (amsmath)
Display-size everything in one inline expression $\displaystyle \sum_{i=1}^{n} \frac{1}{i}$

Use these sparingly. A tall inline expression forces extra space between lines, and the paragraph looks uneven. If an inline equation needs \displaystyle to be readable, it probably belongs on its own line.

Text and spacing inside inline math

Inside math, letters are variables and spaces are ignored. So:

  • Words need \text{}: $x > 0 \text{ for all } x \in S$. Without it, "for all" prints as six italic variables with no spaces.
  • Function names need their commands: $\log n$, $\sin x$, $\max(a, b)$. See log and ln in LaTeX.
  • Add space by hand when needed: \, (thin), \; (thick), \quad (wide).
  • Keep punctuation outside the math when it belongs to the sentence: $x = 2$. rather than $x = 2.$.

Inline math in Markdown, GitHub and Jupyter

Most Markdown tools that support math use the same delimiters:

  • GitHub renders $...$ inline and $$...$$ as a block in Markdown files, issues and pull requests. If a dollar sign gets misread, GitHub also accepts the form with backticks inside the dollars, a dollar sign then a backtick before the math and a backtick then a dollar sign after it.
  • Jupyter notebooks render $...$ and $$...$$ in Markdown cells with MathJax.
  • Static site generators and docs tools usually need a math plugin (KaTeX or MathJax) enabled before $...$ renders at all.

Because $ also means money, some renderers only treat $...$ as math when there is no space just inside the dollar signs. $x$ works; $ x $ may not.

Inline math in Confluence

Confluence Cloud has no built-in math, so you need an app. With LaTeX Math for Confluence, type /latex in the editor and choose LaTeX Math (Inline) for an equation inside a sentence or LaTeX Math (Block) for display math.

Delimiters are optional in both macros. The inline macro accepts E = mc^2, $E = mc^2$ or \(E = mc^2\), so you can paste LaTeX from a paper or a Markdown file as it is. If you paste display delimiters such as $$...$$ or \[...\] into the inline macro, they are converted to inline math. Multi-line environments and large matrices belong in the block macro.

The app renders with KaTeX, so the commands in our LaTeX symbols reference that are marked as KaTeX-supported all work. For a full walkthrough, see how to add math equations to Confluence.

Common mistakes

Problem Cause Fix
The rest of the paragraph turns italic A missing closing $ Close the math, or switch to \(...\) so the error is reported
Words inside an equation run together Text typed in math mode Wrap words in \text{}
An inline fraction looks tiny Inline style is applied Use \dfrac once, or move the equation to display math
Lines in the paragraph spread apart A tall inline expression Put the equation on its own line with \[...\]
A price prints as math $ read as a delimiter Escape it as \$

FAQ

What is the difference between $ and $$ in LaTeX? Single dollars give inline math inside a sentence. Double dollars give display math on its own line, but in LaTeX documents \[...\] is preferred.

How do I write inline math in LaTeX without dollar signs? Use \( and \). They behave exactly like $...$.

How do I make a sum show its limits above and below inline? Add \limits: $\sum\limits_{i=1}^{n}$. Or set the whole expression in display style with \displaystyle.

Can I use inline math in a heading? Yes in LaTeX, but use it sparingly, because the math also appears in the table of contents and in PDF bookmarks, where it may not render. In Confluence, put the equation in the body text instead.

Featured App

LaTeX Math

LaTeX equation and formula macros for Confluence, rendered with KaTeX

Stay in the loop

Get product updates and tips straight to your inbox.

No spam, ever.