I’d like to generate an image file showing some mathematical expression, taking a String like ‘(x+a)^n=∑_(k=0)^n’ as input and getting a more (human) readable image file as output. AFAIK stuff like that is used in Wikipedia for example. Are there maybe any java libraries that do that?
Or maybe I use the wrong approach. What would you do if the requirement was to enable pasting of formulas from MS Word into an HTML-document? I’d ask the user to just make a screenshot himself, but that would be the lazy way^^
Edit: Thanks for the answers so far, but I really do not control the input. What I get is some messy Word-style formula, not clean latex-formatted one.
Edit2: http://www.panschk.de/text.tex Looks a bit like LaTeX doesn’t it? That’s what I get when I do clipboard.getContents(RTFTransfer.getInstance()) after having pasted a formula from Word07.
My colleague found a surprisingly simple solution for this very specific problem: When you copy formulas from Word2007, they are also stored as ‘HTML’ in the Clipboard. As representing formulas in HTML isn’t easy neither, Word just creates a temporary image file on the fly and embeds it into the HTML-code. You can then simply take the temporary formula-image and copy it somewhere else. Problem solved;)