adrianromero adrianromero - 1 month ago 27
Java Question

Parsing latex with jlatexmath

I am using https://github.com/opencollab/jlatexmath to parse latex math formulas in java. When trying to parse a simple complex number:

TeXFormula tex = new TeXFormula("32 + 45~i");


I get the following exception:

org.scilab.forge.jlatexmath.ParseException: Unknown character : '~' (or 126)


The character '~' is supposed to be an unbreakable space as explained in this documentation. https://en.wikibooks.org/wiki/LaTeX/FAQ#Non-breaking_spaces

The reason of using '~' is because I want to render the latex formula returned by a different library: mathjs.org and it includes the '~' character in some formulas.

Does jlatexmath support '~' or do I have to use a different spacing command?

Answer

The ~ is now allowed in JLaTeXMath: https://github.com/opencollab/jlatexmath/commit/27ffa7082efa75e6f86e8788f5cbe2156aa15f5c

Feel free to report bugs.