texToUnicode function

String texToUnicode(
  1. String tex
)

A readable plain-text version of simple TeX, for when no math renderer is plugged in: \alpha becomes α, x^2 x² and \frac{a}{b} a/b.

Implementation

String texToUnicode(String tex) => _TexReader(tex)
    .read(null)
    .replaceAll(RegExp(r'[ \t]{2,}'), ' ')
    .replaceAll(RegExp(r' *\n *'), '\n')
    .trim();