如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
特别感谢:
Warp,为多AI代理编码而构建,支持macOS、Linux和Windows
英文 | 简体中文 | 繁體中文 | 日本語 | 한국어
PDFMathTranslate
保留布局的科学PDF文档翻译。
--mode precise)。(贡献者:https://github.com/reycn%EF%BC%89[!NOTE]
2.0版本已迁移至组织下的新仓库:https://github.com/PDFMathTranslate/PDFMathTranslate-next
2.0正式版已发布。
您可以通过以下任一演示体验本应用:
注意:演示的计算资源有限,请避免滥用。
3.2 本地安装
针对不同使用场景,我们提供多种本地使用方式:
3.2.1 Python:使用uv安装
3.2.2 Python:使用pip安装
3.3.3 Python:图形用户界面
更多详情请参见GUI文档。
3.2.4 应用程序:Windows系统
从https://github.com/Byaidu/PDFMathTranslate/releases%E4%B8%8B%E8%BD%BDpdf2zh-version-win64.zip
解压并双击pdf2zh.exe运行。
[!NOTE]
- 如果在Windows系统中下载后无法打开文件,请安装vc_redist.x64.exe后重试。
3.2.5 参考文献管理工具:Zotero插件
详情请参见https://github.com/guaguastandup/zotero-pdf2zh%E3%80%82
3.2.6 Docker:容器化部署
docker pull byaidu/pdf2zh
docker run -d -p 7860:7860 byaidu/pdf2zh
云服务Docker部署说明:
[!NOTE]
- 如果无法访问Docker Hub,请尝试https://github.com/Byaidu/PDFMathTranslate/pkgs/container/pdfmathtranslate%E4%B8%8A%E7%9A%84%E9%95%9C%E5%83%8F%EF%BC%9A
> docker pull ghcr.io/byaidu/pdfmathtranslate
> docker run -d -p 7860:7860 ghcr.io/byaidu/pdfmathtranslate
>
3.2.* 安装时网络问题的解决方案
特定地区用户在加载AI模型时可能遇到网络困难。当前程序依赖AI模型(wybxc/DocLayout-YOLO-DocStructBench-onnx),部分用户因网络问题无法下载该模型。
若遇到模型下载问题,可通过以下环境变量解决:
set HF_ENDPOINT=https://hf-mirror.com
PowerShell用户:
$env:HF_ENDPOINT = https://hf-mirror.com
如果上述解决方案无效或遇到其他问题,请参考https://github.com/Byaidu/PDFMathTranslate/wiki#-faq--%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E3%80%82
在命令行执行翻译命令,将在当前工作目录生成翻译文档example-mono.pdf和双语文档example-dual.pdf。默认使用Google翻译服务。更多支持的翻译服务请参见https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#services%E3%80%82
下表列出所有高级选项供参考:
| 选项 | 功能 | 示例 |
|---|---|---|
| files | 本地文件 | pdf2zh ~/local.pdf |
| links | 在线文件 | pdf2zh http://arxiv.org/paper.pdf |
-i | 进入GUI | pdf2zh -i |
-p | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#partial | pdf2zh example.pdf -p 1 |
-li | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#languages | pdf2zh example.pdf -li en |
-lo | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#languages | pdf2zh example.pdf -lo zh |
-s | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#services | pdf2zh example.pdf -s deepl |
-t | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#threads | pdf2zh example.pdf -t 1 |
-o | 输出目录 | pdf2zh example.pdf -o output |
-f, -c | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#exceptions | pdf2zh example.pdf -f "(MS.*)" |
-cp | 兼容模式 | pdf2zh example.pdf --compatible |
--skip-subset-fonts | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#font-subset | pdf2zh example.pdf --skip-subset-fonts |
--ignore-cache | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#cache | pdf2zh example.pdf --ignore-cache |
--share | 公共链接 | pdf2zh -i --share |
--authorized | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#auth | pdf2zh -i --authorized users.txt [auth.html] |
--prompt | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#prompt | pdf2zh --prompt [prompt.txt] |
--onnx | [使用自定义DocLayout-YOLO ONNX模型] | pdf2zh --onnx [onnx/model/path] |
--serverport | [自定义WebUI端口] | pdf2zh --serverport 7860 |
--dir | [批量翻译] | pdf2zh --dir /path/to/translate/ |
--config | https://github.com/Byaidu/PDFMathTranslate/blob/main/docs/ADVANCED.md#cofig | pdf2zh --config /path/to/config/config.json |
--serverport | [自定义Gradio服务器端口] | pdf2zh --serverport 7860 |
--mode | 翻译模式:fast(默认,v1)或precise(v2,实验性,需pdf2zh_next子模块) | pdf2zh --mode precise example.pdf |
--babeldoc | 使用实验性后端https://funstory-ai.github.io/BabelDOC/%E8%BF%9B%E8%A1%8C%E7%BF%BB%E8%AF%91 | pdf2zh --babeldoc -s openai example.pdf |
--mcp | 启用MCP标准输入输出模式 | pdf2zh --mcp |
--sse | 启用MCP SSE模式 | pdf2zh --mcp --sse |
详细说明请参考高级用法文档。
4.2 下游开发 下游应用开发请参考API详情文档,包含以下内容:
4.3 两个主要分支的区别
https://github.com/Byaidu/PDFMathTranslate%EF%BC%9A%E5%BD%93%E5%89%8D%E9%A1%B9%E7%9B%AE%EF%BC%8C%E5%8E%9F%E5%A7%8B%E9%A1%B9%E7%9B%AE%EF%BC%8C%E7%94%A8%E4%BA%8E%E7%A8%B3%E5%AE%9A%E7%89%88%E6%9C%AC%E5%8F%91%E5%B8%83%E3%80%82
https://github.com/PDFMathTranslate/PDFMathTranslate-next%EF%BC%9A%E5%8C%85%E5%90%ABWeb UI和额外功能的分支。该分支处理大量边缘情况,提升PDF兼容性,优化跨列和跨页语义一致性、动态缩放及动态缩放一致性等翻译质量改进。但该分支仅用于开发,不解决兼容性问题,也不面向社区贡献。
本工作已被《2025年自然语言处理经验方法会议论文集:系统演示》(EMNLP 2025)收录。
引用格式:
@inproceedings{ouyang-etal-2025-pdfmathtranslate,
title = "{PDFM}ath{T}ranslate: Scientific Document Translation Preserving Layouts",
author = "Ouyang, Rongxin and
Chu, Chang and
Xin, Zhikuang and
Ma, Xiangyao",
editor = {Habernal, Ivan and
Schulam, Peter and
Tiedemann, J{\"o}rg},
booktitle = "Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
month = nov,
year = "2025",
address = "Suzhou, China",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2025.emnlp-demos.71/",
pages = "918--924",
ISBN = "979-8-89176-334-0",
abstract = "Language barriers in scientific documents hinder the diffusion and development of science and technologies. However, prior efforts in translating such documents largely overlooked the information in layouts. To bridge the gap, we introduce PDFMathTranslate, the world{'}s first open-source software for translating scientific documents while preserving layouts. Leveraging the most recent advances in large language models and precise layout detection, we contribute to the community with key improvements in precision, flexibility, and efficiency. The work is open-sourced at https://github.com/byaidu/pdfmathtranslate with more than 222k downloads."
}
5.2 致谢
Immersive Translation每月为该项目的活跃贡献者提供Pro会员兑换码,详情参见:https://github.com/funstory-ai/BabelDOC/blob/main/docs/CONTRIBUTOR_REWARD.md
新后端:https://github.com/funstory-ai/BabelDOC
文档合并:https://github.com/pymupdf/PyMuPDF
文档解析:https://github.com/pdfminer/pdfminer.six
文档提取:https://github.com/opendatalab/MinerU
文档预览:https://github.com/freddyaboulton/gradio-pdf
多线程翻译:https://github.com/SUSYUSTC/MathTranslate
布局解析:https://github.com/opendatalab/DocLayout-YOLO
文档标准:https://zxyle.github.io/PDF-Explained/%E3%80%81PDF Cheat Sheets
多语言字体:https://github.com/satbyy/go-noto-universal
5.3 贡献者
贡献方法详情请参考https://github.com/Byaidu/PDFMathTranslate/wiki/Contribution-Guide---%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97%E3%80%82
5.4 星标历史
来自真实用户的反馈,见证轩辕镜像的优质服务