Topic: punLaTeX v1.0

##
##
##        Mod title:  punLaTeX
##
##      Mod version:  1.0
##   Works on PunBB:  1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5
##     Release date:  2004-10-12
##           Author:  Chris Moore (chris@ilovephysics.com)
##
##      Description:  Adds support for the LaTeX math mark-up language,
##              allowing equations to be posted in forums.
##
##   Affected files:  include/parser.php
##
##       Affects DB:  No
##
##            Notes:  This mod uses a LaTeX engine called mimeTeX. MimeTeX
##              parses a LaTeX math expression and emits the
##              corresponding gif image on-the-fly. It is a separate
##              program that doesn't use TeX or its fonts in any way.
##              It's just one cgi that you put in your site's cgi-bin
##              directory. This means that it can be used on servers that
##              do not have LaTeX installed, such as most free and paid
##              hosting.
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

This is a really simple to install MOD designed for forums that need to display formulas. For an example of its uses and to test it before installing it, visit:

http://www.ilovephysics.com/forum/viewtopic.php?id=3

Click here to download.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: punLaTeX v1.0

Chris, could you take a look at the readme.txt file in the .zip file?  Looks like it isn't complete.

3 (edited by jchristophm 2004-10-12 05:13)

Re: punLaTeX v1.0

What's missing? Everything is there on this end.

UPDATE: I just downloaded it to make sure it was uploaded in the proper mode and it came out fine.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: punLaTeX v1.0

Here is the contents of the readme.txt, when I open it up:

##
##
##        Mod title:  punLaTeX
##
##      Mod version:  1.0
##   Works on PunBB:  1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5
##     Release date:  2004-10-12
##           Author:  Chris Moore (chris@ilovephysics.com)
##
##      Description:  Adds support for the LaTeX math mark-up language,
##              allowing equations to be posted in forums.
##
##   Affected files:  include/parser.php
##
##       Affects DB:  No
##
##            Notes:  This mod uses a LaTeX engine called mimeTeX. MimeTeX
##              parses a LaTeX math expression and emits the
##              corresponding gif image on-the-fly. It is a separate
##              program that doesn't use TeX or its fonts in any way.
##              It's just one cgi that you put in your site's cgi-bin
##              directory. This means that it can be used on servers that
##              do not have LaTeX installed, such as most free and paid
##              hosting.
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##


#
#---------[ 1. UPLOAD ]-------------------------------------------------------
#


The supplied mimetex.cgi file has been compiled for Linux servers and may not
work for other platforms. The original source can be found at the following
URL with other platform compiled versions: http://www.forkosh.com/mimetex.html

mimetex.cgi to yourdomain/cgi-bin/


#
#---------[ 4. OPEN ]---------------------------------------------------------
#


include/parser.php


#
#---------[ 5. FIND (lines: 200-216) ]---------------------------------------------
#


200    $pattern = array('#\[b\](.*?)\[/b\]#s',
201         '#\[i\](.*?)\[/i\]#s',
202         '#\[u\](.*?)\[/u\]#s',
203         '#\[url\](.*?)\[/url\]#e',
204         '#\[url=(.*?)\](.*?)\[/url\]#e',
205         '#\[email\](.*?)\[/email\]#',
206         '#\[email=(.*?)\](.*?)\[/email\]#',
207         '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s');
208
209    $replace = array('<strong>$1</strong>',
210         '<em>$1</em>',
211         '<u>$1</u>',
212         'truncate_url(\'$1\')',
213         'truncate_url(\'$1\', \'$2\')',
214         '<a href="mailto:$1">$1</a>',
215         '<a href="mailto:$1">$2</a>',
216         '<span style="color: $1">$2</span>');

Re: punLaTeX v1.0

I don't know why it's chopped off for you. I downloaded the zip and extracted it and here is what is in the readme file:

