> 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/zhi-shi-ku/069-how-to-jump-to-the-source-code-from-the-typeset-pdf-synctex.md).

# 如何从排版后的 PDF 跳转到源代码（SyncTeX）

Overleaf 使您能够从排版后的 PDF 中的某个位置跳转到 LaTeX 源代码中的对应位置，反之亦然。 **注意**：如果您项目的主 `.tex` 文件存储在某个文件夹中，则此功能将无法工作（即，它必须放在项目的顶层（根）级别）。另外还有几种可能的原因，列在下面 [此处](/latex/zh-cn/zhi-shi-ku/132-synctex-errors.md).

您可以：

* 双击 PDF，这会使 Overleaf 的编辑器滚动到源代码中的对应位置；或者
* 使用位于源代码面板和预览面板之间分隔线上的箭头键，在源代码到预览之间，或预览到源代码之间跳转：

![显示 Overleaf 用于源代码到预览，或预览到源代码的箭头的图片](/files/1d421fb9838bf2b1a2cd81ac1958f61960011295)

如果您看不到这些箭头，或者双击 PDF 没有生效，您需要确保项目的 PDF 查看器设置为“Overleaf”，而不是“Browser”。这里有一段简短视频，展示如何设置项目的 PDF 查看器，并演示 Overleaf 的源代码/PDF 同步功能。

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/2xt7xSOvXcVqKZEAkxoaJi/76436c82c9382f8e78c84140c96deb40/SyncTeX_video.mp4>" %}

### SyncTeX：Overleaf 此功能背后的 TeX 技术

Overleaf 的“跳转到源代码位置”和“跳转到 PDF 位置”功能是使用 SyncTeX 实现的，SyncTeX 是所有 TeX 引擎都包含的一项标准功能。对 SyncTeX 简介感兴趣的读者可以在以下位置了解更多： [这篇 Overleaf 文章](/latex/zh-cn/geng-duo-zhu-ti/39-mltex-enctex-and-synctex-tex-extensions.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/zhi-shi-ku/069-how-to-jump-to-the-source-code-from-the-typeset-pdf-synctex.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.
