[−][src]Function latex2mathml::replace
pub fn replace(input: &str) -> Result<String, LatexError>
Find LaTeX equations and replace them to MathML.
- inline-math:
$..$
- display-math:
$$..$$
Note that dollar signs that do not enclose a LaTeX equation (e.g. This apple is $3.
) must not appear
in the input string. Dollar sings in LaTeX equation (i.e. \$
command) must also not appear.
Please use $
, instead of $
, outside LaTeX equations.
let input = r#"$E = m c^2$ is the most famous equation derived by Einstein. In fact, this relation is a spacial case of the equation $$E = \sqrt{ m^2 c^4 + p^2 c^2 } ,$$ which describes the relation between energy and momentum."#; let output = latex2mathml::replace(input).unwrap(); println!("{}", output);
examples/document.rs
gives a sample code using this function.