Written and maintained by CASRAI Editorial Board
Published
On this page
Quick answer: In LaTeX math mode, write standard intervals using square brackets and round parentheses directly from your keyboard: [a, b] for a closed interval, (a, b) for an open interval, and [a, b) or (a, b] for half-open intervals. For tall expressions like fractions, wrap them in left and right to auto-scale the fences. To typeset ISO reversed-bracket intervals like ]a, b[ without horizontal kerning errors, use the CTAN interval package via usepackage{interval} and interval[open]{a}{b}, or wrap delimiters manually in mathopen{]} and mathclose{[}.
What it is used for in research
Researchers in mathematics, statistics, econometrics, physical sciences, and computer science routinely use interval notation to define subsets of the real number line, bounded parameter spaces, and numerical uncertainty bounds. Typical research applications include:
- Domain and range definitions: Specifying allowable parameters or function domains, such as
x in [0, 1]for probability distributions ortheta in [0, 2pi)for periodic functions. - Statistical estimation bounds: Reporting empirical boundaries, credible intervals, or a confidence interval (for example, 95% CI
[0.14, 0.88]) in methodology tables and results sections. - Set-theoretic operations: Combining continuous numerical regions with set operations, such as unions (
cup) and set intersection (cap). - Optimization and bounds: Defining constraint spaces in numerical algorithms, search spaces in hyperparameter tuning, and convergence intervals in mathematical proofs.
International standards—specifically ISO 80000-2:2019 (superseding ISO 31-11) for mathematical signs and symbols—define two widely recognised conventions for open endpoints: round parentheses (a, b) common in Anglo-American literature, and reversed square brackets ]a, b[ common in European, French, and Bourbaki mathematical traditions. LaTeX supports both conventions, but standard TeX spacing rules require specific handling for reversed brackets to avoid typographical flaws. For general delimiter rules, see our reference on parentheses in LaTeX and paired delimiters in absolute value in LaTeX.
Install or access (official source only)
Depending on your formatting requirements, you can write intervals in LaTeX using native syntax or dedicated CTAN packages:
- Core LaTeX (No installation needed): Standard keyboard brackets
(,),[,]and automatic sizing commandsleftandrightare built directly into the LaTeX kernel and work in any standard LaTeX distribution without extra packages. - The CTAN
intervalpackage (Recommended for reversed brackets): Maintained by Lars Madsen on the Comprehensive TeX Archive Network (CTAN), theintervalpackage is included in TeX Live, MacTeX, and MiKTeX. To load it, addusepackage{interval}to your document preamble. If using a minimal installation, install it via your distribution manager (tlmgr install intervalor the MiKTeX Package Manager). - The
mathtoolspackage (Recommended for custom paired macros): Maintained by the LaTeX Project team as part of themhbundle on CTAN,mathtoolsextendsamsmathand provides delimiter tools viaDeclarePairedDelimiter. Load it withusepackage{mathtools}in your preamble. - Web renderers: For web publishing, tools like MathJax support native delimiters,
left/right, andmathtoolsmacros out of the box; see our guide on MathJax and LaTeX.
Step-by-step task (numbered, with menu names or commands exactly as in the current docs)
Follow these five steps to format intervals accurately according to journal guidelines:
- Step 1: Write standard intervals with native keyboard characters. In math mode (inline
$...$or displayed[...]), type parentheses and square brackets directly:- Closed interval:
$[a, b]$ - Open interval (parentheses convention):
$(a, b)$ - Half-open (left-closed, right-open):
$[a, b)$ - Half-open (left-open, right-closed):
$(a, b]$ - Infinite intervals:
$(-infty, b]$,$[a, infty), or$(-infty, infty)$(usinginftyfor the infinity symbol)
- Closed interval:
- Step 2: Auto-scale delimiters for tall expressions using
leftandright. When an interval contains fractions or vertical expressions, plain brackets look too small. Precede the opening fence withleftand the closing fence withright:[ x in left[ frac{a}{2}, frac{b}{2} right) ]According to Overleaf documentation,
leftandrightmust always appear in balanced pairs within the same math group. If you require an interval bounded on only one side by a visible delimiter, pair it with an invisible dot delimiter usingleft.orright.. - Step 3: Correct TeX spacing when writing ISO reversed-bracket intervals. In ISO 80000-2 notation, open intervals are written as
]a, b[. However, typing$]a, b[$directly causes TeX to treat]as a closing delimiter (typemathclose) and[as an opening delimiter (typemathopen). This mistake introduces incorrect horizontal spacing before negative signs or relation operators (e.g.,$x in ]-a, b[$misinterprets the minus sign as binary subtraction).To fix this natively without extra packages, use TeX atom classifiers:
[ x in mathopen{]}a, bmathclose{[} ] - Step 4: Use the CTAN
intervalpackage for semantic syntax. Theintervalpackage automates correct mathematical atom typing and fence spacing:documentclass{article} usepackage{interval} begin{document} % Basic closed interval [a, b]: $interval{a}{b}$ % Open interval using ISO reversed brackets ]a, b[: $interval[open]{a}{b}$ % or shorthand: $ointerval{a}{b}$ % Left-open interval ]a, b]: $interval[open left]{a}{b}$ % or shorthand: $linterval{a}{b}$ % Right-open interval [a, b[: $interval[open right]{a}{b}$ % or shorthand: $rinterval{a}{b}$ % Scaled fences for tall contents: $interval[scaled=Big]{a}{frac{b}{2}}$ end{document}To switch the package globally to round parentheses for open intervals instead of reversed brackets, add
intervalconfig{soft open fences}in your preamble (Madsen, 2019). - Step 5: Define reusable paired delimiters with
mathtools. If your project avoids theintervalpackage but requires scalable macros, useDeclarePairedDelimitervia newcommand patterns:usepackage{mathtools} DeclarePairedDelimiter{intcl}{[}{]} % Closed [a, b] DeclarePairedDelimiter{intop}{(}{)} % Open (a, b) DeclarePairedDelimiter{intco}{[}{)} % Half-open [a, b) DeclarePairedDelimiter{intoc}{(}{]} % Half-open (a, b]Use the unstarred version
intcl{a, b}for standard text, the starred versionintcl*{frac{a}{2}, b}for automaticleft/rightscaling, or an explicit size parameterintcl[Big]{a, b}.
Output and how to read it
The table below summarizes mathematical interval types, their mathematical set definitions, standard LaTeX markup, and the dedicated CTAN interval syntax:
| Interval Type | Set Definition | Anglo-American Syntax | ISO / European Syntax | CTAN interval Command |
|---|---|---|---|---|
| Closed interval | {x ∈ ℝ | a ≤ x ≤ b} | [a, b] |
[a, b] |
interval{a}{b} |
| Open interval | {x ∈ ℝ | a < x < b} | (a, b) |
mathopen{]}a, bmathclose{[} |
interval[open]{a}{b} |
| Left-closed, right-open | {x ∈ ℝ | a ≤ x < b} | [a, b) |
[a, bmathclose{[} |
interval[open right]{a}{b} |
| Left-open, right-closed | {x ∈ ℝ | a < x ≤ b} | (a, b] |
mathopen{]}a, b] |
interval[open left]{a}{b} |
| Unbounded above | {x ∈ ℝ | x ≥ a} | [a, infty) |
[a, inftymathclose{[} |
interval[open right]{a}{infty} |
| Unbounded below | {x ∈ ℝ | x ≤ b} | (-infty, b] |
mathopen{]}-infty, b] |
interval[open left]{-infty}{b} |
| Entire real line | {x ∈ ℝ | -∞ < x < ∞} | (-infty, infty) |
mathopen{]}-infty, inftymathclose{[} |
interval[open]{-infty}{infty} |
When reading interval notation in scientific manuscripts:
- An inward-facing square bracket (
[on the left,]on the right) indicates an inclusive bound: the endpoint satisfies the condition with weak inequality (≤ or ≥). - A round parenthesis (
(or)) or an outward-facing square bracket (]on the left,[on the right) indicates an exclusive bound: the endpoint satisfies the condition with strict inequality (< or >). - Infinite bounds (
-inftyandinfty) are never reached and must always use open delimiters.
Troubleshooting
Common compilation errors and formatting defects when typesetting intervals in LaTeX include:
- Error:
! Extra right.or! Missing right.: This occurs whenleftandrightare not balanced within the same formula block. In LaTeX, everyleftmust have a matchingright. If you break an equation across lines in analignormultlineenvironment,leftandrightcannot cross the newline (\) or alignment tab (&). To fix this, close the delimiter before the line break with an invisible dot (right.) and reopen it on the next line (left.), or replace auto-scaling with manual sizing commands likeBig[andBig). - Defect: Awkward spacing around negative signs in open intervals: If you write
$x in ]-1, 1[$, TeX interprets]as a closing fence and treats the following-as a binary subtraction operator rather than a unary negative sign, adding wide horizontal space. To resolve this, loadusepackage{interval}and write$interval[open]{-1}{1}$, or type$mathopen{]}-1, 1mathclose{[}$. - Defect: Excessively large delimiters in inline text: Using
left( a, b right)in paragraph text often causes delimiters to stretch unnaturally if nearby superscripts, subscripts, or tall characters are present, disrupting paragraph leading. Use plain unscaled delimiters(a, b)or fixed small scalers (bigl(andbigr)) in inline prose. - Error:
! Undefined control sequence. interval: This indicates that theintervalpackage is not imported. Addusepackage{interval}in the preamble afterusepackage{amsmath}.
Free alternatives (table)
The following table lists verified, free TeX distributions and software platforms for typesetting mathematical intervals and research manuscripts:
| Platform / Distribution | Type | Supported Operating Systems | Official Access URL |
|---|---|---|---|
| TeX Live | Complete, open-source local TeX distribution (TUG) | Linux, Windows, macOS (via MacTeX) | tug.org/texlive |
| MiKTeX | Lightweight TeX distribution with automatic package installer | Windows, macOS, Linux | miktex.org |
| Overleaf | Cloud-based collaborative LaTeX editing environment (free plan available) | Web browser (cross-platform) | overleaf.com |
| KaTeX | Lightweight open-source JavaScript library for fast web math rendering | Web browser / Node.js | katex.org |
| GNU TeXmacs | Free scientific text editor and mathematical typesetting system | Linux, macOS, Windows | texmacs.org |
FAQ
How do you write an open interval in LaTeX?
To write an open interval using standard parentheses, type (a, b) directly in math mode (e.g., $(a, b)$). If your journal requires ISO reversed-bracket notation, use the CTAN interval package with interval[open]{a}{b}, or write mathopen{]}a, bmathclose{[} to ensure correct spacing.
How do you write a closed interval in LaTeX?
To write a closed interval, type square brackets directly in math mode: $[a, b]$. When using the CTAN interval package, write interval{a}{b}.
What is the difference between (a, b) and ]a, b[ in LaTeX?
Both notations designate the open interval {x ∈ ℝ | a < x < b}. The form (a, b) is standard in British and American mathematics, whereas ]a, b[ is defined in ISO 80000-2 and widely used in continental Europe and French mathematics to avoid ambiguity with Cartesian coordinate pairs (x, y).
Why is spacing wrong when typing reversed brackets in LaTeX?
In standard TeX math mode, ] is classified as mathclose (closing delimiter) and [ as mathopen (opening delimiter). Typing ]a, b[ directly puts a closing delimiter on the left, causing TeX to insert closing spacing before the bracket and interpret a subsequent minus sign as binary subtraction rather than a unary negative sign. Using usepackage{interval} or mathopen{]}...mathclose{[} corrects the atom types.
How do you make interval brackets auto-size for fractions?
Wrap the opening delimiter in left and the closing delimiter in right: for example, left[ frac{a}{2}, frac{b}{2} right). When using the interval package, pass the scaling option: interval[scaled=Big]{a}{frac{b}{2}} or interval[scaled]{a}{frac{b}{2}}.
How do you write an interval containing infinity in LaTeX?
Use the command infty for infinity with an open delimiter: [a, infty) for values greater than or equal to a, (-infty, b] for values less than or equal to b, and (-infty, infty) for the entire real number line.
Sources (official docs)
- Madsen, L. (2019). The interval package: Format mathematical intervals (Version 0.4). Comprehensive TeX Archive Network (CTAN). https://ctan.org/pkg/interval (Read 2026-11-08)
- Høgholm, M., Madsen, L., Robertson, W., & Wright, J. (2022). The mathtools package. Comprehensive TeX Archive Network (CTAN). https://ctan.org/pkg/mathtools (Read 2026-11-08)
- Overleaf. (2026). Brackets and Parentheses. Overleaf Documentation. https://www.overleaf.com/learn/latex/Brackets_and_Parentheses (Read 2026-11-08)
- International Organization for Standardization. (2019). Quantities and units — Part 2: Mathematics (ISO Standard No. 80000-2:2019). Geneva, Switzerland: ISO. (Read 2026-11-08)







