paper2tex
Skill1 starsChanged 3 months agoMITView on GitHub
Converts academic Word (.docx) papers into conference- and journal-formatted LaTeX (.tex) with seamless float flow, deterministic math/tables, verified citations, and OpenXML rotation/transform normalization. Trigger whenever the user asks to "use paper2tex", "run paper2tex", "convert my paper to LaTeX", "format docx for IEEE/ACM/Springer", or prepare submission-ready PDFs.
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Before executing the extraction pipeline, the agent MUST ALWAYS ask the user:
- Very specific: line 16
If the user replies
'extract': Run python -m scripts.extract input.docx work_dir/. - Distinctive: line 23
Run the end-to-end extraction and assembly pipeline:
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
paper2tex — Academic Paper Word-to-LaTeX Converter
Converts academic .docx papers into publication-ready, compiling LaTeX documents tailored to any conference or journal theme (IEEE, ACM, Springer LNCS, Elsevier, NeurIPS, ICML, CVPR, MDPI, Nature).
Mandatory Step 0: Figure Source Clarification
Before executing the extraction pipeline, the agent MUST ALWAYS ask the user:
"Do you have a dedicated
figures/folder with high-resolution or vector images (e.g.,./figures), or should I extract the embedded images directly from the Word document? (Reply with your folder path or simply 'extract')"
- If the user replies
'extract': Runpython -m scripts.extract input.docx work_dir/. The pipeline will automatically extract, normalize, and auto-rotate all embedded drawings from.docx. - If the user provides a folder path (e.g.,
./figuresorC:/assets/figs): Runpython -m scripts.extract input.docx work_dir/ --figures-dir <path>. The pipeline will match your high-res vector (.pdf,.svg) and raster (.png,.jpg>= 300 DPI) files to document figures.
Quick Start
Run the end-to-end extraction and assembly pipeline:
# 1. Verify system toolchain
python -m scripts.preflight
# 2. Extract content, math (OMML), tables, figures, and bibliography
python -m scripts.extract input.docx work_dir/ [--figures-dir <path>]
# 3. Apply target conference theme (or analyze custom template zip)
python -m scripts.template_spec "ieee-conference" work_dir/
# 4. Assemble main.tex with template-aware subfigures & seamless float flow
python -m scripts.assemble work_dir/
# 5. Compile and run visual QA verification
python -m scripts.compile work_dir/main.tex
python -m scripts.visual_qa work_dir/main.pdf work_dir/Workflow Stages
STAGE 0: FIGURE INQUIRY → Ask user for figures/ folder or "extract" confirmation
STAGE 1: PREFLIGHT → Check pandoc, tectonic/latexmk, lxml, Pillow, pymupdf
STAGE 2: PREPROCESS → Strip tracked changes, fix Symbol font trap, map field codes
STAGE 3: EXTRACT → Parallel extractors for OMML math, tables, figures, bib
STAGE 4: THEME SPEC → Match recipe (IEEE/ACM/LNCS) or research via Firecrawl
STAGE 5: AST ASSEMBLE → Deterministic assembly with template-aware subfigures & subfloats
STAGE 6: COMPILE LOOP → Engine selection (XeLaTeX/pdfLaTeX) + automated log auto-fix
STAGE 7: VERIFICATION → Manifest diff + special character audit + Visual QA
STAGE 8: DELIVER → submission/ folder (.tex, .bib, figures/, .pdf, report.md)Core Architectural Guarantees
- 100% Verbatim Prose Preservation: Maps Markdown AST directly to LaTeX. Zero dropped paragraphs, zero paraphrasing, zero text alteration.
- OpenXML Rotation & Flip Normalization: Accurately parses
<a:xfrm rot="...">to prevent sideways/rotated images. - Template-Aware Subfigures: Uses
\usepackage[caption=false,font=footnotesize]{subfig}with\subfloatforIEEEtranandsubcaptionforacmart/llncs. - Subcaption Decomposition: Splits composite captions with
(a),(b),(c)into individual panel captions. - Seamless Float Flow: Eliminates disruptive
\FloatBarrierinjections before sections. Floats place naturally ([!t],[b]) with zero blank page voids. - Deterministic OMML Math: Word equations convert directly to LaTeX via MathML XSLT — never through LLM text re-emission.
Documentation & References
- Layout & Float Rules: See LAYOUT_GUIDELINES.md for figure sizing, subfigure geometry, and table formatting.
- Themes & Firecrawl Research: See THEMES_AND_TEMPLATES.md for venue recipes and online template research.
- Technical Reference: See REFERENCE.md for extraction internals, symbol font mapping, and compiler auto-fix taxonomy.
- Agent Instructions: See AGENTS.md for step-by-step agent instructions.
- Setup Guide: See SETUP.md for platform-specific setup (Antigravity, Claude Code, Cursor, OpenCode).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

