Creating images for formulas in Java

I would like to generate an image file showing some kind of mathematical expression, taking a string like "(x + a) ^ n = Σ_ (k = 0) ^ n" as input and getting more image file as output. For example, AFAIK material is used on Wikipedia. Is there any java libraries that can do this?

Or maybe I'm using the wrong approach. What would you do if you wanted to include the insertion of formulas from MS Word into an HTML document? I would ask the user to just take a screenshot myself, but that would be a lazy way ^^

Edit: Thanks for the answers so far, but I really don't control the input. What I get is some messy Word-style formula, not pure latex formatting.

Edit2: http://www.panschk.de/text.tex Looks a bit like LaTeX, right? What I get when I do this is clipboard.getContents(RTFTransfer.getInstance()) after pasting the formula from Word07.

+4
source share
4 answers

My colleague found a surprisingly simple solution to this very specific problem: when copying formulas from Word2007, they are also stored as “HTML” in the clipboard. Because submitting formulas in HTML is also not easy, Word simply creates a temporary image file on the fly and inserts it into the HTML code. Then you can simply take a temporary image of the formula and copy it to another location. The problem is solved;)

+1
source

First of all, you should familiarize yourself with TeX (and LaTeX ) - a well-known dialing system created by Donald Knuth. A set of mathematical formulas is an advanced topic with many opinions and great attention to detail - so use something that is based on TeX . Thus, you are sure that everything is correct :-)

Edit: Take a look at texvc

It can be displayed in PNG, HTML, MathML. Check out README

Edit # 2 Convert this mess of Word material to TeX or MathML?

+6
source

What you are looking for is Latex .

MikTex is a small application for retrieving images using LaTeX.

I would like to study them on the fly, though ...

0
source

Get away from LaTeX. Really.

Check out JEuclid . It can convert MathML expressions to images.

0
source

All Articles