views:

397

answers:

4

Hi Guys,

I want to preview TeX formulas in my User Interface. After a long time searching, it seems to me that there is no other possibility than

  • write the formula into a .tex file
  • call tex with system() and write a dvi file
  • call e.g. dvipng with system() and write a png file
  • load this file into the GUI
  • clean up(erase all these files).

I think that the performance of this way doing it is not a problem, since there are only formulas to render and not whole documents. But setting up the environment automatically for the TeX system seems to be a bigger problem. So, is there a possibility to include TeX as an API in my program? Thanks a lot!

+2  A: 

Couldn't you encapsulate those steps in a single shell script (i.e. which takes the formula and png filename as arguments)? The script could then also handle setting up the environment for TeX. Your program just calls the script with the system() call.

jon hanson
A: 

LyX is a TeX based Document Processor. As the application is open source you can inspect the C++ code to see how they deal with the problem you described.

lothar
A: 

I'm not sure, but think MathType's Component will overkill.

Also have a look at sideshare and see flash video to get more information about sitmo, mathMagig, Edoboard and their API tools.

good lucks.

Sorush Rabiee
+2  A: 

There's a C API for TeX called MimeTeX but the resulting image is... not a nice as it could be.

If you're OK with Java, there's JLatexMath

And if you'd like a WPF version, one is under development at WPFMath

Scott Weinstein