Crates.io | asciimath-text-renderer |
lib.rs | asciimath-text-renderer |
version | 0.1.0 |
source | src |
created_at | 2023-10-03 21:37:45.148611 |
updated_at | 2023-10-03 21:37:45.148611 |
description | Render asciimath in terminal |
homepage | https://github.com/Fiedzia/asciimath-text-renderer/ |
repository | https://github.com/Fiedzia/asciimath-text-renderer/ |
max_upload_size | |
id | 991574 |
size | 48,322 |
Render asciimath in terminal
Display math formulas as plain text using unicode characters.
This is work in progress, several important parts of spec are not supported yet.
Examples:
The Discrete Fourier Transform is defined as X^k=1/N sum_(n=0)^(N-1)x_n * e^(-ik (2pi)/N n) = 1/N sum_(n=0)^(N-1)x_n[cos(k (2pi)/N n) -i sin(k (2pi)/N n)]
2π
-ik────n
k 1 N-1 N 1 N-1 ⎡ ⎛ 2π ⎞ ⎛ 2π ⎞⎤
X =───∑ x ⋅e =───∑ x ⎥cos⎜k────n⎜-isin⎜k────n⎜⎥
N n=0 n N n=0 n⎣ ⎝ N ⎠ ⎝ N ⎠⎦
f(x)=sqrt x + 1/2x^2
▁ 1 2
f(x)=2╲╱x+───x
2
sqrt x
▁
╲╱x
Limitations:
cancel cannot be implemented in general. It is possible to replace it with strike-through line for text literals ( cancel x -> x̶ or x̷ or x̸ ), there is no way to do it for expressions.
we don't control fonts, therefore fancy text effects are also impossible or very limited (they can be imitated for text literals)
usage:
cargo add asciimath-text-renderer
if you downloaded source, you can run example:
cargo run --example render 'sqrt(2)'
▁
╲╱2