Re: Converting a string formula to TeX



humberto.bortolo...@xxxxxxxxx wrote:

I would like to know if there is a java library (free or not) that
converts a string formula to TeX code. For instance, "(a + b)/2" is
converted to "\frac{a + b}{2}".

One route could be to parse the string into MathML, or some
other tree structure, and then generate the TeX from that.

Something that's is pretty far out there, but which might be helpful
if you end up writing your own code & you need some inspiration,
is the TeX output system of the symbolic computation program,
Maxima. Input strings are parsed into Lisp S-expressions
(comparable to MathML representation) and then TeX is generated
by walking the parsed expression and generating TeX output for
each bit according to properties assigned to each atom.

If you find that someone has invented a TeX output
system for Java, I'd be interested to hear about it.

FWIW

Robert Dodier
.



Relevant Pages

  • Re: string compare
    ... spaces by a catcode other space character. ... character of the string can be grabbed as an undelimited argument. ... A pure TeX or LaTeX solution will be appreciated. ...
    (comp.text.tex)
  • Re: selecting a part of a string
    ... variable (scalar $tex?) then ... The pattern does not do what the OP asked for. ... entire string whereas by a strict interpretation of the OPs requirement ...
    (perl.beginners)
  • Re: how to output ~
    ... in a virtual internet address? ... correct because the generated string is not a valid ... (The backslash is for quoting it to TeX.) ... "Lassen Sie Ihr Herz nicht zum Ersatzteillager werden!" ...
    (comp.text.tex)
  • Joining words broken across lines in TeX input
    ... (namely the Maxima algebra system) ... When printing a long text string, Maxima breaks the line into pieces ... Is there some way to tell TeX to ... put broken words back together? ...
    (comp.text.tex)
  • Re: using forloop to insert logos/images possible?
    ... string. ... Strange. ... You could try the \@for-command of LaTeX: ... Wasn't aware that TeX ...
    (comp.text.tex)