Math Text Transform

Travis build crates.io

A simple crate that provides functions to map a greek letter, latin letter, or a decimal digit to a certain variant from the mathematical alphanumeric symbols Unicode block (U+1D400–U+1D7FF). We also provide convenience string methods that maps each character in a string to the variant (or leaves it alone if there is none).

Supported variants are:

Install

Add this to your Cargo.toml:

toml [dependencies] math-text-transform = "*"

Usage

```rust extern crate mathtexttransform; use mathtexttransform::MathTextTransform;

asserteq!("Bold".tomathbold(), "𝐁𝐨đĨ𝐝"); asserteq!("ÎŖÎąÎŊ΃-ÎŖÎĩĪÎšĪ†-ΒÎŋÎģδ".tomathsansserifbold(), "𝝨𝝰đŧ𝞂-𝝨𝝴𝞀𝝸𝞅-𝝗𝝾đēđŗ"); asserteq!("Double-struck 123".tomathdoublestruck(), "đ”ģ𝕠đ•Ļ𝕓𝕝𝕖-𝕤đ•Ĩđ•Ŗđ•Ļ𝕔𝕜 𝟙𝟚𝟛"); ```

Documentation

https://runarberg.github.com/math-text-transform

CLI utility

If you are for some reason only interested in the CLI utility you can install with:

bash $ git clone https://github.com/runarberg/math-text-transform.git $ cd math-text-transform $ cargo build --release $ [sudo] ln -s $(pwd)/target/release/math-text-transform /usr/local/bin/math-text-transform

And use like so:

bash math-text-transform <variant> <text>

Text can also be supplied through the standard input.

Examples

bash $ math-text-transform -bf-it Bold-Italic 𝑩𝒐𝒍𝒅-𝑰𝒕𝒂𝒍𝒊𝒄 $ echo "Double struck" | math-text-transform --double-struck đ”ģ𝕠đ•Ļ𝕓𝕝𝕖 𝕤đ•Ĩđ•Ŗđ•Ļ𝕔𝕜