From office-docx-skills
Use when a `.docx` or Word task needs editable equations, Word-native formulas, OMML, Cambria Math, formula line breaking, or converting plain-text formulas into editable Word equation objects.
How this skill is triggered — by the user, by Claude, or both
Slash command
/office-docx-skills:word-formula-writingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Write formulas in Word as native editable equation objects. This skill is for equation production inside `.docx`, not for general document layout by itself.
Write formulas in Word as native editable equation objects. This skill is for equation production inside .docx, not for general document layout by itself.
Use this skill when:
.docx document must contain editable formulas;Do not use this skill alone for:
a^2, x_t, or slash-style fractions when native equations are required;Cambria MathUse this toolchain when formula generation is required:
python-docx for document structure, paragraphs, and stylesmath2docx for inserting Word-native equations when availablelatex2mathml and mathml2omml as backup conversion tools when neededlxml for XML-level inspection and validationInstall missing packages in the active project environment before generating formula-heavy DOCX files:
python3 -m pip install python-docx lxml math2docx latex2mathml mathml2omml
For smoke tests or simple generated documents, use formula_writer.py beside this skill. It creates a minimal native Word equation (m:oMath) that Word can open as an equation object.
from formula_writer import create_docx_with_omml_formula
create_docx_with_omml_formula(
"formula.docx",
"x+1=2",
body_text="Formula example",
)
For production-quality equation layout, use a richer converter such as math2docx or a LaTeX -> MathML -> OMML flow, then inspect word/document.xml for m:oMath.
Check whether the user wants:
.docxIf the user only wants explanation in chat, this skill is unnecessary.
Separate:
Do not merge equation blocks into ordinary body style.
Preferred path:
math2docx.docx contains equation objects rather than text substitutesIf needed, use the fallback chain:
When a formula risks exceeding the page width:
By default:
Cambria Math for formulas10 pt of heading space_before after a display formula, with small page-level adjustment when neededWord formulas are not always editable OMML. In imported or older documents, formulas may appear as embedded objects or images. Treat these as formula candidates when they sit inline with equation text, symbol explanations, model definitions, or variable descriptions.
If the user asks which formula objects or relationship artifacts must be preserved before translation or review, answer with this preservation checklist before looking for document files.
Recognize these representations:
m:oMath and m:oMathPara for modern editable Word equations;w:object for legacy embedded equation objects;v:shape and v:imagedata for older VML image/object formulas;w:drawing for drawing-based inline equation images;When preserving image/OLE formulas:
word/document.xml and related .rels files;rId values are scoped to a specific DOCX part;r:embed, r:id, and equivalent attributes when copying across parts or documents;[Content_Types].xml when copied formula assets introduce new content types;Formula preservation is not proven by document-level object counts. Compare per-pair formula signatures: object type, relationship target, dimensions, media hash when accessible, target basename, and paragraph/table-cell context.
After generating the document, check at least these points:
Run the included smoke test after changing formula helpers:
python3 tests/docx-smoke/test_formula_writer.py
This skill can be used alone or together with other skills in office-docx-skills.
word-default-formatting when equations must match the document's default Word formatting profile.docx-tracked-changes when formula-related edits should appear as Word-visible revisions.Use the following routing logic.
word-formula-writingword-default-formatting + word-formula-writing.docx equation outputCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub wintersdragon-c/office-docx-skills --plugin office-docx-skills