##
##
##        Mod title:  punLaTeX
##
##      Mod version:  1.0
##   Works on PunBB:  1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5
##     Release date:  2004-10-12
##           Author:  Chris Moore (chris@ilovephysics.com)
##
##      Description:  Adds support for the LaTeX math mark-up language,
##              allowing equations to be posted in forums.
##
##   Affected files:  include/parser.php
##
##       Affects DB:  No
##
##            Notes:  This mod uses a LaTeX engine called mimeTeX. MimeTeX
##              parses a LaTeX math expression and emits the
##              corresponding gif image on-the-fly. It is a separate
##              program that doesn't use TeX or its fonts in any way.
##              It's just one cgi that you put in your site's cgi-bin
##              directory. This means that it can be used on servers that
##              do not have LaTeX installed, such as most free and paid
##              hosting.
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##


#
#---------[ 1. UPLOAD ]-------------------------------------------------------
#


The supplied mimetex.cgi file has been compiled for Linux servers and may not
work for other platforms. The original source can be found at the following
URL with other platform compiled versions: http://www.forkosh.com/mimetex.html

mimetex.cgi to yourdomain/cgi-bin/


#
#---------[ 4. OPEN ]---------------------------------------------------------
#


include/parser.php


#
#---------[ 5. FIND (lines: 200-216) ]---------------------------------------------
#


200    $pattern = array('#\[b\](.*?)\[/b\]#s',
201         '#\[i\](.*?)\[/i\]#s',
202         '#\[u\](.*?)\[/u\]#s',
203         '#\[url\](.*?)\[/url\]#e',
204         '#\[url=(.*?)\](.*?)\[/url\]#e',
205         '#\[email\](.*?)\[/email\]#',
206         '#\[email=(.*?)\](.*?)\[/email\]#',
207         '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s');
208
209    $replace = array('<strong>$1</strong>',
210         '<em>$1</em>',
211         '<u>$1</u>',
212         'truncate_url(\'$1\')',
213         'truncate_url(\'$1\', \'$2\')',
214         '<a href="mailto:$1">$1</a>',
215         '<a href="mailto:$1">$2</a>',
216         '<span style="color: $1">$2</span>');

This section of code defines the various tags used in the forum. We are going
to add a new tag.


#
#---------[ 6. REPLACE WITH ]-------------------------------------------------
#


200    $pattern = array('#\[b\](.*?)\[/b\]#s',
201     '#\[i\](.*?)\[/i\]#s',
202     '#\[u\](.*?)\[/u\]#s',
203     '#\[url\](.*?)\[/url\]#e',
204     '#\[url=(.*?)\](.*?)\[/url\]#e',
205     '#\[email\](.*?)\[/email\]#',
206     '#\[email=(.*?)\](.*?)\[/email\]#',
207     '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s',
208     '#\[tex\](.*?)\[/tex\]#');
209
210    $replace = array('<strong>$1</strong>',
211     '<em>$1</em>',
212     '<u>$1</u>',
213     'truncate_url(\'$1\')',
214     'truncate_url(\'$1\', \'$2\')',
215     '<a href="mailto:$1">$1</a>',
216     '<a href="mailto:$1">$2</a>',
217     '<span style="color: $1">$2</span>',
218     '<img src="http://yourdmain/cgi-bin/mimetex.cgi?$1" border="0" 
        alt="LaTeX Image">');

We have now added a new tag: [tex] ... [/tex]. Everything between the [tex]
tags will be sent to mimetex.cgi and a gif image file of the corresponding
equation will be displayed. The new tag is added in line 208 and 218.

IMPORTANT: Make sure you replace "yourdomain" in line 218 with your actual
domain name.


#
#---------[ 12. SAVE/UPLOAD ]-------------------------------------------------
#

To learn more about mimeTeX and what you can do with it, visit:

http://www.forkosh.com/mimetex.html

For more information on the LaTeX math mark-up lnguage visit:

http://www.latex-project.org/

For questions about this MOD and integrating it into your site, visit:

http://www.ilovephysics.com/forum

This is what should be there.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: punLaTeX v1.0

There's something wrong with the linebreaks in the textfile. When I open it in Ultraedit, it displays it in the hexeditor (it does that when it notices the file contains binary characters). Might I ask what editor you used to create the readme?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: punLaTeX v1.0

TextEdit for Mac OSX. I may have saved it wrong. I'll go back tonight and save the readme.txt file as ASCII only, rezip, and reupload.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: punLaTeX v1.0

Download should be fixed now.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: punLaTeX v1.0

Nope, it still won't read properly in Windows (I've tried three different editors).

