> 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/shu-xue/03-brackets-and-parentheses.md).

# 括号

## 引言

圆括号和方括号在数学公式中非常常见。你可以在 LaTeX 中轻松控制括号的大小和样式；本文将介绍方法。

这里有一张列出 LaTeX 中常见数学括号的表：

| 类型      | LaTeX 标记              | 显示为                        |
| ------- | --------------------- | -------------------------- |
| 圆括号；圆括弧 | `(x+y)`               | $$(x+y)$$                  |
| 方括号；方括弧 | `[x+y]`               | $$\[x+y]$$                 |
| 花括号；大括号 | `\{ x+y \}`           | $${ x+y }$$                |
| 尖括号     | `\langle x+y \rangle` | $$\langle x+y\rangle$$     |
| 竖线；竖杠   | `\|x+y\|`             | $$\displaystyle\| x+y \|$$ |
| 双竖线     | \`\\                  | x+y\\                      |

## 一些示例

括号的大小和样式可以手动设置，也可以在文档中动态调整大小，如下一个示例所示：

```latex
\[
F = G \left( \frac{m_1 m_2}{r^2} \right)
\]
```

[在 Overleaf 中打开此 LaTeX 片段](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=brackets+and+parentheses+example+1\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B+%0AF+%3D+G+%5Cleft%28+%5Cfrac%7Bm_1+m_2%7D%7Br%5E2%7D+%5Cright%29%0A%5C%5D%0A%5Cend%7Bdocument%7D)

上面的示例会生成如下输出：

$$F = G \left( \frac{m\_1 m\_2}{r^2} \right)$$ 请注意，要插入圆括号或方括号， `\left` 和 `\right` 需要使用这些命令。即使你只使用一个括号， *两个* 命令也是必需的。 `\left` 和 `\right` 可以动态调整大小，如下一个示例所示：

```latex
\[
 \left[  \frac{ N } { \left( \frac{L}{p} \right)  - (m+n) }  \right]
\]
```

[在 Overleaf 中打开此 LaTeX 片段](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=brackets+and+parentheses+example+2\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B+%0A+%5Cleft%5B++%5Cfrac%7B+N+%7D+%7B+%5Cleft%28+%5Cfrac%7BL%7D%7Bp%7D+%5Cright%29++-+%28m%2Bn%29+%7D++%5Cright%5D%0A%5C%5D%0A%5Cend%7Bdocument%7D)

上面的示例会生成如下输出：

$$\left\[ \frac{ N } { \left( \frac{L}{p} \right) - (m+n) } \right]$$

在编写多行公式时， `align`, `align*` 或 `aligned` 这些环境中， `\left` 和 `\right` 命令必须成对匹配 *在每一行上，并且位于 `&`*。因此下面的代码片段将会报错：

```latex
\begin{align*}
y  = 1 + & \left(  \frac{1}{x} + \frac{1}{x^2} + \frac{1}{x^3} + \ldots  \\
  & \quad  + \frac{1}{x^{n-1}} + \frac{1}{x^n} \right)
\end{align*}
```

[在 Overleaf 中打开这个 LaTeX 片段（会有错误）](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+%5Cldots++%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)

解决办法是使用“不可见”的括号来平衡，也就是添加一个 `\right.` 在第一行末尾添加一个，和一个 `\left.` 在第二行开头，放在 `&`:

```latex
\begin{align*}
y  = 1 + & \left(  \frac{1}{x} + \frac{1}{x^2} + \frac{1}{x^3} + \ldots \right. \\
  &\left. \quad + \frac{1}{x^{n-1}} + \frac{1}{x^n} \right)
\end{align*}
```

[在 Overleaf 中打开此 LaTeX 片段](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=brackets+and+parentheses+example+4\&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+%5Cldots+%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)

上面的示例会生成如下输出：

![Paren-ex03.png](/files/65e8ded7414a7231d2c8f5ac30946d5670cac229)

## 控制类型和大小

可以显式控制括号的大小，如下这个 LaTeX 代码片段所示：

```latex
\[
 \Biggl \langle 3x+7 \biggr \rangle
\]
```

[在 Overleaf 中打开此 LaTeX 片段](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=brackets+and+parentheses+example+5\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B%0A+%5CBiggl+%5Clangle+3x%2B7+%5Cbiggr+%5Crangle%0A%5C%5D%0A%5Cend%7Bdocument%7D)

上面的示例会生成如下输出：

$$\Biggl \langle 3x+7 \biggr \rangle$$

这些命令 `\Biggl` 和 `\biggr` 决定定界符的大小 `<` 和 `>` 分别对应于 `l` 或 `r` 用于指示它是左括号还是右括号。有关括号及其大小的完整列表，请参见 [参考指南](#reference-guide).

## 参考指南

| LaTeX 标记                                                    | 显示为                                                       |
| ----------------------------------------------------------- | --------------------------------------------------------- |
| `\bigl( \Bigl( \biggl( \Biggl(`                             | $$\big( \Big( \bigg( \Bigg($$                             |
| `\bigr] \Bigr] \biggr] \Biggr]`                             | $$\big] \Big] \bigg] \Bigg]$$                             |
| `\bigl\{ \Bigl\{ \biggl\{ \Biggl\{`                         | $$\big{ \Big{ \bigg{ \Bigg{$$                             |
| `\bigl \langle \Bigl \langle \biggl \langle \Biggl \langle` | $$\big \langle \Big \langle \bigg \langle \Bigg \langle$$ |
| `\bigr \rangle \Bigr \rangle \biggr \rangle \Biggr \rangle` | $$\big \rangle \Big \rangle \bigg \rangle \Bigg \rangle$$ |
| `\big\| \Big\| \bigg\| \Bigg\|`                             | $$\big\| ; \Big\| ; \bigg\| ; \Bigg\|$$                   |
| \`\big\\                                                    | \Big\\                                                    |
| `\bigl \lceil \Bigl \lceil \biggl \lceil \Biggl \lceil`     | $$\big \lceil \Big \lceil \bigg \lceil \Bigg \lceil$$     |
| `\bigr \rceil \Bigr \rceil \biggr \rceil \Biggr \rceil`     | $$\big \rceil \Big \rceil \bigg \rceil \Bigg \rceil$$     |
| `\bigl \lfloor \Bigl \lfloor \biggl \lfloor \Biggl \lfloor` | $$\big \lfloor \Big \lfloor \bigg \lfloor \Bigg \lfloor$$ |
| `\bigr \rfloor \Bigr \rfloor \biggr \rfloor \Biggr \rfloor` | $$\big \rfloor \Big \rfloor \bigg \rfloor \Bigg \rfloor$$ |

## 进一步阅读

* [数学表达式](/latex/zh-cn/shu-xue/01-mathematical-expressions.md)
* [下标和上标](/latex/zh-cn/shu-xue/02-subscripts-and-superscripts.md)
* [使用 amsmath 对齐方程](/latex/zh-cn/shu-xue/06-aligning-equations-with-amsmath.md)
* [数学模式中的显示样式](/latex/zh-cn/shu-xue/10-display-style-in-math-mode.md)
* [运算符](/latex/zh-cn/shu-xue/07-operators.md)
* [LaTeX2ε 不那么简短的介绍](http://www.ctan.org/tex-archive/info/lshort/)


---

# 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/shu-xue/03-brackets-and-parentheses.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.
