latex-compiler
Compile LaTeX documents to PDF. Accepts LaTeX source as content strings and returns compiled PDF via base64 or container-internal path.
Prerequisites
This skill requires a LaTeX compilation server listening on localhost:8080. The Prismer project provides one as part of its container setup.
Source & review: The container source is at github.com/Prismer-AI/Prismer/tree/main/docker/base (Apache-2.0). Before running, review the Dockerfile and docker-compose.dev.yml to verify:
- - No host filesystem volumes are mounted (the dev compose only maps ports)
- The container runs as a non-root user
- Only port 16888 (gateway) is exposed to the host
If the container is not running, all tool calls will fail with a connection error. The skill does not fall back to other local services or retry on different ports.
Description
This skill sends LaTeX source strings via HTTP POST to localhost:8080. It supports pdflatex, xelatex, and lualatex engines, bibliography processing via biber, multi-pass compilation for cross-references, and starter templates.
Data flow: The skill sends only LaTeX content strings (from tool parameters) to the container via HTTP. It does not read host files, environment variables, or credentials. Output PDFs are generated inside the container at /home/user/output/reports/ (container-internal path, not host-mounted). Use latex_preview to retrieve PDFs as base64 — no host filesystem mount is involved.
Usage Examples
- - "Compile this LaTeX document to PDF"
- "Preview the PDF output of my paper"
- "What LaTeX templates are available?"
- "Give me the IEEE template"
- "Compile this with xelatex for Chinese support"
Process
- 1. Choose template — Use
latex_templates to see available templates, then latex_get_template to get starter content - Write LaTeX — Edit the source document
- Compile — Use
latex_compile to generate the PDF (saved in container) - Preview — Use
latex_preview to get an inline base64 PDF for display
Tools
latex_compile
Compile LaTeX source to PDF. The PDF is saved inside the container.
Parameters:
- -
content (string, required): Full LaTeX source code - INLINECODE9 (string, optional): Output filename stem (default:
document) - INLINECODE11 (string, optional):
pdflatex | xelatex | lualatex (default: pdflatex) - INLINECODE16 (string, optional): BibTeX/BibLaTeX content (triggers biber)
- INLINECODE17 (number, optional): Compilation passes (default: 2 for cross-references)
Returns: INLINECODE18
Example:
CODEBLOCK0
latex_preview
Compile LaTeX source and return the PDF as base64 for inline preview.
Parameters:
- -
content (string, required): Full LaTeX source code - INLINECODE20 (string, optional): Output filename stem (default:
document) - INLINECODE22 (string, optional):
pdflatex | xelatex | lualatex (default: pdflatex) - INLINECODE27 (string, optional): BibTeX/BibLaTeX content (triggers biber)
Returns: INLINECODE28
Example:
CODEBLOCK1
latex_templates
List available LaTeX templates and supported engines.
Parameters: None
Returns: INLINECODE29
latexgettemplate
Get the LaTeX source of a starter template.
Parameters:
- -
name (string, required): Template name — article, article-zh, beamer, INLINECODE34
Returns: INLINECODE35
Example:
CODEBLOCK2
Notes
- - Chinese documents (
article-zh) require xelatex or lualatex engine - Compilation timeout is 120 seconds per run
- Multi-pass compilation (default 2 runs) resolves cross-references and TOC
- If
bibliography is provided, biber runs automatically between passes - PDFs are saved to
/home/user/output/reports/ inside the container (not on the host) - Use
latex_preview to get PDF as base64 without needing host filesystem access - No host filesystem mounts are required — all I/O is via HTTP to the container
- If localhost:8080 is unreachable, tools return a connection error (no fallback to other services)
latex-compiler
将LaTeX文档编译为PDF。接受LaTeX源代码作为内容字符串,并通过base64或容器内部路径返回编译后的PDF。
前置条件
此技能需要一个在localhost:8080上监听的LaTeX编译服务器。Prismer项目在其容器设置中提供了一个这样的服务器。
来源与审查: 容器源代码位于github.com/Prismer-AI/Prismer/tree/main/docker/base(Apache-2.0)。运行前,请审查Dockerfile和docker-compose.dev.yml以确认:
- - 没有挂载主机文件系统卷(开发compose仅映射端口)
- 容器以非root用户运行
- 仅向主机暴露端口16888(网关)
如果容器未运行,所有工具调用将失败并返回连接错误。此技能不会回退到其他本地服务或在其他端口上重试。
描述
此技能通过HTTP POST将LaTeX源代码字符串发送到localhost:8080。它支持pdflatex、xelatex和lualatex引擎、通过biber处理参考文献、用于交叉引用的多遍编译以及入门模板。
数据流: 此技能仅通过HTTP将LaTeX内容字符串(来自工具参数)发送到容器。它不会读取主机文件、环境变量或凭据。输出的PDF在容器内的/home/user/output/reports/(容器内部路径,非主机挂载)生成。使用latex_preview以base64格式检索PDF——不涉及主机文件系统挂载。
使用示例
- - 将此LaTeX文档编译为PDF
- 预览我的论文的PDF输出
- 有哪些可用的LaTeX模板?
- 给我IEEE模板
- 使用xelatex编译此文档以支持中文
流程
- 1. 选择模板 — 使用latextemplates查看可用模板,然后使用latexgettemplate获取入门内容
- 编写LaTeX — 编辑源文档
- 编译 — 使用latexcompile生成PDF(保存在容器中)
- 预览 — 使用latex_preview获取内联base64格式的PDF进行显示
工具
latex_compile
将LaTeX源代码编译为PDF。PDF保存在容器内部。
参数:
- - content(字符串,必填):完整的LaTeX源代码
- filename(字符串,可选):输出文件名主干(默认:document)
- engine(字符串,可选):pdflatex | xelatex | lualatex(默认:pdflatex)
- bibliography(字符串,可选):BibTeX/BibLaTeX内容(触发biber)
- runs(数字,可选):编译次数(默认:2次,用于交叉引用)
返回: { success, pdfpath, log, errors, warnings, compileid }
示例:
json
{ content: \\documentclass{article}\\begin{document}Hello\\end{document}, engine: pdflatex }
latex_preview
编译LaTeX源代码并返回base64格式的PDF用于内联预览。
参数:
- - content(字符串,必填):完整的LaTeX源代码
- filename(字符串,可选):输出文件名主干(默认:document)
- engine(字符串,可选):pdflatex | xelatex | lualatex(默认:pdflatex)
- bibliography(字符串,可选):BibTeX/BibLaTeX内容(触发biber)
返回: { success, pdfbase64, pdfpath, log, errors, warnings, compile_id }
示例:
json
{ content: \\documentclass{article}\\begin{document}Hello\\end{document} }
latex_templates
列出可用的LaTeX模板和受支持的引擎。
参数: 无
返回: { templates: string[], engines: string[] }
latexgettemplate
获取入门模板的LaTeX源代码。
参数:
- - name(字符串,必填):模板名称 — article、article-zh、beamer、ieee
返回: { name, content }
示例:
json
{ name: ieee }
注意事项
- - 中文文档(article-zh)需要使用xelatex或lualatex引擎
- 每次编译超时时间为120秒
- 多遍编译(默认2次)可解析交叉引用和目录
- 如果提供了bibliography,biber会在各遍编译之间自动运行
- PDF保存到容器内部的/home/user/output/reports/(不在主机上)
- 使用latex_preview获取base64格式的PDF,无需访问主机文件系统
- 不需要主机文件系统挂载——所有I/O通过HTTP与容器进行
- 如果localhost:8080不可达,工具将返回连接错误(不回退到其他服务)