News:

Join the Facebook Fan Page.

Main Menu

LATEX Parsing

Started by treo, June 18, 2004, 04:25:16 PM

Previous topic - Next topic

treo

hi,
I'd like to add this feat. to my forum,
I have root access to the server so there is no problem in installing it.
But how do I add the parsing best?

Oldiesmann

What exactly is LATEX? Can you give us a link for more info?
Michael Eshom
Christian Metal Fans

Orstio

#2
LaTeX is a math environment that makes pretty equations on the web:

http://crab.rutgers.edu/~karel/latex/class4/class4.html

It is an option in vBulletin.  It is used a lot at http://www.physicsforums.com .  If you go there and do a search for LaTeX you will see many examples.

There is a php LaTeX renderer for download here:

http://www.mayer.dial.pipex.com/tex.htm#latexrender

treo

#3
I've done that little modding :)

What you need is (debian packages ;) ):
tetex
tetex-extra
gs
imagemagick

and

http://www.mayer.dial.pipex.com/latexrender.zip

Rename otherPHP to latex, and edit latex.php.
Upload the latex folder to the Sources Folder and make chmod 777 tmp and chmod 777 pictures.
Try Out wether it works with the example.php. If it works delete example.php and do that change:

in Subs.php add after line 727:
include_once('Sources/latex/latex.php');
$message = latex_content($message);

Now you can use [tex][/tex] in your posts.
Additionally someone could create a button for it and add it to the template.

EDIT:
If you want to see it in action:
http://10e.ath.cx/index.php/topic,34.0

Anguz

nice :)

* Anguz wishes he could understand those formulas
Cristián Lávaque http://cristianlavaque.com

Jeff Lewis

Someone should throw that together into a MOD package ;)
Co-Founder of SMF

treo

tell me how and I'll do it myself ;)
And by now I have fund some things which have to be changed when modding because I first put it into the wrong line,
cause there are some bugs wenn using it over more than one line.
I'll have to repair it tomorow than I also will change that manual to build it in ;)

Oldiesmann

#7
Quote from: Anguz on June 29, 2004, 06:18:12 AM
nice :)

* Anguz wishes he could understand those formulas

I understand it perfectly (for the most part). I'll explain them for you (I won't go into too much detail on the third thing because it's pretty complicated)

\sqrt(number) displays the formula for the square root of the number
\frac {numerator} {denominator} displays the fraction with the specified numerator (top number) and denominator (bottom number)

not sure what \displaystyle is

The third thing is calculus related. Basically, that means that the area under the curve created by graphing that function (the big x4(1-x)4 over 1+x2 fraction thing) from x=0 to x=1 is approximately 22/7 - pi. It's called an integral. If I tried to explain it to you, I'd probably end up confusing you even more, so I won't even try.
Michael Eshom
Christian Metal Fans

Anguz

#8
thank you for taking your time to tell me Oldiesmann

and happy birthday! (^_^)

Quote from: treo on June 29, 2004, 05:00:42 PM
tell me how and I'll do it myself ;)
And by now I have fund some things which have to be changed when modding because I first put it into the wrong line,
cause there are some bugs wenn using it over more than one line.
I'll have to repair it tomorow than I also will change that manual to build it in ;)

cool... get it to work as well as possible before releasing it and then you can get an existing package and see how it's done, a good one for that is [Unknown]'s named Say Something! he wrote it with the purpose of showing how it's done iirc
Cristián Lávaque http://cristianlavaque.com

Orstio

For those who do not have tetex, or as in my case, are on a server where the host has disabled exec(), you can also use the mimetex version available in the download link that Treo provided.

You'll need the precompiled mimetex.cgi binary, which is not easy to come by, but I did find one, so I've provided a Linux version: DOWNLOAD LINK

If you need another version, go here:

http://moodle.org/download/mimetex/

right-click on the file that you need, and save as mimetex.cgi .

Upload this file to your cgi-bin and CHMOD to 755.

Just like Treo's version:

Upload the mimetex folder inside your Sources folder.  CHMOD the pictures folder to 777.

Edit mimetex.php to your server settings.

Try example.php .  If it works, do the mod:

in Subs.php, after line 728 add:

include_once('Sources/mimetex/mimetex.php');
$message = mimetex($message);

You can see it in action here:

LINK



Anguz

great! thanks for your help

I downloaded the one you provided with this link
http://www.everything-science.com/mimetex.zip
and added it as an attachment to this post

* Anguz remembers the YaBB SE mod threads with broken links (^^;)
Cristián Lávaque http://cristianlavaque.com

Orstio

Quote* Anguz remembers the YaBB SE mod threads with broken links (^^;)

Thanks for attaching the file here;  I would have, but I'm not able to post attachments.  I also remember the broken links at YaBB SE, and also at the YaBB Mod forums.

stevem

Quote from: treo on June 27, 2004, 09:54:32 AM
I've done that little modding :)
...
If you want to see it in action:
http://10e.ath.cx/index.php/topic,34.0 [nofollow]

Just come across your post. Would you mind if I put a link to http://10e.ath.cx/index.php [nofollow] on the LatexRender [nofollow] page, plus put a copy of your modding instructions in the download (with attribution of course), so that others can benefit from it?

Steve Mayer

stevem

Quote from: Orstio on July 01, 2004, 09:07:24 PM
For those who do not have tetex, or as in my case, are on a server where the host has disabled exec(), you can also use the mimetex version available in the download link that Treo provided.
...
You can see it in action here:

LINK [nofollow]

Same request  :) to put a copy of your instructions in LatexRender download plus a link to the forum.

Thanks

Orstio

I have no problem with anyone using the instructions to get mimetex working with SMF, and links are always appreciated. ;)

I guess we should also extend a thank you for the download package. :D

treo

stevem:
Soon I will make an Mod Demo Board where all my mods are in it,
10e.ath.cx is going down, because the class doesen't exist any more

stevem

Let me know when you are ready and if you want a link. Meanwhile can I use your instructions or would you prefer I wait until the demo board is ready?

treo

#17
http://demoboard.hostspace.ath.cx/index.php?topic=2.0
Here is a slighty better description for installing it:


What you need is (debian packages):
tetex
tetex-extra
gs
imagemagick

and

http://www.mayer.dial.pipex.com/latexrender.zip

Safe Mode must be off

From the latexrenderer.zip take only the otherPHP/latexrenderer folder,
edit the latex.php in it so it fits your environment
Rename the latexrenderer folder to latex and put it into your Sources folder.

chmod 777 latex
chmod 777 latex/pictures
chmod 777 latex/tmp

try out wether it works with the example.php (open http://www.example.com/board/Sources/example.php), if it works delete example.php

In Subs.php:
Search for( should be at line 726):                 }
        }
        $message = substr(implode('', $parts), 1);

        // Fix things.
        $message = str_replace(
                array('{<{', '}>}', '  ', "\r", "\n"),

and replace it with:
                }
        }
        $message = substr(implode('', $parts), 1);
        include_once('Sources/latex/latex.php');
        $message = latex_content($message);
        // Fix things.
        $message = str_replace(
                array('{<{', '}>}', '  ', "\r", "\n"),


Now you can use [tex][/tex] in your Board.

stevem

#18
Thanks. I will put your instructions in the latexrender download plus the link to the demo board.

It shouldn't be necessary to chmod the latex folder, since the program only writes to pictures and tmp (unless you've discovered otherwise?).

ccheaton

How can I determine, through cPanel, if I have these installed?
tetex
tetex-extra
gs
imagemagick

Advertisement: