texmath

package
v0.0.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package texmath converts a small, scope-controlled subset of TeX math notation into MathML. The output is deliberately limited to the element set understood by the boxesandglue MathML reader (boxesandglue/frontend/math/mathml): <mi> <mn> <mo> <mrow> <mfrac> <msqrt> <mroot> <msup> <msub> <msubsup>. Feeding the existing MathML entry point — rather than building math atoms directly — means TeX formulas inherit the whole rendering and accessibility pipeline for free (Formula tagging, MathML associated file under PDF/UA-2).

This is a proof-of-concept subset, not a full LaTeX math engine. It covers what typical Markdown prose needs: variables, numbers, operators, super/ subscripts, \frac, \sqrt (with optional index), Greek letters, common relation/operator symbols and named operators (\sin, \log, …). Unknown macros degrade to their literal name as an upright identifier rather than erroring out, so a document never fails to render over one stray command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToMathML

func ToMathML(tex string, display bool) (string, error)

ToMathML converts a TeX math fragment into a MathML string. When display is true the root <math> carries display="block", which the boxesandglue MathML reader routes to DisplayMath (centred, larger operators); otherwise it is laid out inline. The returned string always has a single <math> root, so it drops straight into HTML where htmlbag picks it up as a formula.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL