Crate math_core

Source
Expand description

Convert LaTeX math to MathML Core.

For more background on what that means and on what to do with the resulting MathML code, see the repo’s README: https://github.com/tmke8/math-core

§Usage

The main struct of this library is LatexToMathML. In order to use the library, create an instance of this struct and then call one of the convert functions. The constructor of the struct expects a config object in the form of an instance of MathCoreConfig.

Basic use looks like this:

use math_core::{LatexToMathML, MathCoreConfig, MathDisplay};

let latex = r#"\erf ( x ) = \frac{ 2 }{ \sqrt{ \pi } } \int_0^x e^{- t^2} \, dt"#;
let config = MathCoreConfig::default();
let converter = LatexToMathML::new(&config).unwrap();
let mathml = converter.convert_with_local_counter(latex, MathDisplay::Block).unwrap();
println!("{}", mathml);

§Features

  • serde: With this feature, MathCoreConfig implements serde’s Deserialize.

Structs§

LatexError
Represents an error that occurred during LaTeX parsing or rendering.
LatexToMathML
A converter that transforms LaTeX math equations into MathML Core.
MathCoreConfig
Configuration object for the LaTeX to MathML conversion.

Enums§

MathDisplay
Display mode for the LaTeX math equations.
PrettyPrint
Configuration for pretty-printing the MathML output.