Skip to content

[Epic] OMML Math + SmartArt [STRATEGIC] #26

@MHoroszowski

Description

@MHoroszowski

Problem

Two of the modern hard XML schemas are unmodelled: Office Math Markup Language (OMML) for equations, and DrawingML-Diagram for SmartArt. Both are STRATEGIC DEBT — neither is small, and both have niche-but-loyal user demand.

OMML / Equations. scanny/python-pptx#126 ("maths formula or LaTeX support", 14c) is the canonical issue; equations cannot even be extracted from text frames (scanny/python-pptx#947). The good news: there is a fork (OscarPellicer/python-pptx) with a working MathML → LaTeX translation (281 symbols mapped, +1241 lines in oxml/text.py), so a translator-style API is available as a starting point.

SmartArt / Diagrams. scanny/python-pptx#83 (4c) is the SmartArt anchor. The four-part bundle (diagram1.xml, diagram1_colors.xml, diagram1_quickStyle.xml, diagram1_layout.xml) round-trips today as a verbatim graphicFrame blob, but there is no API for create / edit / re-style. Jona210399/python-pptx has exploratory parsing ("kind of working"), and Martin005/python-pptx-ng has a pptx/parts/smartart.py skeleton that's a viable scaffold. The right scope here is "build the data model, let PowerPoint relayout on open" — full SmartArt layout regeneration in Python is a tar pit.

Sub-features

OMML / Equations

  • OMML XML element classes for <m:oMath>, <m:f> (fraction), <m:rad> (radical), <m:sub>/<m:sup>, <m:nary> (sum/integral), <m:m> (matrix), at minimum
  • Equation.from_latex(latex_string) — convert via existing pylatexenc-style translator
  • Equation.to_latex() — reverse direction (port OscarPellicer 281-symbol map)
  • Run.equation = Equation(...) — embed an equation inside a text run
  • Read-API: extract equations as text/latex from existing presentations

SmartArt

  • Slide.shapes.add_smartart(layout_id, data) where layout_id selects from a set of supported layouts (organization chart, bullet list, process flow first)
  • Data-model only: write <dgm:dataModel> with the user's hierarchy; let PowerPoint regenerate the visual layout on open
  • Round-trip preservation of all SmartArt parts (verify no corruption)
  • Read-API: traverse the data model of an existing SmartArt and extract the hierarchy

Prior art

Acceptance criteria

OMML

  • Run.equation = Equation.from_latex(r"\frac{a+b}{c}") produces a deck where the equation renders correctly in PowerPoint.
  • Reverse: equation.to_latex() for an existing OMML run returns reconstructable LaTeX.
  • 30+ symbol-mapping unit tests.

SmartArt

  • slide.shapes.add_smartart("OrgChart", root) with a 5-level hierarchy renders correctly when opened in PowerPoint.
  • Round-trip of SmartArt-containing decks does not corrupt the diagram.

Effort: L (combined)

Strategic debt. Recommend separate sub-epics in execution if either ships independently. OMML phase ~6 weeks (mostly translator porting). SmartArt phase ~10 weeks (data-model writing, layout-regen contract testing).

Labels

status:strategic-debt, priority:P2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:mathFeature area: matharea:smartartFeature area: smartartepicMulti-feature roadmap epicprior-art:forkActive community fork has shipped thisprior-art:upstream-prOpen PR on scanny/python-pptx is candidate cherry-pickpriority:P2Long-horizon / strategic debtstatus:strategic-debtMulti-quarter scope; phased delivery

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions