[−][src]Crate latex2mathml
latex2mathml
Provides a functionility to convert LaTeX math equations to MathML representation. This crate is implemented in pure Rust, so it works for all platforms including WebAssembly.
Usage
Main functions of this crate are latex_to_mathml
and
replace
.
use latex2mathml::{latex_to_mathml, DisplayStyle}; let latex = r#"\erf ( x ) = \frac{ 2 }{ \sqrt{ \pi } } \int_0^x e^{- t^2} \, dt"#; let mathml = latex_to_mathml(latex, DisplayStyle::Block).unwrap(); println!("{}", mathml);
For converting a document including LaTeX equasions, the function replace
may be useful.
let latex = r#"The error function $\erf ( x )$ is defined by $$\erf ( x ) = \frac{ 2 }{ \sqrt{ \pi } } \int_0^x e^{- t^2} \, dt .$$"#; let mathml = latex2mathml::replace(latex).unwrap(); println!("{}", mathml);
For more examples please check examples/equations.rs
and examples/document.rs
.
Modules
ast | |
attribute | |
token |
Enums
DisplayStyle | display style |
LatexError |
Functions
latex_to_mathml | Convert LaTeX text to MathML. |
replace | Find LaTeX equations and replace them to MathML. |