Skip to content
cccskills
FreePublished on GitHub

academic-formula-inserter

Insert, format, and number math formulas in Word and LaTeX academic papers. Supports Chinese core journals and international journal formats. Invoke when user needs to insert LaTeX formulas into Word (OMML), validate formula formats per journal standards, or auto-number equations.

The English summary is being prepared. Showing the original description.

Works withWord

Run score Not tested

See how to install

Files included (12)

  • SKILL.md5.8 KB
  • scripts/build_docx_raw.py18.2 KB
  • scripts/build_ole_docx.py22.3 KB
  • scripts/convert_omml_to_mathtype.py6.2 KB
  • scripts/convert_omml_to_mathtype.vbs3.5 KB
  • scripts/convert_to_mathtype.py4.6 KB
  • scripts/formula_inserter.py11.4 KB
  • scripts/formula_numbering.py5.2 KB
  • scripts/latex_omml_converter.py9.5 KB
  • scripts/mathtype_integration.py11.3 KB
  • scripts/run_tests.py5.5 KB
  • scripts/utils/journal_profiles.py2.9 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Academic Formula Inserter

Insert, format, number, and validate math formulas in academic papers. Supports Word (.docx) with native OMML equations and LaTeX (.tex) output, with automatic formatting per journal standards.

Supported Journal Formats

CategoryFormatsExamples
Chinese CoreGB/T 7714 formula style中文核心、CSCD、CSSCI
InternationalIEEE, APA, Nature, ScienceElsevier, Springer, Taylor & Francis
General AcademicCustom numbering & styleThesis, dissertation, report

Formula Numbering Styles

StyleExampleUsed By
chinese式(1) 式(2)Chinese core journals
parentheses(1) (2)IEEE, general
brackets[1] [2]Some physics journals
section(1.1) (2.3)Thesis with section-based numbering
latex-tag\tag{1} \label{eq:1}LaTeX native

Commands

insert-formula — Insert LaTeX formula into Word document

Converts LaTeX string to native Word OMML equation and inserts at cursor or specified location.

Usage:

python insert_formula.py insert-formula <docx_path> --latex "<formula>" [--display] [--style <style>] [--number <num>]

Options:

ArgumentDescription
<docx_path>Path to .docx file
--latexLaTeX formula string (e.g. "E=mc^2")
--displayDisplay equation (centered, default: inline)
--styleNumbering style: chinese, parentheses, brackets, section, none
--numberSpecific number for the equation
--positionParagraph index to insert at
--labelEquation label for cross-reference
--interactiveInteractive mode: prompt to choose numbering style from a menu

batch-convert — Batch convert all LaTeX in document

Scans the document for $...$ and $$...$$ patterns and converts them to native OMML equations.

Usage:

python insert_formula.py batch-convert <docx_path> [--backup] [--mode quick|safe|full]

number-formulas — Auto-number all equations

Detects all equations in the document and numbers them sequentially according to the specified style.

Usage:

# 指定编号风格
python insert_formula.py number-formulas <docx_path> --style parentheses

# 交互模式: 程序提示用户选择编号风格
python insert_formula.py number-formulas <docx_path> --interactive

支持编号风格 (交互提示):

  编号   名称          示例              说明
  ----------------------------------------------
    1    中文核心      式(1)             适用于中文核心期刊
    2    圆括号        (1)               适用于 IEEE、Elsevier 等国际期刊
    3    方括号        [1]               适用于部分物理/数学期刊
    4    章节编号      (1.1)             适用于学位论文/多章节文档
    5    LaTeX标签     \tag{1}           LaTeX 原生格式
    6    中文+括号     式(1)             中文括号组合
    7    无编号        无                不添加编号
  ----------------------------------------------
  输入编号 (1-7),或按 Enter 使用默认 [2-圆括号]

validate-format — Validate formula format for journal

Checks if all formulas in the document conform to the target journal's style requirements.

Usage:

python insert_formula.py validate-format <docx_path> --journal <journal>

export-latex — Export formulas as LaTeX

Extracts all OMML equations from a Word document and exports them as LaTeX code.

Usage:

python insert_formula.py export-latex <docx_path> [--output <output.tex>]

list-styles — List all supported journal styles

python insert_formula.py list-styles

Conversion Pipeline

LaTeX string
    │
    ▼
latex2mathml ──── LaTeX → MathML
    │
    ▼
pandoc/mml2omml ── MathML → OMML (Office Math Markup Language)
    │
    ▼
python-docx ────── Insert OMML into .docx paragraph
    │
    ▼
Word native equation (editable, scalable)

Architecture

academic-formula-inserter/
├── SKILL.md                           # Skill definition
├── scripts/
│   ├── formula_inserter.py            # Main entry (CLI)
│   ├── latex_omml_converter.py        # LaTeX ↔ OMML conversion
│   ├── formula_numbering.py           # Auto-numbering engine
│   ├── format_validator.py            # Journal format validation
│   └── utils/
│       ├── docx_utils.py              # Word document utilities
│       ├── journal_profiles.py        # Journal format definitions
│       └── omml_builder.py            # Low-level OMML XML building

Requirements

  • Python 3.8+
  • python-docx
  • latex2mathml
  • lxml

Optional:

  • pandoc (for advanced MathML→OMML conversion)
  • pylatex (for LaTeX export)

Examples

Insert a display equation with Chinese numbering

python insert_formula.py insert-formula paper.docx ^
    --latex "\sum_{i=1}^{n} x_i = \mu" ^
    --display --style chinese --number 5

Result: centered equation with 式(5) right-aligned

Batch convert for IEEE submission

python insert_formula.py batch-convert paper.docx --backup
python insert_formula.py number-formulas paper.docx --style parentheses
python insert_formula.py validate-format paper.docx --journal ieee

Export to LaTeX

python insert_formula.py export-latex paper.docx --output formulas.tex

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Insert, format, and cross-reference academic citations in Word (.docx) documents. Supports GB/T 7714-2015, IEEE, APA 7th.

The English summary is being prepared. Showing the original description.

fuwenhao12/academic-ref-inserter60Updated Jun 1, 2026

Inserts, formats, and cross-references academic citations in docx. Invoke when user needs to insert references, fix citation order, add cross-reference hyperlinks, or reformat bibliography to Chinese (GB/T 7714) or international (IEEE/APA) standards.

The English summary is being prepared. Showing the original description.

fuwenhao12/academic-ref-inserter60Updated Jun 1, 2026

Insert, format, and cross-reference academic citations in Word (.docx) documents. Supports GB/T 7714-2015 (Chinese), IEEE, and APA 7th.

The English summary is being prepared. Showing the original description.

fuwenhao12/academic-ref-inserter60Updated Jun 1, 2026

See all skills by fuwenhao12

Report a problem with this skill