> 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/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://overleaf-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.
