Styles and fonts
MathML is displayed by the browser. A Temml stylesheet picks the math font and fixes the places where browsers differ, so include exactly one of them on the page. Pages need the HTML5 doctype; Temml’s styles do not work in quirks mode.
The embedded files
Section titled “The embedded files”The Temml package embeds upstream’s stylesheets and Temml.woff2. TemmlAssets.Names lists them and TemmlAssets.Open returns a stream. Copy them to your static files, or serve them from an endpoint.
Directory.CreateDirectory(directory);
// Keep a stylesheet and Temml.woff2 in the same folder.foreach (var name in TemmlAssets.Names){ using var source = TemmlAssets.Open(name); using var target = File.Create(Path.Combine(directory, name)); source.CopyTo(target); Console.WriteLine(name);}Choosing a stylesheet
Section titled “Choosing a stylesheet”| Stylesheet | Math font | Font files to serve besides Temml.woff2 |
|---|---|---|
Temml-Local.css |
Fonts of the reader’s system: Cambria Math, STIX Two Math, or Noto Sans Math | none |
Temml-Latin-Modern.css |
Latin Modern, a clone of Computer Modern | latinmodernmath.woff2 |
Temml-Asana.css |
Asana Math | Asana-Math.woff2 |
Temml-Libertinus.css |
Libertinus Math | LibertinusMath-Regular.woff2 |
Temml-NotoSans.css |
Noto Sans Math | NotoSansMath-Regular.ttf |
Temml-STIX2.css |
STIX Two Math | STIXTwoMath.woff2 |
Only Temml.woff2 ships in the package. It is a small font with the script capitals of \mathscr and primes at the right height. Get the other fonts from their projects: STIX, Libertinus, Noto, or Mathematical OpenType Fonts. Check each font’s license. Keep the font files in the same folder as the stylesheet.
Upstream recommends Latin Modern for the best rendering. Temml-Local.css is the lightest choice, with some rendering problems: Chrome and Safari draw extensible arrows poorly with system fonts.
math { font-size: 125%; }Equation numbers
Section titled “Equation numbers”AMS environments are numbered by a CSS counter in the stylesheet. Override the rule to change the format, for example in chapter three of a book:
.tml-eqn::before { content: "(3." counter(tmlEqnNo) ")"; }If numbering looks wrong, check that your own CSS does not replace the counter-reset on body.
Browsers
Section titled “Browsers”Chrome, Edge, Firefox, and Safari support MathML. They do not render everything equally well. Upstream’s administration guide tracks the known problems.
MIT · Copyright 2020 Ron Kok · unofficial community port of Temml