# TS Latex

> Assemble and compile the final PDF, repairing compile errors. Use last, after ts-review.

- Skill: `openjiuwen-ai/ts-latex` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add openjiuwen-ai/ts-latex`
- Raw SKILL.md: https://api.skillmd.com/api/skills/openjiuwen-ai/ts-latex/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: openJiuwen-ai (https://skillmd.com/u/openjiuwen-ai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/openjiuwen-ai/ts-latex

---


# ts-latex

Run (both `{SKILLS_DIR}` and `{PAPER_WORKSPACE}` are absolute paths given
in your system prompt — pass `{PAPER_WORKSPACE}` exactly as shown, do not
`cd` there instead):

```
python {SKILLS_DIR}/ts-latex/scripts/compile.py {PAPER_WORKSPACE}
```

It reads `title.txt`, `keywords.txt`, and every file under `sections/`
from `{PAPER_WORKSPACE}`, assembles `main.tex`, compiles it with
latexmk/pdflatex, and prints JSON.

If `"success": true`, you are done.

If `log_tail` says `no LaTeX toolchain found (latexmk/pdflatex not on
PATH)`, stop immediately — do not retry the compile script, and do not
try to locate, install, or hardcode a path to a LaTeX distribution
anywhere (not in this script, not in an env var, not by editing your
own tools). That is an environment limitation, not something a section
edit or a shell command can fix, and a previous run once "fixed" this by
baking one developer's local install path into tracked source — do not
repeat that. Report that `main.tex` is assembled and ready but this
environment could not compile it; the host accepts the `.tex` itself as
the final artifact in that case.

Otherwise, read `error_lines` (the compiler's own `! <error>` messages)
and `log_tail`. Make the smallest safe fix in the specific section `.tex`
file the error points to: unescaped special characters, unclosed
environments, malformed table/figure syntax, an undefined command. Do
not rewrite prose, remove citations, or change numbers — fix only what's
breaking the build. Then run the compile script again.

Repeat up to 4 times total. If it's still failing after that, stop and
report which section and which compiler error are still unresolved — do
not claim success the script didn't confirm.
