Missing \right inserted
This error happens when typesetting math if the \left
command is used but the corresponding \right
is missing. This article talks about common causes of this error and how to fix them.
Brief introduction to the \left
and \right
commands
The \left
and \right
commands typeset dynamically-sized delimiters and must be used together, within mathematical material, in the form
\[\verb'\left'\thinspace\textit{delim}_{\thinspace\text{L}}\quad\textit{math expression}\quad \verb'\right'\thinspace\textit{delim}_{\thinspace\text{R}}\]
where \(\textit{delim}_{\thinspace\text{L}}\) and \(\textit{delim}_{\thinspace\text{R}}\) are delimiters used to enclose your \(\textit{math expression}\). Typically, \(\textit{delim}_{\thinspace\text{L}}\) and \(\textit{delim}_{\thinspace\text{R}}\) are one of the characters () [] | \| \{ \}
or the dot ‘.
’, which is used as a “blank delimiter”.
Example
Here is an example using \left
and \right
to typeset parentheses which fully enclose a fraction:
\[
\left(\frac{x}{y} \right)
\]
This code produces \[\left(\frac{x}{y}\right)\]
If you don’t use the \left
and \right
commands when placing delimiters, including parentheses, those delimiters will not fully enclose the mathematical expression; for example, writing
\[
(\frac{x}{y})
\]
produces this
\[(\frac{x}{y})\]
Causes of this error and some solutions
Forgetting to include a \right
command
Writing a \left
command without its corresponding \right
is a frequent cause of this error. This oversight, as illustrated in the example below, can lead to a cascade of errors, including Missing \right. inserted
.
\[
\pi =
\left( \int_{-\infty}^{+\infty} e^{-x^2} dx )
\]
Open this error-generating example in Overleaf
To fix those errors, add the missing \right
command:
\[
\pi =
\left( \int_{-\infty}^{+\infty} e^{-x^2} dx \right)
\]
Open this corrected example in Overleaf
This code produces the following output
\[ \pi = \left( \int_{-\infty}^{+\infty} e^{-x^2} dx \right) \]
Forgetting a blank delimiter
A common cause of this error occurs when trying to write functions such as the one shown below:
\[f(x)= \left\{\begin{array}{lr} 0 & x\leq 0 \\ 1 & x > 0 \end{array}\right.\]
If you attempt to typeset this function by writing
\[
f(x)= \left\{
\begin{array}{lr}
0 & x\leq 0 \\
1 & x > 0
\end{array}
\]
Open this error-generating example in Overleaf
then you will generate errors because the \right
delimiter is missing.
To typeset a \left
delimiter only, use a dot character (‘.
’) as the \right
delimiter by writing \right.
which, as shown below, typesets a blank, i.e. “null”, delimiter.
\[
f(x)= \left\{
\begin{array}{lr}
0 & x\leq 0 \\
1 & x > 0
\end{array}
\right.
\]
Open this corrected example in Overleaf
This corrected example produces the desired result:
\[f(x)= \left\{\begin{array}{lr} 0 & x\leq 0 \\ 1 & x > 0 \end{array}\right.\]
Another option: use the cases
environment
You can avoid direct use of \left
and \right
commands via the cases environment provided by the amsmath
package. Our function can be typeset as shown below:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
f(x)= \begin{cases}
0 & x\leq 0 \\
1 & x > 0
\end{cases}
\]
\end{document}
Using line breaks inside \left
and \right
commands
When writing multi-line equations using the amsmath
package environments align
, align*
or aligned
, the \left
and \right
commands must be balanced on each line and on the same side of &
. LaTeX will generate a series of errors if you try to include line breaks between pairs of \left
and \right
commands.
The following code snippet uses a line break (\\
) between \left
and \right
commands, causing it to fail with errors:
\begin{align*}
y = 1 + & \left( \frac{1}{x} + \frac{1}{x^2} + \frac{1}{x^3} + \cdots \\
& \quad + \frac{1}{x^{n-1}} + \frac{1}{x^n} \right)
\end{align*}
Open this error-generating LaTeX fragment in Overleaf
How to fix these errors: two solutions
Solution 1: Use blank delimiters
This solution uses blank delimiters by adding a \right.
at the end of the first line, and a \left.
at the start of the second line, after the &
:
\begin{align*}
y = 1 + & \left( \frac{1}{x} + \frac{1}{x^2} + \frac{1}{x^3} + \cdots \right. \\
&\left. \quad + \frac{1}{x^{n-1}} + \frac{1}{x^n} \right)
\end{align*}
Open this corrected LaTeX fragment in Overleaf
This example produces the following output:
\[\begin{align*} y = 1 + & \left( \frac{1}{x} + \frac{1}{x^2} + \frac{1}{x^3} + \cdots \right. \\ &\left. \quad + \frac{1}{x^{n-1}} + \frac{1}{x^n} \right)\end{align*}\]
Solution 2: Manually select the delimiter sizes
We can use \biggl(
and \biggr)
because they will work across the line break:
\begin{align*}
y = 1 + & \biggl( \frac{1}{x} + \frac{1}{x^2} + \frac{1}{x^3} + \cdots \\
& \quad + \frac{1}{x^{n-1}} + \frac{1}{x^n} \biggr)
\end{align*}
Open this corrected LaTeX fragment in Overleaf
This solution produces the same result:
\[\begin{align*}y = 1 + & \left( \frac{1}{x} + \frac{1}{x^2} + \frac{1}{x^3} + \cdots \right. \\ &\left. \quad + \frac{1}{x^{n-1}} + \frac{1}{x^n} \right)\end{align*}\]
Some notes on manually selecting delimiter sizes
LaTeX provides a number of commands to manually set the delimiter size. Delimiters selected by those commands are a fixed size—they are not sized dynamically to suit the math expression they enclose. They have the advantage of not needing to be paired in the same way as \left
and \right
commands.
The size of delimiter, in order of increasing size, is \big
, \Big
, \bigg
, and \Bigg
; for example:
LaTeX markup | Renders as |
---|---|
\bigl( \Bigl( \biggl( \Biggl(
|
\(\displaystyle\bigl(\; \Bigl(\; \biggl(\; \Biggl(\) |
\bigr) \Bigr) \biggr) \Biggr)
|
\(\displaystyle\bigr)\; \Bigr)\; \biggr)\; \Biggr)\;\) |
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Using the Overleaf project menu
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Using the History feature
- Debugging Compilation timeout errors
- How-to guides
- Guide to Overleaf’s premium features
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Matrices
- Fractions and Binomials
- Aligning equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
- Using the Symbol Palette in Overleaf
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management with bibtex
- Bibliography management with natbib
- Bibliography management with biblatex
- Bibtex bibliography styles
- Natbib bibliography styles
- Natbib citation styles
- Biblatex bibliography styles
- Biblatex citation styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- Multilingual typesetting on Overleaf using babel and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections, equations and floats
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typesetting exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class