> For the complete documentation index, see [llms.txt](https://ayakaleaf-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://ayakaleaf-pro.ayaka.space/latex/zh-cn/latex-cuo-wu/04-double-subscript.md).

# 双重下标

## 简介

按照惯例，LaTeX 使用下划线字符（`_`）来排版下标，例如 `$a_b$` 其效果是 $$a\_b$$。如果你写 `$a_bcde$` 只有第一个字符， `b`，会成为下标， $$a\_bcde$$，因为 LaTeX 不会 *假定* 你想把整组字符都设为下标 `bcde`。要将多个项目（标记符）排版为下标，你需要通过将它们括在一组中来告诉 LaTeX `{...}`，像这样： `$a_{bcde}$`，其效果是 $$a\_{bcde}$$.

## 双重下标错误

当要求 LaTeX 为某个已经 *已经有* 附加了下标的数学内容再添加一个下标时，就会出现双重下标错误。这个错误通常可通过使用花括号来解决 `{...}` 在数学模式中，它们会生成所谓的 *子公式*——用于描述你试图排版的数学表达式片段的术语。

例如，写作 `$a_b_c$` 会产生如下双重下标错误：

![Overleaf 上显示的双重下标错误](/files/bfef6beef0881cfc8fa086865cf0ed3e70e07d0d)

这个特定错误可以通过使用花括号以多种方式修复 `{...}`——结果会因花括号的位置不同而异：

* `$a_{b_c}$` 排版为 $$\displaystyle a\_{b\_c}$$
* `${a_b}_c$` 排版为 $${a\_b}\_c$$
* `$a_{bc}$` 排版为 $$a\_{bc}$$

### 双重下标错误：一个特殊情况

在以下网站上的一个问题 `tex.stackexchange` 展示了 [一个令人惊讶的双重下标错误示例](https://tex.stackexchange.com/questions/253080/why-am-i-getting-a-double-subscript-error)，其原因及相应修复方法值得了解。我们在此重现该示例。

尽管使用了花括号，下面的示例仍无法编译：

```latex
\documentclass{article}
\begin{document}
\({\vec a_b}_c\)
\end{document}
```

[打开此 ***会产生错误的*** Overleaf 中的示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=accents+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%28%7B%5Cvec+a_b%7D_c%5C%29%0A%5Cend%7Bdocument%7D)

解决此问题的一种方法是添加 [`accents` 宏包](https://ctan.org/pkg/accents?lang=en) （如 [此处建议](https://tex.stackexchange.com/a/253094)):

```latex
\documentclass{article}
\usepackage{accents}
\begin{document}
\({\vec a_b}_c\)
\end{document}
```

[在 Overleaf 中打开此示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=accents+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Baccents%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%28%7B%5Cvec+a_b%7D_c%5C%29%0A%5Cend%7Bdocument%7D)

## 更多关于下标的内容

可以通过编写类似以下的 LaTeX 来排版更深层级的下标 `$a_{b_{c_{d_e}}}$` 其效果是排版为 $$a\_{b\_{c\_{d\_e}}}$$。第二层及以下的所有下标（即下下标）都使用相同的字体大小（以磅为单位）排版，而第一层下标则使用稍大一些的字体大小（磅值）排版。要了解更多关于下标的内容，请访问 Overleaf 的 [专门介绍该主题的帮助页面](/latex/zh-cn/shu-xue/02-subscripts-and-superscripts.md).


---

# 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://ayakaleaf-pro.ayaka.space/latex/zh-cn/latex-cuo-wu/04-double-subscript.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.
