Skip to content

Feature request: Native mathematical notation support (LaTeX / OMML) #1456

@armarion

Description

@armarion

Is your feature request related to a problem? Please describe.

PptxGenJS currently has no first-class way to render mathematical notation. Anything passed as text becomes a plain text run, which means equations either have to be:

  1. Faked with Unicode characters and superscript/subscript properties (works for trivial expressions, falls apart for fractions, matrices, integrals with bounds, summations, etc.), or
  2. Pre-rendered to images via MathJax/KaTeX/LaTeX and embedded with addImage() — which loses editability, scales poorly, and adds a heavy external toolchain.

PowerPoint itself natively supports math via OMML (<m:oMath> blocks in OOXML) and renders it through the built-in equation editor, so the underlying file format is already there — it's just not exposed through the PptxGenJS API.

Describe the solution you'd like

A native math API on text and shape objects. Something along the lines of:

slide.addText({ math: "\\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}" }, { x: 1, y: 1, w: 8, h: 1 });

or as part of a text run:

slide.addText([
  { text: "The quadratic formula is " },
  { math: "x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}" }
], { x: 1, y: 1, w: 8, h: 1 });

LaTeX input would be the most ergonomic for users, but accepting raw OMML/MathML as an alternative input would also be valuable for power users who already have equations in those formats.

The key requirement is that the output should be real, editable PowerPoint equations (OMML), not embedded images — so end users can double-click and edit them in the native equation editor.

Describe alternatives you've considered

  • Unicode + superscript/subscript: Fine for x² + y² = r², useless for anything structural (fractions, matrices, big operators with bounds).
  • MathJax/KaTeX → SVG/PNG → addImage: Works visually but produces non-editable images, requires an external rendering pipeline, and scales/exports inconsistently.
  • Direct OOXML manipulation post-generation: Doable (unpack the .pptx, inject <m:oMath> blocks, repack) but defeats the purpose of using PptxGenJS in the first place.

Use cases

  • Academic and research presentations
  • Quantitative finance decks (formulas, Greek-heavy notation, derivations)
  • Engineering and scientific reports
  • Educational content and lecture slides
  • Any internal tooling that auto-generates technical decks from data pipelines (this is increasingly common with LLM-driven slide generation)

Implementation notes

A LaTeX-to-OMML conversion would likely lean on an existing library — mathml2omml, tex2mathml, or similar — to keep the scope contained. The bulk of the work would be wiring the OMML output into the slide XML at the right location within text runs and shapes.

Happy to help test or contribute if useful. Thanks for maintaining this library — it's been the foundation for a lot of automated reporting work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions