Creating images of an Equation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DD32
Forum Newbie
Posts: 7
Joined: Thu Sep 16, 2004 9:26 pm

Creating images of an Equation

Post by DD32 »

i'm in need of being able to generate iamges of mathematical/chemical equations... something like the quadratic formula of x=-b+\-SQRT(b^2-4ac)/2a

however i need it more in the format that would be displayed in MS eqation editor.. or OpenOfices equation editor... i could do it manually, but i'd like to automate the task...(it's for a web-based PHP script)..

I've looked around and can't find anything pre-written, on phpclasess or any others...
so i' might end up writing it myself using the GD library...
BUT does anyone know of some pre-written stuff.. or a way to approach such a task?

I'll post this now.. but it's not going to be about 2days before i am near a computer to start it at all.. so if anyone can help me out with anything, it'd be appreciated.

-=DD32=-
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

look into LaTeX
DD32
Forum Newbie
Posts: 7
Joined: Thu Sep 16, 2004 9:26 pm

Post by DD32 »

feyd wrote:look into LaTeX
ok i'll do that now.
Slacker
Forum Newbie
Posts: 17
Joined: Thu Aug 12, 2004 9:19 pm

Post by Slacker »

what picture formats do they read?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

LaTeX? nothing, it's a document language that can render complex math equations...
DD32
Forum Newbie
Posts: 7
Joined: Thu Sep 16, 2004 9:26 pm

Post by DD32 »

feyd wrote:LaTeX? nothing, it's a document language that can render complex math equations...
.

Seems useable... now.. just to work out how to use it.

Thanks!

-=DD32=-
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

DD32
Forum Newbie
Posts: 7
Joined: Thu Sep 16, 2004 9:26 pm

Post by DD32 »

Hmm.. nice try, unfortunatly thats not what i'm after at all.. first of all it doens't work in my browser, or the most common browsers, and second of all.. it requires a plugin to be installed anyway...

no offence mean't sorry.
I've found a simmilar thing like this, in teh form of a java applet that accepts LaTeX style equations.(http://www.esr.ruhr-uni-bochum.de/VCLab ... otEqn.html

I've also found a Perl script to convert LaTeX equations into Bitmap/PNG/Jpeg images(http://www.nought.de/tex2im.php)

And on top of that.. a PHP script that can directly call LaTeX and display teh result in PNG/Gif(somewhere in http://www.tug.org/tex-archive/support/ ... nder/demo/)

Allthough it's not completely PHP Based as i would prefer, it might have to do in teh long run, on and btw, when i say i don't prefer this option, i mean i'd strongly not have to rely on LaTeX to be installed... but i've looked around and couldn't work anything out..(other than doing a GD image myself.... as this isn't going to be placed on a custom-compiled and specific built server unfortunatly.. just the general run-off-the-mill webserver.. o i doubt i'll be able to use LaTeX on it.

Anyway, any more ideas are welcomes as usual.

-=DD32=-
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

most likely, the whole thing in a script, instead of an extension would run slow.
DD32
Forum Newbie
Posts: 7
Joined: Thu Sep 16, 2004 9:26 pm

Post by DD32 »

feyd wrote:most likely, the whole thing in a script, instead of an extension would run slow.
Sorry that doens't come accross very well with my logic...;
by script, and extension.. what refers to what? script = PHP|External language;
or something slightly different?

BUT i personally would expect an external script to be slower than it being done internally... mainly becasue it dones't have to load more off teh harddrove and instead has more processing to deal with..

-=DD32=-
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

script = php file.

the speed difference between an inline LaTeX rendering script and a compiled binary renderer can be huge.. but that's heavily dependant on how optimized the code is in each..
DD32
Forum Newbie
Posts: 7
Joined: Thu Sep 16, 2004 9:26 pm

Post by DD32 »

ah ok thanks...
well eitherway, thanks for the help, and i'll check back in a few days.

-=DD32=-
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

on freshmeat i saw this today :

http://redsymbol.com/software/l2p/
DD32
Forum Newbie
Posts: 7
Joined: Thu Sep 16, 2004 9:26 pm

Post by DD32 »

Thanks i'l add it to the list of programs i'll try...
Post Reply