从 Overleaf /docs 迁移
JointTex 的 POST /open 端点刻意沿用了 Overleaf /docs 的内联代码表单字段,使教程站点与教学平台几乎零成本就能支持 JointTex。
字段兼容性对照
Section titled “字段兼容性对照”| Overleaf 字段 | JointTex /open 支持情况 |
说明 |
|---|---|---|
snip、snip[] |
完全支持 | UTF-8 原文,自动将 CRLF 转为 LF。 |
encoded_snip、encoded_snip[] |
完全支持 | 使用 decodeURIComponent 解码;遇非法 % 转义时自动回退原文。 |
snip_name、snip_name[] |
完全支持 | 按顺序对应的相对文件路径。 |
main_document |
完全支持 | 指定编译主文件(.tex 或 .typ)。 |
engine |
完全支持并扩展 typst |
支持 pdflatex、xelatex、lualatex、latex(兼容 latex_dvipdf 别名)与 typst。 |
snip_uri、zip_uri |
暂不支持(返回 error=unsupported) |
为防止服务端成为开放代理,当前 /open 不代抓外部 URL;替代方案见下文。 |
splash |
忽略 | JointTex 始终先展示轻量预览确认页,由读者点击确认后再建项目。 |
迁移普通 HTML 表单
Section titled “迁移普通 HTML 表单”只需修改 action 地址与按钮文字:
<form action="https://www.overleaf.com/docs" method="post" target="_blank"><form action="https://jointtex.com/open" method="post" target="_blank"> <textarea name="snip" hidden>...</textarea> <button type="submit">Open in Overleaf</button> <button type="submit">在 JointTex 中打开</button></form>你也可以保留原有按钮,在旁边并列放置一个指向 https://jointtex.com/open 的表单,给读者双选择。
迁移 runlatex.js(learnlatex.org 类站点)
Section titled “迁移 runlatex.js(learnlatex.org 类站点)”基于 runlatex.js 搭建的交互式教程页面会直接发送 encoded_snip[] 和 snip_name[](含未编码的 LaTeX % 注释),JointTex 已专门兼容。只需修改两行配置:
runlatex.overleafURI = "https://jointtex.com/open";runlatex.texts["Open in Overleaf"] = "Open in JointTex";替换 snip_uri 或 zip_uri 链接
Section titled “替换 snip_uri 或 zip_uri 链接”由于当前 POST /open 不抓取远程 URL,可按内容形态选择对应方案:
- 纯文本示例代码(≤ 20 个文件、合计 ≤ 512 KiB):直接将文件内容填入
snip[]或encoded_snip[]字段,通过<form method="post" action="https://jointtex.com/open">提交。 - 包含图片、
.cls或.bst的完整模板:先将模板发布到 JointTex 模板库(后续更新可在项目内或通过 MCP 一键重新发布),再使用官方 SVG 徽章链接到https://jointtex.com/templates/<template-id>。
