> 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/zh-cn/latex-cuo-wu/06-extra-right.md).

# 多余的 \right

当排版数学公式时，如果使用了 \right 命令但缺少对应的 \left，就会发生此错误。本文讨论了该错误的常见原因以及如何修复。

## \left 和 \right 命令简介

该 `\left` 和 `\right` 这些命令用于排版动态大小的定界符，必须在数学内容中配合使用，形式为

$$\verb'\left'\thinspace\textit{delim}*{\thinspace\text{L}}\quad\textit{math expression}\quad \verb'\right'\thinspace\textit{delim}*{\thinspace\text{R}}$$

其中 $$\textit{delim}*{\thinspace\text{L}}$$ 和 $$\textit{delim}*{\thinspace\text{R}}$$ 是用于包围你的……的定界符 $$\textit{math expression}$$通常， $$\textit{delim}*{\thinspace\text{L}}$$ 和 $$\textit{delim}*{\thinspace\text{R}}$$ 是以下字符之一 `() [] | \| \{ \}` 或句点 “`.`”，它用作“[空白定界符](#using-a-blank-delimiter)”。

### 示例

这里有一个使用 `\left` 和 `\right` 用于排版完全包围分数的圆括号：

```latex
\[
  \left(\frac{x}{y} \right)
\]
```

此代码生成 $$\left(\frac{x}{y}\right)$$

如果你不使用 `\left` 和 `\right` 在放置定界符（包括圆括号）时使用这些命令，这些定界符将不会完全包围数学表达式；例如，写作

```latex
\[
  (\frac{x}{y})
\]
```

会生成这个

$$(\frac{x}{y})$$

## 此错误的原因及一些解决方法

### 忘记包含 \left 命令

此错误通常在编写一个 `\right` 命令时出现，但忘记包含相应的 `\left`，如下例所示：

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

[在 Overleaf 中打开此 **会产生错误的** 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%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)

此示例会生成以下错误：

![用于演示 LaTeX 中缺少定界符的图片](/files/4f2f4f6321b0bee07c8c30d7f6078080f304ee07)

添加缺少的 `\left` ，通过编写以下内容来修复此错误

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

，其会生成以下输出

$$\pi = \left( \int\_{-\infty}^{+\infty} e^{-x^2} dx \right)$$

### 使用空定界符

如果你想排版一个 `\right` 仅定界符，请使用 ‘`.`’ 字符作为 `\left` 定界符，方法是写 `\left.`，它不会排版出定界符字符。下面的示例使用了一个 `.` 定界符在一个 `aligned` 环境中进行程序代码排版，该环境由 `amsmath` 宏包的示例代码：

```latex
\documentclass{article}
\usepackage{amsmath} % 需要使用 aligned 环境

\begin{document}
\[
 \left.\begin{aligned}
        dF &= 0,\\
        d^{\dagger} F &= 0,
       \end{aligned}
\ \right\}
 \qquad \text{麦克斯韦方程组}
\]
\end{document}
```

[在 Overleaf 中打开此示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+the+dot+delimiter\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D+%25+Required+to+use+the+aligned+environment%0A%0A%5Cbegin%7Bdocument%7D%0A%5C%5B%0A+%5Cleft.%5Cbegin%7Baligned%7D%0A++++++++dF+%26%3D+0%2C%5C%5C%0A++++++++d%5E%7B%5Cdagger%7D+F+%26%3D+0%2C%0A+++++++%5Cend%7Baligned%7D%0A%5C+%5Cright%5C%7D%0A+%5Cqquad+%5Ctext%7BMaxwell%27s+equations%7D%0A%5C%5D%0A%5Cend%7Bdocument%7D)

此示例会排版出以下表达式：

$$\left.\begin{aligned} dF &= 0,\d^{\dagger} F &= 0,\end{aligned}\ \right}\qquad \text{Maxwell's equations}$$


---

# 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/zh-cn/latex-cuo-wu/06-extra-right.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.
