RetexPDF
The normal request is: input PDF → complete translation → generic arXiv-style LaTeX → compiled PDF. Do this work, including layout classification and translation. Do not require the user to find author TeX, use LaTeX, configure a translation API, or run scripts. The agent translates; the scripts persist, assemble and compile. The supplied PDF is the authoritative edition.
Prepare the environment automatically
Windows:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "<skill>/scripts/bootstrap.ps1" -WithPdf
macOS:
bash "<skill>/scripts/bootstrap.sh" ensure --with-pdf
Use the absolute python executable in the returned JSON. Require status: ready. Bootstrap reuses a working private environment and compatible installed Python first; only downloads Python when none is compatible. An explicitly supplied -PythonPath / --python takes precedence. The managed PDF environment supports 64-bit Python 3.10–3.14. It installs pinned PyMuPDF in a private environment and detects or installs Tectonic. Do not modify system Python, PATH, shell profiles or the registry. Do not install a full TeX distribution. Use the existing cache under %LOCALAPPDATA%/RetexPDF or ~/Library/Caches/RetexPDF.
First use needs network access for missing dependencies, packages and fonts. Do not pass -Offline / --offline on an ordinary first use. Doctor is read-only; offline explicitly forbids downloads. macOS entrypoints exist but still need native Mac validation. Preserve concrete logs on an environment failure and repair it where possible; do not send users to install LaTeX manually.
Select the input route
- PDF supplied: use the PDF workflow,
scripts/pdf_translate.py, andassets/arxiv-paper.tex. Do not divert into finding author TeX or freezing a reconstructed excerpt. Author source is not a prerequisite. The agent must classify the rendered PDF and fill the complete translation ledger. - Existing TeX project supplied: use the source ledger and
scripts/translation_ledger.py. Original TeX math may be retained directly. Preserve the supplied class unless the user requests the generic template. - Paper link/ID supplied: obtain the exact requested PDF. Matching source is optional; never silently substitute a different edition.
Use the user's requested target language and locale. Infer an established target from the conversation; ask only if it is truly unspecified. Chinese is not a fixed target. Choose fonts and language support for the requested writing system.
Non-negotiable content rules
- Translate the whole paper, including all paragraphs, headings, captions, ordinary footnotes, acknowledgments, algorithms, proofs and appendices. A request to see the effect still means the whole paper unless a sample is explicitly requested. Never summarize, shorten a derivation, or replace a section with an explanation of what was omitted.
- Preserve the entire author block exactly: names, order, affiliation text, superscripts, contribution/correspondence notes and emails. Preserve bibliography entries and numbering. Preserve data, identifiers and formula labels. Preserve figure/table artwork and values; translate captions. If the user requests text inside artwork/tables translated, add a separate mapped text-layer workflow rather than silently treating it as translated.
- Keep each inline formula in its sentence. Preserve every display formula, multi-line derivation and symbol. For PDF input, copy formula/figure/table regions as vector PDF clips, including fractions, radicals, accents and equation numbers. Never re-draw mathematics with image generation. Do not reconstruct a formula from unreliable extracted character order.
- Retain source order. Join sentences split across pages before translating. Keep figure/table captions with their objects and algorithms together when they fit a page. Use the generic template to reflow text; original coordinates and original page count are not a requirement unless explicitly requested.
- Add no translator preface, reading instructions, omission note, summary or new content inside the paper. Technical reports belong outside the PDF.
- Persist the original, the complete inventory and each translation before assembly. Each source unit must have a translation or an explicitly legitimate preserved asset. Never use an unchanged-prose fallback to hide unfinished translation. Context limits mean save and resume pending units, not omit them.
- A glyph inventory proves only mechanical coverage of extracted glyphs. Compare the rendered source pages with the inventory to catch drawings, scanned text, multi-column reading order and damaged extraction. Compare each translated unit with its complete source. A
reviewedflag records actual work; it is not a shortcut to pass a build.
PDF execution
Follow the detailed reference for command and JSON formats:
extract: preserve the exact original PDF, all pages, glyphs, fonts and positions.- Inspect page renders; classify author blocks, figures, tables, captions and display math in
layout.json. Correct inline-math segmentation and joins. Mark pages reviewed only after comparing their visible contents with the inventory. Include any graphical content without native text. prepare --target-language ...: assign translation IDs and freeze the layout, prose and vector fragments. Every native glyph must be accounted for exactly once.pending: read complete units with their context. Translate in batches and save withput --file ... --reviewedonly after actual source comparison. Math placeholders must remain complete and ordered. Use a consistent glossary.build --output <new-project>: assemble a freshmain.texandfragments.pdf, then automatically compile. Missing translations, changed source/layout, missing formula tokens or unreviewed units/pages stop the build. Never use the compiler alone to bypass these checks for an unfinished translation.- Render and inspect the actual compiled PDF. Repair clipping, overlap, bad glyphs, detached captions and broken inline formulas. Verify every source page and section, including the final appendix, has corresponding output content. Deliver only after the work is complete.
A layout change requires prepare again. Translation IDs may change: reconcile old rows by the frozen source hash and page, then check the mapping. Never copy old ID-keyed rows blindly or recompute hashes to approve changed content.
For scans or broken text extraction, add OCR/visual transcription to the persisted inventory before translating. This script's native extractor is not an OCR engine and must not treat image-only pages as empty. If a block cannot yet be read, continue recovering it; do not silently omit it or claim a complete output.
Fonts, compilation and delivery
The bundled template is a generic single-column academic article suitable for arXiv-style output, not a unique official arXiv template. Chinese uses ctex with Fandol by default. Other scripts can supply --language-setup containing the correct font/language packages; confirm coverage, shaping and direction with a representative heading, paragraph and formula. Do not treat the target-language parameter alone as proof that fonts are configured.
Tectonic downloads missing packages/fonts automatically. Repair compiler errors in the generated working copy or generator, never by deleting content. failed is not a deliverable; review_required means a PDF exists but its warnings need resolving. compiled only confirms compilation, not semantic or visual completeness. For source-only compilation requests, use retex.ps1 -Action Compile or retex.sh compile directly. Shell-escape remains disabled.
Keep job/intermediate files in the RetexPDF job cache or a user-designated work directory. Deliver the complete translated PDF and editable assembled project; retain the original snapshot, layout, translation ledger and coverage report for traceability. Do not bundle the paper's data or translation into the installed skill. Disclose concrete remaining limitations outside the paper, including preserved original-language labels inside figures/tables when applicable. Never promise that mechanical checks guarantee perfect semantic translation for every possible PDF.