Expresso.Element.Math.Tex (expresso v0.1.0)

Copy Markdown View Source

Makes the MathML of formulas in LaTeX with Temml

Temml is a library in JavaScript, so render!/2 runs Node with the script priv/temml/render.mjs, through Expresso.Element.Diagram.Tool. The project holds a copy of temml.mjs and its license in priv/temml/, so a render needs Node and no package of npm. EXPRESSO_NODE gives the path of Node, as for a diagram of Mermaid. version/0 gives the version of the copy.

One run of Node makes the MathML of each source of a list, so a deck starts Node one time. Temml makes a formula in display mode, and it trusts \class and \data only, because the parts of a formula use them. It refuses each other command that writes an attribute or reads a file, such as \includegraphics. The macros \part and \id give a name to a part. docs/math-parts.md gives the design.

Summary

Types

The result for one source: its MathML, or the message of Temml

Functions

Make the MathML of each source, in one run of Node

The path of the script that runs Temml

The version of the copy of Temml

Types

result()

@type result() :: {:ok, String.t()} | {:error, String.t()}

The result for one source: its MathML, or the message of Temml

Functions

render!(sources)

@spec render!([String.t()]) :: [result()]

Make the MathML of each source, in one run of Node

The function returns one result for each source, in the same order: the MathML of a source that Temml reads, or the message of Temml for a source that it cannot read. An empty list needs no Node. The function raises an ArgumentError when Node is not present, and when the script fails.

script()

@spec script() :: Path.t()

The path of the script that runs Temml

tool()

The tool, for Expresso.Element.Diagram.Tool

version()

@spec version() :: String.t()

The version of the copy of Temml