Edit: I've e-mailed you a version of readme.txt that works. I took the liberty of also fixing the tabs (they had been replaced by spaces), removing the line numbers and tidying up a bit in general. :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: punLaTeX v1.0

Thanks Rickard. The problem was obvious: you're using Windows. That's always a problem smile

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: punLaTeX v1.0

jchristophm wrote:

Thanks Rickard. The problem was obvious: you're using Windows. That's always a problem :)

Hehehe :)

Actually, I believe it's your editor that hasn't been updated to use MacOS X style linebreaks. In the old days, MacOS used to use only a CR (carriege return) to do linebreaks, but since the introduction of MacOS X, the proper way is to use a LN (line feed instead). The file you linked to had old MacOS style linebreaks mixed with DOS/Windows linebreaks (both CR and LF) and that's probably what confused our editors.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: punLaTeX v1.0

Strange. I use OS X Panther. I just edited the readme template in the developers kit, so that is probably how they got mixed up.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: punLaTeX v1.0

I replaced the readme.txt file with the corrected version Rickard sent me.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

14

Re: punLaTeX v1.0

can i use it on my windows server? i have followed the instructions but i get no image, only the alt= (LaTeX Image)...

do i have to do something with my server to enable cgi usage? (i use apache)

i also tried to download the windows compiled .exe-file from
http://www.forkosh.com/mimetex.html

but i dont know what to do with it afterwards..

please help smile

Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation - Oscar Wilde

Re: punLaTeX v1.0

I know nothing about Windows servers. But I do know you have to have Perl installed. Go here to get the latest version of Perl: http://www.perl.com/download.csp

The mimetex.cgi included in the archive is compiled for Linux -- it will not work on a Windows server. I assume the Windows compiled version you downloaded is just a self extracting zip file that contains a mimetex.cgi compiled for Windows. Run the exe and out should pop the cgi.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

16

Re: punLaTeX v1.0

i ran it.. wont pop.. smile

if you run the .exe in a command prompt you can display ascii versions of the images...

ill try downloading perl to see what happeneds...

Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation - Oscar Wilde

Re: punLaTeX v1.0

Hmmm. So at the DOS command line, if you type:

mimetex.exe y=\frac{1}{2}

out will pop an ASCII raster of y=1/2? That is what happens if you run mimtex.cgi at the command prompt in linux. So mimetex works. Now how to integrate it into the mod.

Did you try:

<img src="http://domain/path/mimetex.exe?=latex stuff">

I don't know how Windows parses the output of a windows executable in a browser, so we are in territory over my head. I might suggest contacting the author of mimetex. I believe he has a support forum listed somewhere on his site.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

18

Re: punLaTeX v1.0

tried that before.. i always experiment  big_smile

didnt work sad

can check the support forum.. too bad its so hard getting thios to work

Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation - Oscar Wilde

19 (edited by bobitt 2004-11-02 21:14)

Re: punLaTeX v1.0

WHOHOOO made it work.. i put
<img src="http://domain/path/mimetex.exe?$1" border="0" alt="LaTeX Image">

before i did not have perl installed.. smile

so everyone with windows:
download the exe from: http://www.forkosh.com/mimetex.html

replace the rows in parser.php with

    $replace = array('<strong>$1</strong>',
                     '<em>$1</em>',
                     '<u>$1</u>',
                     'truncate_url(\'$1\')',
                     'truncate_url(\'$1\', \'$2\')',
                     '<a href="mailto:$1">$1</a>',
                     '<a href="mailto:$1">$2</a>',
                     '<span style="color: $1">$2</span>',
                     '<img src="http://adress/cgi-bin/mimetex.exe?$1" border="0" alt="LaTeX Image">');
Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation - Oscar Wilde

Re: punLaTeX v1.0

Hooray! smile

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: punLaTeX v1.0

I just updated my site from 1.1.5 to 1.2.6!

The great news is that punLaTeX still works exactly the same with the newest version of punBB. I'm working on a simple WYSIWYG equation editor to include with a new version of punLaTeX.

Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com

Re: punLaTeX v1.0

Very nice mode.  Great work jchristophm

23

Re: punLaTeX v1.0

Look at this french contribution better than yours ....: Punbb with mimetex cache