> 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-wen-ti/02-keep-track-of-your-labels-with-showlabels.md).

# 使用 showlabels 跟踪你的标签

**作者：James Allen（2012年1月）**

每当我写长篇 LaTeX 文档时，我总是发现自己在代码中来回跳转，试图记起我把某个东西命名为 `\label`。为了避免在代码中丢失位置，我使用 [`showlabels`](https://ctan.org/pkg/showlabels?lang=en) 这个宏包，它会在相应公式旁显示标签名。这样我就可以在 PDF 里查看，在那里更容易找到我要找的公式，也不需要在代码中来回跳转。它几乎适用于你可以赋予 `\label` 的所有内容。妙极了！

**用法**

在导言区加入：

```latex
\usepackage{showlabels}
```

**示例输出**

![ShowlabelsExample.png](/files/1aa1c0db057e0622102179f3c88d388d25f636c6)

**选项**

你可以为 showlabels 提供一个选项，告诉它把标签放在哪里：

```latex
\usepackage[inline]{showlabels}
```

可用的选项有（取自 [文档](https://ctan.org/pkg/showlabels?lang=en)):

* `outer` \[默认]——所有注释都放在正文的外侧边距中
* `inner`——内侧边距
* `left`——左边距
* `right`——右边距
* `marginal` \[默认]——将注释放在边距中
* `行内`——尽可能将注释放在行内，并忽略上面的任何边距放置选项
* `nolabel`——不要为 `\label` 命令插入边注
* `draft` \[默认]——不做任何事，搭档是...
* `final`——关闭该宏包的所有功能

请注意， `showlabels` 应在这些宏包之后加载， `amsmath` 和 `hyperref` 才能与它们正常工作。请参见 [官方文档（PDF）](http://mirrors.ctan.org/macros/latex/contrib/showlabels/showlabels.pdf) 了解更多详情。


---

# 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-wen-ti/02-keep-track-of-your-labels-with-showlabels.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.
