> ## Documentation Index
> Fetch the complete documentation index at: https://felimet-hub.jmcores.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MathType for Word 與 PowerPoint 公式工具包

> AI Agent 用 skill、plugin、MCP server 在 Word 與 PowerPoint 建立可編輯的 MathType 公式，Word 含原生編號與引用。

`MathType` · `MCP` · `AI Agent` · `Windows` · `Office Automation`

## 專案概述

讓 AI Agent 在 Microsoft Word 與 PowerPoint 裡建立可編輯的 MathType 7 公式。專案以可安裝的 skill、Codex 與 Claude 的 plugin，以及本機 MCP server 提供，Word 文件另支援 MathType 原生的公式編號與動態交叉引用。產出的是真正的 `Equation.DSMT4` 物件，不是 Word OMath、圖片或手打的 Unicode 公式，所以公式隨時能回到 MathType 編輯。

## 核心功能

* 建立可編輯的 `Equation.DSMT4` 物件，不以 Word OMath、圖片或手打 Unicode 公式代替
* DOCX 支援行內公式與置中的獨立公式
* 掃描完整文章後，把原稿中的數學內容分類為行內公式、未編號獨立公式、編號獨立公式或動態引用；唯讀掃描能找出純文字數學（含 Word 上下標格式），標記步驟再把審閱後的片段換成標記
* 插入 `(1)` 等 Word 的 MathType 原生編號與動態引用
* 透過隱藏的 Word 轉換文件，在 PowerPoint 建立置中的浮動 MathType 公式
* 保留來源 Office 檔案，輸出前先驗證；既有輸出預設不覆寫，需明確指定 `-Overwrite`
* 大型 Word 文件分批渲染（`batch_size` 預設 40），可中斷續跑，也能在背景執行並以 `get_mathtype_render_status` 查詢進度
* 附中英雙語的學術公式樣式參考：純量變數斜體、向量粗體小寫、矩陣與張量粗體大寫、函數名稱與 SI 單位正體
* 跨 Agent 的 skill 與 plugin，附本機 MCP server 供 Codex 與 Claude 直接使用；ChatGPT 須透過 remote endpoint 或 Secure MCP Tunnel

## 專案架構

Word 的渲染由 JSON manifest 驅動：manifest 為每個公式列出 TeX、版面（行內或獨立）與是否編號，並以文件中恰好出現一次的標記（例如 `{{MATH:id}}`）指定位置；每個引用也有各自的標記，指向已編號的公式。

發生逾時時，bridge 只終止自己記錄為啟動的 Office 程序；PowerPoint 作業也不會關閉使用者原本已開啟的 PowerPoint。repository 的目錄結構如下：

**mathtype-for-word**

**skills/mathtype-for-word · 跨 Agent skill、參考資料與 launcher**

**SKILL.md**

**scripts · Office automation bridge、MCP server 與封裝程式**

**mathtype-word.ps1 · Office bridge**

**mcp\_server.py · MCP server**

**mathtype\_batch.py · 批次渲染**

**ensure-pwsh.ps1 · 安裝 PowerShell 7**

**package\_plugin.py · 封裝**

**.claude-plugin/marketplace.json · Claude Code marketplace**

**.agents/plugins/marketplace.json · Codex marketplace**

**config/defaults.json · Word 公式編號預設設定**

**evals/fixtures · 真實繁中、英文 DOCX 與 PPTX 評測輸入**

**en-paper-draft.docx · 搭配 en-word-manifest.json**

**en-presentation-draft.pptx · 搭配 en-powerpoint-manifest.json**

**tests · 靜態、MCP、Office 整合、視覺與封裝測試**

**run-tests.ps1**

**dist · 封裝產物**

**mathtype-for-word-plugin.zip · plugin 封裝，附 SHA-256 檔**

**mathtype-for-word.skill · 獨立 skill 套件**

**CHANGELOG.md · 各版本變更紀錄**

## 快速開始

先確認下方注意事項列出的系統需求。README 另附一段安裝 prompt，貼給 Agent 就能依目前環境完成設定；手動安裝則依使用的 Agent 擇一：

**1. Claude Code 安裝 plugin**

```console theme={null}
claude plugin marketplace add felimet/mathtype-for-word
claude plugin install mathtype-for-word@mathtype-for-word
```

升級時執行 `claude plugin marketplace update mathtype-for-word` 與 `claude plugin update mathtype-for-word@mathtype-for-word`。

**2. Codex 安裝 plugin**

