Crate math_dsl_macro

Source
Expand description

For example

tex_expr!(r"\frac\pi 3 (1-\cos^2\psi)^2");

Gets expanded zu something close to

std::f64::consts::PI / 3f64  * ( 1f64 - psi.cos().powi(2) ).powi(2);

Similarly,

tex_equation!(r"x=\frac\pi 3 (1-\cos^2\psi)^2");

gets expanded to

let x = std::f64::consts::PI / 3f64  * ( 1f64 - psi.cos().powi(2) ).powi(2);

If, for example, myinput.tex contains

Other \LaTeX code
\begin{align*}
x=\frac\pi 3 (1-\cos^2\psi)^2
\end{align*}
Other \LaTeX code
\begin{align*}
a=b+c
\end{align*}
Other \LaTeX code

then

from_latex_file!("myinput.tex");

gets expanded to

let x = std::f64::consts::PI / 3f64  * ( 1f64 - psi.cos().powi(2) ).powi(2);
let a = b + c;

Macros§