Skip to main content
Glama
overleaf-resume

overleaf-resume

by rohangawhade

Overleaf 简历

在本地编辑和编译你的简历,而不是在 Overleaf 网站上,通过一个 MCP 服务器在需要时与 Overleaf 同步源文件。支持任意数量的 Overleaf 项目并行工作——每个同步工具都接受显式的 project_id,因此不会绑定到某个单一的"那个"项目。

专为 免费版 Overleaf 账户(无 Git/API 访问权限)打造。如果你的账户有 Git 集成(付费版),直接 git clone 你的项目即可——你不需要这个工具。

工作原理

  • 日常编辑: 项目拉取后(见下文),直接在 projects/<name>/ 下编辑其 .tex 文件,然后用 Tectonic 在本地编译——无需往返 Overleaf:

tools/tectonic.exe projects/<name>/<main file>.tex

这会在旁边生成一个 PDF。(tools/tectonic.exe 是本仓库中已配置好的独立二进制文件——由于它是下载的大型二进制文件而非源码,已被 gitignore。)

  • 与 Overleaf 同步: 由于这是免费版 Overleaf 账户(无 Git/API 访问权限),一个 MCP 服务器(overleaf_mcp/)通过 Playwright 驱动一个真实、已登录的 Chromium 会话,下载项目源码并将编辑内容推回其在线编辑器——与你在浏览器中手动操作相同。

Related MCP server: LaTeX Resume MCP

项目结构

每个拉取的 Overleaf 项目都会放在自己的子文件夹中,因此多个简历可以共存而不会冲突:

projects/
  <your-project-name>/
    resume.tex (or whatever the project's main file is named)
    ...other pulled files (.cls, .sty, images)
    .backups/            # timestamped backups made before each re-pull
  <another-project-name>/
    ...

projects/ 已被 gitignore——它存放你实际的简历内容(从 Overleaf 拉取),因此保持本地状态,永远不会被提交。

一次性设置

步骤 1-2 已在本仓库中完成(.venv/ 已安装依赖并下载了 Playwright 的 Chromium 浏览器;tools/tectonic.exe 已就绪)。此处列出它们,以防你需要在另一台机器上或干净检出后重新执行。

  1. 创建虚拟环境并安装依赖:

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
playwright install chromium
  1. 获取 Tectonic:winget/choco 可能需要并不总是可用的管理员权限。可靠的无管理员选项是直接下载 Windows 二进制文件并将其放入 tools/:

gh release download tectonic@0.17.0 --repo tectonic-typesetting/tectonic \
  --pattern "tectonic-0.17.0-x86_64-pc-windows-msvc.zip" --dir tools
# then unzip it so tools/tectonic.exe exists

用 tools/tectonic.exe --version 验证。

  1. 登录一次 Overleaf,以便 MCP 服务器可以复用会话:

.venv/Scripts/python.exe scripts/overleaf_login.py

浏览器窗口会打开 Overleaf 的登录页面。使用邮箱 + 密码登录,而不是"使用 Google 登录"——Google 会阻止其登录表单在任何自动化浏览器中运行,因此仅使用 Google 的账户需要先在 Overleaf 上设置密码(账户设置)。会话随后保存到 .auth/storage_state.json(已被 gitignore——切勿提交或分享)。每当 overleaf_login_status 报告会话已过期时,重新运行此脚本。

  1. 本仓库的 .mcp.json 会自动向 Claude Code 注册服务器。重启 Claude Code(或运行 /mcp),以便它加载 overleaf-resume 服务器。

  2. 调用 overleaf_list_projects 查看你所有的 Overleaf 项目及其 id,然后对你想处理的项目调用 overleaf_pull(project_id)。文件会放在 projects/<name>/ 下。

MCP 工具

  • overleaf_login_status — 检查保存的会话是否仍然有效。

  • overleaf_list_projects — 列出每个 Overleaf 项目(名称 + id)。

  • overleaf_pull(project_id, local_dir?) — 将该项目的源码下载到 projects/<name>/(或指定的 local_dir),并先将其中已有的 .tex/.cls/.sty/.bib 文件备份到 .backups/ 下。

  • overleaf_push(project_id, file_path) — 将本地文件的当前内容推回该 Overleaf 项目的在线编辑器。file_path 相对于本仓库根目录,例如 projects/<your-project-name>/resume.tex。

project_id 始终是必需的——没有单一的默认项目,因此无论你有一个还是多个简历,它的工作方式都相同。需要查找时,随时使用 overleaf_list_projects。

本地编译故障排查

Overleaf 默认使用 pdfLaTeX 编译;Tectonic 使用基于 XeTeX 的引擎。这在流行的 "Jake's Resume" 风格模板上暴露了两个问题,以防你也遇到:

  • \pdfglyphtounicode / \input{glyphtounicode} / \pdfgentounicode=1 是仅 pdfTeX 的基元。对它们进行保护,以便两种引擎都能工作:

\usepackage{iftex}
\ifPDFTeX
  \input{glyphtounicode}
\fi
...
\ifPDFTeX
  \pdfgentounicode=1
\fi
  • enumitem 的 \begin{itemize}...\end{itemize} 配对(通过此模板的 \resumeSubHeadingListStart/End 宏)即使在注释掉的章节中也必须保持平衡——注释掉一个块后遗留的孤立、不匹配的 \end{itemize} 会在 enumitem 内部深处(\enit@enditemize)产生一个令人费解的 Undefined control sequence。这不是 Tectonic/Overleaf 的差异——如果你查看错误计数,它在 Overleaf 自己的编译器上也会失败。

注意事项

  • 这会使用你自己的已登录会话自动化 Overleaf 的实际 Web UI——免费版项目没有公共 API。如果 Overleaf 更改其 UI,它可能会失效,并且保存的会话偶尔会过期(重新运行 scripts/overleaf_login.py)。

  • 第一次 tectonic 编译需要网络访问来获取 LaTeX 包;后续编译会缓存并支持离线工作。

  • .auth/storage_state.json 包含有效的会话 cookie——请将其排除在版本控制之外。

Related MCP Connectors

Related MCP Servers