docx
    Preparing search index...

    Module math

    Math for docx documents: equations, such as fractions, sums, integrals and other large operators, radicals, scripts, brackets, accents, braces, boxes, matrices, cases and aligned equations with numbers, written as Office Math, which Word shows and edits as equations. latexToMath turns LaTeX into the same math.

    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, brackets of any characters, accents, bars, braces, boxes, phantoms, large operators and latexToMath 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);
    MathAccent
    MathBar
    MathBox
    MathBrace
    MathBrackets
    MathCases
    MathEquationArray
    MathLargeOperator
    MathMatrix
    MathPhantom
    MathAccentName
    MathAccentOptions
    MathBarOptions
    MathBoxOptions
    MathBoxSide
    MathBoxStrike
    MathBraceOptions
    MathBraceShape
    MathBracketsOptions
    MathCase
    MathCasesOptions
    MathColumnAlignment
    MathEquationArrayOptions
    MathEquationArrayRow
    MathLargeOperatorName
    MathLargeOperatorOptions
    MathMatrixBrackets
    MathMatrixOptions
    MathPhantomOptions
    MathPosition
    MathVerticalAlignment
    latexToMath
    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
    MathFractionType → MathFractionType
    MathFunction → MathFunction
    MathFunctionName → MathFunctionName
    MathFunctionProperties → MathFunctionProperties
    MathIntegral → MathIntegral
    MathLimit → MathLimit
    MathLimitLower → MathLimitLower
    MathLimitsPosition → MathLimitsPosition
    MathLimitUpper → MathLimitUpper
    MathNumerator → MathNumerator
    MathPreSubSuperScript → MathPreSubSuperScript
    MathRadical → MathRadical
    MathRadicalProperties → MathRadicalProperties
    MathRoundBrackets → MathRoundBrackets
    MathRun → MathRun
    MathRunOptions → MathRunOptions
    MathRunScript → MathRunScript
    MathRunStyle → MathRunStyle
    MathSquareBrackets → MathSquareBrackets
    MathSubScript → MathSubScript
    MathSubSuperScript → MathSubSuperScript
    MathSum → MathSum
    MathSuperScript → MathSuperScript