本文へ移動
cccskills
無料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.

インストール方法を見る

含まれるファイル(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(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

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.

日本語の概要は準備中です。原文の説明を表示しています。

fuwenhao12/academic-ref-inserter582026年6月1日 更新

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

日本語の概要は準備中です。原文の説明を表示しています。

fuwenhao12/academic-ref-inserter582026年6月1日 更新

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

日本語の概要は準備中です。原文の説明を表示しています。

fuwenhao12/academic-ref-inserter582026年6月1日 更新

fuwenhao12 のスキルをすべて見る

このスキルの問題を報告する