Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MinerU LaTeX ZIP to PPTX

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.

What It Does

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.

Expected MinerU Input

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.json
  • full.md
  • MinerU_markdown_*.md

The script can also accept:

  • an extracted folder containing MinerU_latex_*.tex
  • a direct .tex file

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.

Install Dependencies

Use Python 3.10+.

python -m pip install -r requirements.txt

To keep dependencies isolated:

python -m pip install --target .deps -r requirements.txt

Then pass .deps with --deps.

Usage

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.pptx

With 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 .deps

Force 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-only

Use --latex-only only for debugging or when no MinerU JSON/PDF coordinate data exists.

How The Pipeline Works

  1. convert_mineru_latex_to_pptx.py accepts a ZIP, folder, or .tex file.
  2. If the input is a ZIP, it extracts it to a temporary directory.
  3. It finds MinerU_latex_*.tex.
  4. It searches nearby directories for:
    • *_content_list.json
    • *_origin.pdf
  5. If both are found, it delegates to convert_mineru_to_pptx.py.
  6. 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
  7. The final deck is saved as .pptx.

Validation

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)
PY

Scan 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])
PY

On macOS, create a quick first-slide preview:

mkdir -p preview
qlmanage -t -s 1200 -o preview outputs/example_from_mineru_latex.pptx

Repository Layout

.
├── SKILL.md
├── README.md
├── requirements.txt
├── agents/
│   └── openai.yaml
└── scripts/
    ├── convert_mineru_latex_to_pptx.py
    └── convert_mineru_to_pptx.py

Codex Skill Installation

To install as a local Codex skill:

mkdir -p ~/.codex/skills
cp -R . ~/.codex/skills/mineru-latex-pdf-to-ppt

Notes And Limitations

  • The high-fidelity path depends on MinerU content_list.json coordinates 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.

About

AI Skills for PDF-to-PPTX Conversion Using MinerU LaTeX ZIP Files as Input

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages