Skip to main content
v2026.11,986 entries · CC-BY 4.0

LaTeX Interval: How to Typeset Math Intervals

Learn how to write open, closed, and half-open intervals in LaTeX using native brackets, the interval package, and mathtools paired delimiters.

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 or theta 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 commands left and right are built directly into the LaTeX kernel and work in any standard LaTeX distribution without extra packages.
  • The CTAN interval package (Recommended for reversed brackets): Maintained by Lars Madsen on the Comprehensive TeX Archive Network (CTAN), the interval package is included in TeX Live, MacTeX, and MiKTeX. To load it, add usepackage{interval} to your document preamble. If using a minimal installation, install it via your distribution manager (tlmgr install interval or the MiKTeX Package Manager).
  • The mathtools package (Recommended for custom paired macros): Maintained by the LaTeX Project team as part of the mh bundle on CTAN, mathtools extends amsmath and provides delimiter tools via DeclarePairedDelimiter. Load it with usepackage{mathtools} in your preamble.
  • Web renderers: For web publishing, tools like MathJax support native delimiters, left/right, and mathtools macros 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:

  1. 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)$ (using infty for the infinity symbol)
  2. Step 2: Auto-scale delimiters for tall expressions using left and right. When an interval contains fractions or vertical expressions, plain brackets look too small. Precede the opening fence with left and the closing fence with right:
    [
    x in left[ frac{a}{2}, frac{b}{2} right)
    ]

    According to Overleaf documentation, left and right must 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 using left. or right..

  3. 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 (type mathclose) and [ as an opening delimiter (type mathopen). 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{[}
    ]
  4. Step 4: Use the CTAN interval package for semantic syntax. The interval package 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).

  5. Step 5: Define reusable paired delimiters with mathtools. If your project avoids the interval package but requires scalable macros, use DeclarePairedDelimiter via 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 version intcl*{frac{a}{2}, b} for automatic left/right scaling, or an explicit size parameter intcl[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 (-infty and infty) 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 when left and right are not balanced within the same formula block. In LaTeX, every left must have a matching right. If you break an equation across lines in an align or multline environment, left and right cannot 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 like Big[ and Big).
  • 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, load usepackage{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( and bigr)) in inline prose.
  • Error: ! Undefined control sequence. interval: This indicates that the interval package is not imported. Add usepackage{interval} in the preamble after usepackage{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)

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about LaTeX Interval: How to Typeset Math Intervals

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →