Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
Inline math in LaTeX is a formula set inside a running line of text. You write it between \( ... \), between $ ... $, or inside a math environment; all three produce the same result, and the Overleaf documentation says the choice is a matter of taste while noting that standard LaTeX practice is \( ... \). A formula that should sit on its own line is display math and uses \[ ... \], displaymath or equation instead. This guide shows the delimiters side by side, explains why the same formula looks different inline and in display mode, and covers the style commands that override the default.
What LaTeX inline math is used for in research
LaTeX has two modes for mathematics. In the Overleaf documentation, inline mode is for formulas that are part of a paragraph, and display mode is for formulas that appear on separate lines. In a manuscript, inline math carries the short expressions that belong to the sentence: a variable (\(x\)), an inequality, a parameter with a subscript, a short relation such as \(E=mc^2\). Anything long, anything you want to refer to by number, and anything built from tall constructs such as stacked fractions or sums with limits usually belongs in display mode, because inline mode compresses the formula to fit the line.
Research writing also uses inline math for a reason that is easy to miss: consistency of symbols. Overleaf notes that in math mode variables are set in italics, operators are set upright, and spacing differs from ordinary text. A variable typed as plain text in a sentence is therefore typeset differently from the same variable in math mode. Putting every symbol in math mode, even a single letter, keeps the typography uniform throughout a paper. The Overleaf example sentence shows the pattern: In natural units ($c$ = 1), ... wraps even a lone c in inline delimiters.
Inline math is the subject of this page; the symbols you put inside the delimiters are covered in the guide to LaTeX math signs and symbols, and multi-line and aligned equations are covered in the LaTeX amsmath guide.
How to install or access LaTeX inline math
Nothing needs installing to write inline math. The delimiters \( \) and $ $ and the math, displaymath and equation environments are described in the LaTeX2e reference manual as part of standard LaTeX math formulas, so a plain document with \documentclass and a document environment is enough. Write the formula in the body of the document, in the main .tex file, and compile it with whichever LaTeX engine or online editor you normally use.
One display construct does need a package. Overleaf states that the equation* environment (an unnumbered equation) is provided by the amsmath package, and its example loads it with \usepackage{amsmath} in the preamble. According to the CTAN package page, amsmath is part of the LaTeX required distribution, and it loads amsbsy, amsopn and amstext, the last of which provides text embedded in mathematics. You therefore do not download amsmath separately in a standard installation; you only add the \usepackage line.
How to write inline math step by step
- Decide that the formula belongs in the sentence. Short expressions that read as part of the text are inline. Long or numbered formulas are display math (see the later sections).
- Choose a delimiter. Overleaf lists three inline forms:
\( ... \),$ ... $and\begin{math} ... \end{math}. It states that all three work. Overleaf describes\( ... \)as standard LaTeX practice, and the LaTeX2e reference manual calls it the preferred form and describes themathenvironment as rarely used. Pick one and use it consistently across the whole document. - Type the formula between the delimiters. The Overleaf page gives this comparison, where the three lines produce the same output:
by the equation \(E=mc^2\), discovered in 1905 by Albert Einstein.by the equation $E=mc^2$, discovered in 1905 by Albert Einstein.by the equation \begin{math}E=mc^2\end{math}, discovered in 1905 by Albert Einstein. - Leave the formula in the same paragraph. Inline math is part of the paragraph, so you do not start a new line or a new environment for it. The Overleaf basic example places an inline formula and a display formula in the same passage:
The well known Pythagorean theorem \(x^2 + y^2 = z^2\) wasfollowed by the display formula\[ x^n + y^n = z^n \]. - Put every symbol in math mode. Wrap single variables and parameters as well, as in
($c$ = 1), so italic variables and upright operators come out consistently. - Compile and look at the line. Inline math is the mode in which fractions, sums and limits are set smaller; if the result looks cramped, move to display mode or apply a style command (below).
Choosing between the three inline forms
The delimiter table below lists the inline and display forms with what each does. For inline math the practical point is the one both sources make: the forms are interchangeable in output, so the decision is about house style and readability. A team that standardises on \( \) follows the form both documents identify as standard or preferred. Authors who already write $ $ get the same result, and Overleaf says it can be used to get the same result as \( \). The math environment is the verbose form and is described as rarely used, which is a reason to avoid it unless a template or collaborator requires it.
Worked example: one sentence, three kinds of math
Consider a methods sentence that mixes a small expression, a parameter and a longer relation. Written with the forms above, the source could read:
The estimate \(\hat{y}\) is computed for each sample, with $n$ observations in total, and the model is followed on its own lines by \[ f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \]. The first two formulas are short, so they stay in the sentence; the third is a sum with limits and a fraction, which is exactly the kind of expression Overleaf sets as a separate display formula in its inline-versus-display example (the same formula, written once with \( ... \) and once with \[ ... \]). Mixing the two inline delimiters in one sentence, as above, is allowed because they are equivalent, but a published manuscript reads more cleanly if you keep to one.
This example is illustrative: it is a constructed sentence meant to show how the forms combine, not a quotation from any paper.
How to read the output: inline versus display
The same formula does not look the same in the two modes. The Overleaf page on display style says that inline math takes less space than math set on its own line, and that display style changes the size and placement of symbols such as \sum as well as the size and positioning of superscripts, subscripts and fractions. Overleaf demonstrates this with one expression written twice:
\( f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \) (inline) and \[ f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \] (display).
When you read your compiled output, look for three things. First, whether the sum and fraction are legible at the size inline mode gives them. Second, whether the line spacing around the formula is still even: taller constructs can push lines apart. Third, whether you need the formula to be referenced later, in which case it should be in a numbered display environment rather than inline. The numbering rule is simple. According to the Overleaf page, display math has two versions, numbered and unnumbered. The LaTeX2e reference manual states that the only difference between displaymath and equation is that equation puts a formula number alongside the formula.
Style commands that change the size of a formula
LaTeX lets you override the style that the mode would normally choose. The four commands in the Overleaf documentation are listed in the table below, with Overleaf’s description of each.
| Command | What it applies | Typical use |
|---|---|---|
\textstyle |
The style used for mathematics typeset in paragraphs | Make a formula in a display behave like inline math |
\displaystyle |
The style used for mathematics typeset on lines by themselves | Make an inline formula use display-sized fractions and sums |
\scriptstyle |
The style used for subscripts or superscripts | Set a piece of a formula at script size |
\scriptscriptstyle |
The style used for second-order subscripts or superscripts | Set a piece of a formula at second-order script size |
The overriding example in the Overleaf documentation is \(\displaystyle f(x) = \frac{1}{1+x}\), which keeps the formula in the paragraph but typesets it in display style. Overleaf adds a warning: this choice “does impact heavily on the line spacing.” In practice, a \displaystyle fraction inside a sentence is taller than the surrounding text, so the line holding it is spaced out. Use it sparingly, and prefer a proper display equation when a formula needs the larger style throughout.
The same page also shows \displaystyle applied inside a display to part of a nested fraction, taken from The TeXbook (page 142): \[a_0+{1\over\displaystyle a_1+{1\over\displaystyle a_2+{1 \over\displaystyle a_3 +{1 \over\displaystyle a_4}}}}\]. This shows that the style commands are not only an inline tool; they also adjust parts of a display formula, and Overleaf writes the display with \[ ... \]. If you need fraction commands in particular, the guides on LaTeX \dfrac and the LaTeX fraction slash cover them.
The data table below sets out the six main delimiter forms (three inline, three display, plus the amsmath starred variant) with their mode, numbering and package requirement, compiled from the Overleaf and LaTeX2e documentation.
Troubleshooting LaTeX inline math
The formula looks too small or cramped
This is the expected behaviour of inline mode, not an error. Per the Overleaf page, inline math uses less space than display math, so sums, scripts and fractions are set smaller. The fix is a decision rather than a repair: if the formula matters to the argument, move it to \[ ... \]; if it must stay in the paragraph and you can accept uneven line spacing, add \displaystyle as shown above.
The lines around an inline formula are spaced unevenly
Overleaf identifies \displaystyle in an inline formula as the thing that impacts line spacing heavily. Remove the override, or rewrite the sentence so the large formula sits in a display.
You need an unnumbered display equation and equation* is not recognised
Overleaf states that equation* is provided by the amsmath package. Add \usepackage{amsmath} to the preamble. If you do not want to load a package, \[ ... \] is equivalent to \begin{displaymath} ... \end{displaymath} according to the LaTeX2e reference manual, and Overleaf describes it as the unnumbered form.
A display construct does not work where you put it
The LaTeX2e reference manual states that the display environments can only be used in paragraph mode. A display belongs between pieces of text in the body of a paragraph, so it cannot be placed inside another formula. Keep short formulas inline in the sentence and end the sentence around a display when you need one.
Text and symbols come out in the wrong style
Per Overleaf, math mode sets variables in italics, operators upright and spacing differently from text. If a word or label inside a formula is rendering as italic variables, it is being treated as math. The amsmath package, which CTAN lists as loading amstext, is the package route for text embedded in mathematics.
Free alternatives to LaTeX inline math
If inline math is the wrong tool for a given formula, LaTeX offers other ways to present it. The table lists the alternatives named in the documentation read for this guide.
| Alternative | When it fits | Source detail |
|---|---|---|
\[ ... \] |
A formula that should sit on its own line without a number | Equivalent to displaymath (LaTeX2e reference); unnumbered in the Overleaf example |
equation |
A display formula that you want numbered | The LaTeX2e reference manual: the difference from displaymath is the formula number |
equation* (with amsmath) |
A display formula with no number, through the starred environment | Provided by amsmath (Overleaf) |
\(\displaystyle ... \) |
A formula that must stay in the paragraph but needs display-style fractions and sums | Overleaf warns of a heavy impact on line spacing |
For environments beyond these, such as aligned or multi-line equations, the amsmath package is the standard route and the LaTeX amsmath guide walks through it.
Choosing the right form: a short decision aid
- Is the expression short and part of the sentence? Use
\( ... \)(or$ ... $if that is your house style). - Does it contain a tall construct, such as a sum with limits or a stacked fraction, that is hard to read at inline size? Use display mode.
- Do you need to refer to it by number later? Use the
equationenvironment. - Do you want display layout without a number? Use
\[ ... \], orequation*if amsmath is loaded. - Must it stay in the paragraph but at display size? Apply
\displaystyle, and accept the line-spacing cost Overleaf describes.
Whichever you choose, apply it the same way throughout a document. Journals and thesis templates may impose their own conventions for how formulas are presented, and those take precedence over the general documentation described here; check the instructions of the venue you are writing for.
Sources
- Overleaf: Mathematical expressions, checked 2026-11-17
- Overleaf: Display style in math mode, checked 2026-11-17
- LaTeX2e: An unofficial reference manual: Math formulas, checked 2026-11-17
- CTAN: amsmath package, checked 2026-11-17
Data: LaTeX math delimiter forms: mode, numbering and package requirement
A comparison of the inline and display math forms in LaTeX (the three inline delimiters, the three display forms and the amsmath starred equation), with the mode each produces, whether it is numbered, whether it needs amsmath, and what the documentation says about it. Compiled from the Overleaf documentation on mathematical expressions and the LaTeX2e unofficial reference manual.
| Form | Mode | Numbered | Needs amsmath | Documentation note |
|---|---|---|---|---|
| \( ... \) | Inline | No | No | Described as standard LaTeX practice (Overleaf) and the preferred form (LaTeX2e reference) |
| $ ... $ | Inline | No | No | Gives the same result as \( ... \) (Overleaf) |
| \begin{math} ... \end{math} | Inline | No | No | Listed as an inline form (Overleaf); described as rarely used (LaTeX2e reference) |
| \[ ... \] | Display | No | No | Equivalent to the displaymath environment (LaTeX2e reference) |
| \begin{displaymath} ... \end{displaymath} | Display | No | No | Listed as a display form (Overleaf) |
| \begin{equation} ... \end{equation} | Display | Yes | No | Only difference from displaymath is the formula number (LaTeX2e reference) |
| \begin{equation*} ... \end{equation*} | Display | No | Yes | The equation* environment is provided by amsmath (Overleaf) |
Sources
- Overleaf: Mathematical expressions (accessed 2026-11-17)
- LaTeX2e: An unofficial reference manual: Math formulas (accessed 2026-11-17)
- CTAN: amsmath package (accessed 2026-11-17)
Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.







