帮助中心
关于撰写、编译和协作 LaTeX 与 Typst 项目的清晰实用指南。
在你的网站上加“在 JointTex 中打开”
让教程、课程或文档的读者一键把 LaTeX 或 Typst 示例打开为自己的 JointTex 项目。
添加按钮
这个按钮就是一个普通的 HTML 表单,把示例代码发送给 JointTex。字段名与 Overleaf 的“Open in Overleaf”相同,为 Overleaf 写好的页面只需改表单地址。
操作步骤
- 在示例旁边放一个表单,method 为 post,action 为 https://jointtex.com/open。
- 把代码放进名为 snip 的字段;如果页面用 encodeURIComponent 编码过,就放进 encoded_snip。
- 加一个提交按钮。你的网站不需要脚本、密钥或账号。
<form action="https://jointtex.com/open" method="post" target="_blank">
<textarea name="snip" hidden>
\documentclass{article}
\begin{document}
Hello, JointTex!
\end{document}
</textarea>
<button type="submit">Open in JointTex</button>
</form>发送多个文件
带参考文献或单独章节文件的示例,把每个文件作为一个字段依次发送。
操作步骤
- 每个文件重复一次 snip[](或 encoded_snip[]),并按同样的顺序在 snip_name[] 中给出文件名。未命名的第一个文件叫 main.tex。
- 有多个 .tex 文件时,用 main_document 指定要编译的文件;否则 JointTex 取唯一的 .tex 文件,或含有 \documentclass 的那个。
- 文件名可以带文件夹,例如 chapters/intro.tex。
<form action="https://jointtex.com/open" method="post" target="_blank">
<input type="hidden" name="encoded_snip[]" value="...main.tex, encoded with encodeURIComponent...">
<input type="hidden" name="snip_name[]" value="main.tex">
<input type="hidden" name="encoded_snip[]" value="...refs.bib, encoded...">
<input type="hidden" name="snip_name[]" value="refs.bib">
<input type="hidden" name="main_document" value="main.tex">
<input type="hidden" name="engine" value="xelatex">
<button type="submit">Open in JointTex</button>
</form>选择编译器
除非表单或代码另有说明,JointTex 用 pdfLaTeX 编译。
操作步骤
- 把 engine 设为 pdflatex、xelatex、lualatex 或 latex。Overleaf 的 latex_dvipdf 按 latex 处理。
- 没有 engine 字段时,由主文件开头附近的 % !TEX program = xelatex 这类注释决定。
- 两者都没有时,主文件含中文、日文或韩文就用 XeLaTeX 编译,否则用 pdfLaTeX。
- 单个文件里没有 \documentclass 时(例如只有一个表格),会被放进一个最小文档,以便能够编译。
发送 Typst 代码
同一个表单也能把 Typst 示例打开为 Typst 项目。Overleaf 没有这个字段,这部分是 JointTex 自己的。
操作步骤
- 把 engine 设为 typst。未命名的文件依次叫 main.typ、snippet-2.typ……
- 没有 engine 字段时,若没有发送 .tex 文件,以 .typ 结尾的文件就是主文件;也可以用 main_document 指定。
- Typst 代码不会被放进别的文档:任何 Typst 文本本身就能编译。
<form action="https://jointtex.com/open" method="post" target="_blank">
<textarea name="snip" hidden>
= Hello, JointTex!
Typst sets this paragraph.
</textarea>
<input type="hidden" name="engine" value="typst">
<button type="submit">Open in JointTex</button>
</form>读者看到什么
代码不会自己变成项目:读者先看过它。
操作步骤
- 表单把读者带到 JointTex 的一个页面,上面列出文件、主文件、编译器和你网站的地址。
- 已登录的读者给项目起名,然后点“创建项目”。新读者先注册或登录,再回到同一个页面。
- 项目属于读者本人,是私有的。再次点“创建项目”、刷新或返回,打开的都是同一个项目,不会多出一份。
- 代码保存在读者的浏览器里 7 天,而不是 JointTex 的服务器上:读者创建项目之前,服务器不保存任何内容。在隐私窗口或不为网站保存数据的浏览器中,代码只在当前标签页打开期间保留。
限制
提交的内容是教学示例,不是整篇论文。
操作步骤
- 最多 20 个文件,每个不超过 256 KB,合计不超过 512 KB,按 UTF-8 计算。
- 只接受文本:附带的文件,以及要求从网址抓取文件的 snip_uri、zip_uri,都会被拒绝。
- 表单发来 JointTex 打不开的内容时,读者会看到一个说明原因的页面。
