Convert Microsoft Word .docx files and PDF .pdf files into compilable LaTeX projects. Use when Codex needs to transform DOCX/PDF sources into a project containing main.tex, figures/, references.bib, and a conversion report while preserving headings, lists, tables, equations, footnotes, images, captions, and Chinese document support with ctexart or xeCJK. Also use to inspect PDFs for extractable text and stop with an OCR-required message for scanned/image-only PDFs.
Resources
9Install
npx skillscat add zhouder/latex-forge Install via the SkillsCat registry.
LaTeX Forge
Convert .docx and .pdf sources into editable LaTeX project folders.
Default Workflow
Use the unified client first:
python scripts/latex_forge.py convert input.docx output-project
python scripts/latex_forge.py convert input.pdf output-projectFor non-technical users who want a local graphical client:
python scripts/latex_forge_gui.pyFor Windows distribution, build the app EXE and installer EXE:
powershell -ExecutionPolicy Bypass -File packaging\build_windows.ps1Expected output:
output-project/
main.tex
figures/
references.bib
conversion-report.mdFor Chinese documents, compile with XeLaTeX or LuaLaTeX. The converters detect CJK text and default to:
\documentclass[UTF8]{ctexart}If ctex is unavailable, rerun with:
python scripts/latex_forge.py convert input.docx output-project --engine xeCJKCommands
Inspect a file before converting:
python scripts/latex_forge.py inspect input.pdf
python scripts/latex_forge.py inspect input.docxConvert and attempt a local LaTeX build when a TeX engine exists:
python scripts/latex_forge.py convert input.docx output-project --compileRun the converters directly only when debugging:
python scripts/docx_to_latex.py input.docx output-project
python scripts/pdf_to_latex.py input.pdf output-projectRun self-tests after editing the skill:
python scripts/smoke_test.pyConversion Contract
DOCX conversion should preserve or approximate:
- Headings as section commands
- Ordered and unordered lists
- Tables as
tabular - OMML equations as approximate LaTeX math
- Footnotes as
\footnote{...} - Images copied into
figures/ - Caption-styled paragraphs attached to adjacent figures or tables
PDF conversion should:
- Extract text from searchable PDFs
- Create a compilable draft
main.tex - Refuse scanned/image-only PDFs with a clear OCR-required message
- Avoid claiming semantic fidelity for PDF tables, equations, and references
Review Gate
Before final delivery to a user:
- Confirm
main.tex,figures/,references.bib, andconversion-report.mdexist. - Read
conversion-report.mdfor warnings. - Inspect and repair equations, tables, captions, citations, and cross-references.
- Compile with XeLaTeX when available, especially for Chinese documents.
- Tell the user when OCR, manual equation repair, table cleanup, or citation reconstruction remains.
Detailed Reference
Read references/conversion-notes.md when:
- A conversion has warnings
- A source document contains complex equations, tables, captions, references, or Chinese text
- A PDF appears scanned or low-quality
- The user asks how to install, run, or validate the skill outside Codex