```console theme={null}
codex plugin marketplace add felimet/mathtype-for-word
codex plugin add mathtype-for-word@mathtype-for-word
```

Plugin 內含 skill 與 MCP server，並把工具逾時上限設為 1200 秒。升級時執行 `codex plugin marketplace upgrade mathtype-for-word`，再執行一次 `codex plugin add`。

**3. 重新啟動並驗證安裝**

安裝或升級後重新啟動 Claude Code 或 Codex，再執行驗證：

```console theme={null}
pwsh.exe -NoProfile -ExecutionPolicy Bypass -File scripts/mathtype-word.ps1 -Action probe
pwsh.exe -NoProfile -ExecutionPolicy Bypass -File scripts/mathtype-word.ps1 -Action probe-pptx
pwsh.exe -NoProfile -ExecutionPolicy Bypass -File tests/run-tests.ps1 -IncludeLiveOffice
```

三個命令分別檢查 Word 的前置條件、PowerPoint 的前置條件，並執行含實機 Office 的測試；路徑為 repository 內的相對路徑。

**4. 交給 Agent 處理文件**

告訴 Agent 要編輯的 DOCX 或 PPTX，以及需要建立的公式。Agent 會保留來源檔，把結果寫成新檔；驗證回傳 `ok: true` 才算完成。

## 安裝方式比較

**點選 Agent 比較安裝方式**

## 注意事項

> [!WARNING]
>
> 僅支援 Windows 10 或 11，需要可用 COM automation 的 Microsoft Word 與 PowerPoint 桌面版、`PATH` 中的 Python 3，以及桌面版 **MathType for Windows**（從 [MathType 下載頁面](https://mathtype.tw/download/)取得）。不能只裝 **MathType Add-In for Microsoft 365**：那是 Microsoft 365 的工作窗格外掛，不具備本工具使用的桌面 OLE、Word template、PowerPoint add-in 與 COM 工作流。本專案以 `MathType-win-zh-7.11.1.462`（ProductVersion `7.11.1.462`）開發與驗證。MathType 與 Microsoft Office 為專有產品，repository 不包含其安裝程式或授權。

> [!WARNING]
>
> Office bridge 必須由 `pwsh.exe`（PowerShell 7 以上）執行。外層終端機可以是 PowerShell 7、Windows 上的 Bash（含 Git Bash）或 CMD，但不可直接在 Windows PowerShell 5.1 執行 bridge。從 WSL 使用時要呼叫 Windows 的 `pwsh.exe`，Linux 版 `pwsh` 無法操作 Windows 的 Office COM。找不到 `pwsh.exe` 時，MCP server 會為目前使用者安裝 PowerShell 7，並在工具回覆中告知：下載約 106 MB、占用約 300 MB，ZIP 的 SHA-256 須與固定雜湊一致，`pwsh.exe` 須具有效的 Microsoft 簽章，不需系統管理員權限，也不修改 PATH 與登錄。

> [!WARNING]
>
> AI Agent 編輯 Word、PowerPoint 或 MathType 內容時必須靜默執行：不顯示或切換應用程式視窗、不搶奪鍵盤焦點、不彈出 modal dialog，也不以滑鼠或鍵盤自動化操作可見的 UI；某一步驟無法靜默完成時，應停止並回報限制。PowerPoint 的轉換會短暫使用 Windows 剪貼簿，並覆蓋使用者原本複製的內容。PowerPoint 不具備 Word 的 MathType 編號與引用機制，本工具也不以手打內容假冒。

## 實際應用面

適合把論文草稿或簡報中的公式交給 AI Agent 處理，而成品必須是能在 MathType 中再編輯的公式物件的情境。Word 文件的編號與交叉引用是 MathType 原生欄位，不是手打的文字。repository 內附真實的繁體中文與英文 DOCX、PPTX 評測輸入，可以拿來做簡易測試。

## 相關連結

* GitHub：[felimet/mathtype-for-word](https://github.com/felimet/mathtype-for-word)
* 各平台安裝矩陣：[installation-matrix.md](https://github.com/felimet/mathtype-for-word/blob/main/skills/mathtype-for-word/references/installation-matrix.md)
* MathType 下載頁面：[mathtype.tw/download](https://mathtype.tw/download/)
* 收錄於：[hashgraph-online/awesome-ai-plugins](https://github.com/hashgraph-online/awesome-ai-plugins)
* 收錄於：[hol.org/plugins](https://hol.org/plugins)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.