> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/latex-errors/24-missing-right-inserted.md).

# 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](#forgetting-a-blank-delimiter)”.

### Example

Here is an example using `\left` and `\right` to typeset parentheses which fully enclose a fraction:

```latex
\[
  \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

```latex
\[
  (\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`.

```latex
\[
\pi =
\left( \int_{-\infty}^{+\infty} e^{-x^2} dx )
\]
```

[Open this **error-generating** example in Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+demonstrating+a+missing+delimiter\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B+%0A%5Cpi+%3D+%0A%5Cleft%28+%5Cint_%7B-%5Cinfty%7D%5E%7B%2B%5Cinfty%7D+e%5E%7B-x%5E2%7D+dx+%29%0A%5C%5D%0A%5Cend%7Bdocument%7D)

To fix those errors, add the missing `\right` command:

```latex
\[
\pi =
\left( \int_{-\infty}^{+\infty} e^{-x^2} dx \right)
\]
```

[Open this **corrected example** in Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Correcting+a+missing+delimiter\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B+%0A%5Cpi+%3D+%0A%5Cleft%28+%5Cint_%7B-%5Cinfty%7D%5E%7B%2B%5Cinfty%7D+e%5E%7B-x%5E2%7D+dx+%5Cright%29%0A%5C%5D%0A%5Cend%7Bdocument%7D)

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

```latex
\[
f(x)= \left\{
  \begin{array}{lr}
      0 & x\leq 0 \\
      1 & x > 0
      \end{array}
\]
```

[Open this **error-generating** example in Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+showing+a+missing+%5Cright+command\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B+%0Af%28x%29%3D+%5Cleft%5C%7B%0A++%5Cbegin%7Barray%7D%7Blr%7D+%0A++++++0+%26+x%5Cleq+0+%5C%5C%0A++++++1+%26+x+%3E+0+%0A++++++%5Cend%7Barray%7D%0A%5C%5D%0A%5Cend%7Bdocument%7D)

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.

```latex
\[
f(x)= \left\{
  \begin{array}{lr}
      0 & x\leq 0 \\
      1 & x > 0
      \end{array}
\right.
\]
```

[Open this **corrected** example in Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+the+dot+delimiter\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B+%0Af%28x%29%3D+%5Cleft%5C%7B%0A++%5Cbegin%7Barray%7D%7Blr%7D+%0A++++++0+%26+x%5Cleq+0+%5C%5C%0A++++++1+%26+x+%3E+0+%0A++++++%5Cend%7Barray%7D%0A%5Cright.%0A%5C%5D%0A%5Cend%7Bdocument%7D)

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:

```latex
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
f(x)= \begin{cases}
      0 & x\leq 0 \\
      1 & x > 0
      \end{cases}
\]
\end{document}
```

[Open this example in Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+the+amsmath+cases+environment\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B+%0Af%28x%29%3D+%5Cbegin%7Bcases%7D+%0A++++++0+%26+x%5Cleq+0+%5C%5C%0A++++++1+%26+x+%3E+0+%0A++++++%5Cend%7Bcases%7D%0A%5C%5D%0A%5Cend%7Bdocument%7D)

### 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:

```latex
\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](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=brackets+and+parentheses+example+with+errors\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Balign%2A%7D%0Ay++%3D+1+%2B+%26+%5Cleft%28++%5Cfrac%7B1%7D%7Bx%7D+%2B+%5Cfrac%7B1%7D%7Bx%5E2%7D+%2B+%5Cfrac%7B1%7D%7Bx%5E3%7D+%2B+%5Ccdots++%5C%5C%0A++%26+%5Cquad++%2B+%5Cfrac%7B1%7D%7Bx%5E%7Bn-1%7D%7D+%2B+%5Cfrac%7B1%7D%7Bx%5En%7D+%5Cright%29%0A%5Cend%7Balign%2A%7D%0A%5Cend%7Bdocument%7D)

#### 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 `&`:

```latex
\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](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Line+breaks+and+delimiters\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Balign%2A%7D%0Ay++%3D+1+%2B+%26+%5Cleft%28++%5Cfrac%7B1%7D%7Bx%7D+%2B+%5Cfrac%7B1%7D%7Bx%5E2%7D+%2B+%5Cfrac%7B1%7D%7Bx%5E3%7D+%2B+%5Ccdots+%5Cright.+%5C%5C%0A++%26%5Cleft.+%5Cquad+%2B+%5Cfrac%7B1%7D%7Bx%5E%7Bn-1%7D%7D+%2B+%5Cfrac%7B1%7D%7Bx%5En%7D+%5Cright%29%0A%5Cend%7Balign%2A%7D%0A%5Cend%7Bdocument%7D)

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:

```latex
\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](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Line+breaks+and+delimiters+example+2\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Balign%2A%7D%0Ay++%3D+1+%2B+%26+%5Cbiggl%28++%5Cfrac%7B1%7D%7Bx%7D+%2B+%5Cfrac%7B1%7D%7Bx%5E2%7D+%2B+%5Cfrac%7B1%7D%7Bx%5E3%7D+%2B+%5Ccdots++%5C%5C%0A++%26+%5Cquad+%2B+%5Cfrac%7B1%7D%7Bx%5E%7Bn-1%7D%7D+%2B+%5Cfrac%7B1%7D%7Bx%5En%7D+%5Cbiggr%29%0A%5Cend%7Balign%2A%7D%0A%5Cend%7Bdocument%7D)

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](/latex/mathematics/03-brackets-and-parentheses.md#reference-guide). 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);$$ |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/latex-errors/24-missing-right-inserted.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
