docx
    Preparing search index...

    Module math

    Math for docx documents: equations, such as fractions, sums, integrals, radicals, scripts, brackets, matrices, cases and aligned equations with numbers, written as Office Math, which Word shows and edits as equations.

    Math comes with the docx package, from docx/math. Everything else, such as the document and its paragraphs, comes from docx. docx still exports the math it had before docx/math, as the same classes, not copies, so the two can be mixed. Matrices, cases, equation arrays and brackets of any characters come from docx/math only.

    import { Document, Packer, Paragraph } from "docx";
    import { Math, MathFraction, MathRun } from "docx/math";

    const doc = new Document({
    sections: [
    {
    children: [
    new Paragraph({
    children: [
    new Math({
    children: [
    new MathRun("2+2"),
    new MathFraction({ numerator: [new MathRun("hi")], denominator: [new MathRun("2")] }),
    ],
    }),
    ],
    }),
    ],
    },
    ],
    });

    const buffer = await Packer.toBuffer(doc);
    MathBrackets
    MathCases
    MathEquationArray
    MathMatrix
    MathBracketsOptions
    MathCase
    MathCasesOptions
    MathColumnAlignment
    MathEquationArrayOptions
    MathEquationArrayRow
    MathMatrixBrackets
    MathMatrixOptions
    MathVerticalAlignment
    createMathAccentCharacter → createMathAccentCharacter
    createMathBase → createMathBase
    createMathLimitLocation → createMathLimitLocation
    createMathNAryProperties → createMathNAryProperties
    createMathPreSubSuperScriptProperties → createMathPreSubSuperScriptProperties
    createMathSubScriptElement → createMathSubScriptElement
    createMathSubScriptProperties → createMathSubScriptProperties
    createMathSubSuperScriptProperties → createMathSubSuperScriptProperties
    createMathSuperScriptElement → createMathSuperScriptElement
    createMathSuperScriptProperties → createMathSuperScriptProperties
    IMathFractionOptions → IMathFractionOptions
    IMathFunctionOptions → IMathFunctionOptions
    IMathIntegralOptions → IMathIntegralOptions
    IMathLimitLowerOptions → IMathLimitLowerOptions
    IMathLimitUpperOptions → IMathLimitUpperOptions
    IMathOptions → IMathOptions
    IMathPreSubSuperScriptOptions → IMathPreSubSuperScriptOptions
    IMathRadicalOptions → IMathRadicalOptions
    IMathSubScriptOptions → IMathSubScriptOptions
    IMathSubSuperScriptOptions → IMathSubSuperScriptOptions
    IMathSumOptions → IMathSumOptions
    IMathSuperScriptOptions → IMathSuperScriptOptions
    Math → Math
    MathAngledBrackets → MathAngledBrackets
    MathComponent → MathComponent
    MathCurlyBrackets → MathCurlyBrackets
    MathDegree → MathDegree
    MathDenominator → MathDenominator
    MathFraction → MathFraction
    MathFunction → MathFunction
    MathFunctionName → MathFunctionName
    MathFunctionProperties → MathFunctionProperties
    MathIntegral → MathIntegral
    MathLimit → MathLimit
    MathLimitLower → MathLimitLower
    MathLimitUpper → MathLimitUpper
    MathNumerator → MathNumerator
    MathPreSubSuperScript → MathPreSubSuperScript
    MathRadical → MathRadical
    MathRadicalProperties → MathRadicalProperties
    MathRoundBrackets → MathRoundBrackets
    MathRun → MathRun
    MathRunOptions → MathRunOptions
    MathSquareBrackets → MathSquareBrackets
    MathSubScript → MathSubScript
    MathSubSuperScript → MathSubSuperScript
    MathSum → MathSum
    MathSuperScript → MathSuperScript