@Mike: I couldn't find precise info about the cadabra TeX input, but I found odd things: "x^{2x+1}" is interpreted as "x^{2+x+1}". I may be misunderstanding something, though.
@Dan: I just had to add the rule ")(" => ")*(" that I had forgotten yesterday, and here is what I get: (((x-1)*(x**(4)*(1-y)-(x-1))+sqrt((x-1)*(x-1+x**(4)*(y-1))*(-x**(4)*(x-1)*(1- y)-(3*x-1)*(x+1))))/(2*x**(2)*(x-1+x**(4)*(y-1)))) And it wasn't too difficult to add some code to keep track of which variables appear in the expression, giving var("x,y"). I still need to polish and comment the code, but it shouldn't take too long. Do you have harder cases? What is the correct expression (if any) in Sage for the following? \sum_{1 < k < n} k \sum_{\substack{1 < j < n \\ 1 < k < m}} j^k \sum_{k=0}^{\infty} \frac{x^k}{k!} > We might also talk with the jsmath/mathjax developer, Davide Cervone. > IIRC, he already converts from latex to MathML, so there is some sort of > tex processing that he is doing in javascript. We've talked with him > about a way to convert from latex/mathjax back to Sage code before. For general TeX code, containing user-defined macros etc, the only way I think is to use TeX to expand macros (my parser currently does that when encountering an unknown control sequence). For code generated by Sage, it is probably easier. > For your application, I wonder if it would be easy to somehow encode > annotations in the latex output, so that you could delimit > subexpressions with the code that originally created them. If we output > mathml instead of latex for mathjax, I suppose that encoding such > annotations would be easier. Especially if it was Content MathML > instead of just Presentation MathML. To be frank, I only know TeX inside out, so I would naturally choose TeX, but the main question is whether jsmath/mathjax have some kind of "reverse search" feature (going from the display to the LaTeX). Should we contact David Cervone on this? --- I wasn't planning to look into this so soon. Regards, Bruno -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org