Convert MinerU LaTeX ZIP exports into editable PowerPoint decks.
This repository contains a Codex skill and standalone Python scripts for rebuilding slide PDFs from MinerU output. It is intended for math-heavy slide decks where a pure Markdown-to-PPT or raw LaTeX-to-PPT conversion tends to leave broken formulas or visible LaTeX source in the deck.
The primary input is the LaTeX ZIP exported by MinerU:
MinerU_latex_*.zip
For best fidelity, keep that ZIP in the same MinerU export directory as the matching *_content_list.json and *_origin.pdf. The converter uses the ZIP as the user-facing input, then uses MinerU's structured block coordinates and the source PDF to preserve formulas, charts, and fragile visual blocks.
The converter creates a hybrid .pptx deck:
- safe OCR text becomes editable PowerPoint text boxes
- formulas, math-heavy lines, uncertain OCR, charts, and figures become faithful image crops
- source images are inserted with aspect ratio preserved
- slides are rebuilt as 16:9 widescreen decks
- raw LaTeX commands such as
\frac,\mathrm, and\begin{array}are kept out of editable text boxes when MinerU coordinate data is available
This is intentionally not a pure LaTeX renderer. For slide decks, visual correctness of formulas is usually more important than making every formula glyph editable.
A typical MinerU export directory should look like this:
mineru-export/
├── MinerU_latex_example_123456789.zip
├── document_id_content_list.json
├── document_id_origin.pdf
├── layout.json
├── full.md
└── images/
Required for the normal high-fidelity path:
MinerU_latex_*.zip- sibling
*_content_list.json - sibling
*_origin.pdf
Optional but useful:
images/layout.jsonfull.mdMinerU_markdown_*.md
The script can also accept:
- an extracted folder containing
MinerU_latex_*.tex - a direct
.texfile
If the matching JSON/PDF files are missing, the script falls back to a LaTeX-only flow. That fallback is less faithful because LaTeX alone does not preserve the original PDF slide coordinates.
Use Python 3.10+.
python -m pip install -r requirements.txtTo keep dependencies isolated:
python -m pip install --target .deps -r requirements.txtThen pass .deps with --deps.
From this repository/skill directory:
python scripts/convert_mineru_latex_to_pptx.py \
/path/to/mineru-export/MinerU_latex_example_123456789.zip \
outputs/example_from_mineru_latex.pptxWith an isolated dependency directory:
python scripts/convert_mineru_latex_to_pptx.py \
/path/to/mineru-export/MinerU_latex_example_123456789.zip \
outputs/example_from_mineru_latex.pptx \
--deps .depsForce the LaTeX-only fallback:
python scripts/convert_mineru_latex_to_pptx.py \
/path/to/MinerU_latex_example_123456789.zip \
outputs/example_latex_only.pptx \
--latex-onlyUse --latex-only only for debugging or when no MinerU JSON/PDF coordinate data exists.
convert_mineru_latex_to_pptx.pyaccepts a ZIP, folder, or.texfile.- If the input is a ZIP, it extracts it to a temporary directory.
- It finds
MinerU_latex_*.tex. - It searches nearby directories for:
*_content_list.json*_origin.pdf
- If both are found, it delegates to
convert_mineru_to_pptx.py. - The coordinate converter builds each slide from MinerU blocks:
- titles and safe text become editable text
- equations, charts, images, and fragile OCR/math become image crops
- The final deck is saved as
.pptx.
Validate the generated PPTX with any standard PPTX validator or by opening it in PowerPoint/Keynote/LibreOffice.
Check slide count and dimensions:
python - <<'PY'
from pptx import Presentation
p = Presentation("outputs/example_from_mineru_latex.pptx")
print(len(p.slides), p.slide_width, p.slide_height)
PYScan editable text boxes for leaked LaTeX source:
python - <<'PY'
import re
from pptx import Presentation
p = Presentation("outputs/example_from_mineru_latex.pptx")
patterns = [r"\\frac", r"\\boldsymbol", r"\\begin", r"\\end", r"\\mathrm", r"\\nabla"]
texts = []
for si, slide in enumerate(p.slides, 1):
for shape in slide.shapes:
if hasattr(shape, "text") and shape.text.strip():
texts.append((si, shape.text.strip()))
for pat in patterns:
hits = [(si, t[:120].replace("\n", " ")) for si, t in texts if re.search(pat, t)]
print(pat, len(hits), hits[:3])
PYOn macOS, create a quick first-slide preview:
mkdir -p preview
qlmanage -t -s 1200 -o preview outputs/example_from_mineru_latex.pptx.
├── SKILL.md
├── README.md
├── requirements.txt
├── agents/
│ └── openai.yaml
└── scripts/
├── convert_mineru_latex_to_pptx.py
└── convert_mineru_to_pptx.py
To install as a local Codex skill:
mkdir -p ~/.codex/skills
cp -R . ~/.codex/skills/mineru-latex-pdf-to-ppt- The high-fidelity path depends on MinerU
content_list.jsoncoordinates and the original PDF. - The LaTeX ZIP alone is not enough to reconstruct exact original slide layout.
- Formula-heavy blocks are intentionally rendered as image crops, not editable PPT equations.
- Visual QA is still recommended for slides with dense formulas or large charts.
- Default style: 16:9 deck, bright blue centered titles, Arial body text.