Robust latex formula extraction

From XuShuwenn/RedAct · View interactive version

Robust latex formula extraction is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Use this when extracting display equations from PDFs into $$...$$ LaTeX lines with exact rendering, while avoiding tool timeouts, hallucinated content, and syntax/quoting errors.

How to use this skill

Skill file

Robust LaTeX Formula Extraction from PDFs

A resilient workflow to extract only standalone (display) equations from PDFs and write them as raw LaTeX, with fallbacks and validations that prevent common failure modes such as tool timeouts, hallucinated formulas, or broken LaTeX/quoting.

When to Use

Activate this skill when a task asks you to:

Core Workflow

1) Clarify scope and output format

2) Tool selection with bounded, test-first execution

3) Locating display equations (without guesswork)

4) Transcription discipline (preserve exact display)

5) Output assembly and safe writing

6) Validation before finalizing

Verification

Use these checks before delivering the file:

Success criteria:

Common Pitfalls and How to Avoid Them

Optional Script Usage

Use scripts/math_formula_guard.py to sanitize and validate formulas before writing the final file.

Examples:

The script reports bracket and \left/\right balance issues and removes trailing punctuation/tags at line ends. It does not invent content or change math structure.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.