跳到正文
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.

中文简介正在准备中。当前显示原文说明。

集成工具Word

实测评分 未实测

查看安装方法

包含的文件(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(原文)

安装前可以查看交给 AI 代理的指令内容。

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

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

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

中文简介正在准备中。当前显示原文说明。

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

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-inserter602026年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-inserter602026年6月1日 更新

查看 fuwenhao12 的全部技能

报告此技能的问题