# Module: LatexRender Phorum Mod

Posted by jswright

File Name File Size   Posted by Date
 Module: LatexRender Phorum Mod December 21, 2008 10:09PM Registered: 13 years ago Posts: 3
This module allows users to include Latex code in Phorum posts. It converts fragments of Latex code into images that are displayed inline by hooking into the LatexRender php script (originally written by Benjamin Zeiss and maintained by Steve Mayer). Example screenshot below.

The user types the Latex code in between $$and$$ bbcode tags. This code fragment is then converted into dvi, then postscript, then either png or gif. LatexRender requires Latex, Ghostscript, and ImageMagick. I have had better luck converting to png than gif, which sometimes comes out barely legible. If you want to convert to gif instead just alter line 47 of class.latexrender.php accordingly. You can enable additional fonts and symbols by adding the appropriate package at line 180 of class.latexrender.php.

I have only used this with Phorum 5.1.23, but I was directed to post it here so maybe Joe Curia checked it on 5.2 as well?

LatexRender is available at [www.mayer.dial.pipex.com]

This version has been modified from the original as follows:

05.08.2008
+ added Phorum module file (info.txt)
-/+ replaced l.73 in latex.php (BBCode [img] instead of HTML <img> tags)
12.21.2008
standardization (credit to Joe Curia):
-/+ generalized l.30 in latexrender.php

To use it, unpack and put it in your /'phorum_path'/mods/ directory, go to
the Modules page in Phorum Admin, and turn the module on. Make sure both
the latexrender/pictures and latexrender/tmp directories are publicly
writable. Place any LaTeX symbols or formulas within the $$and$$
tags, and you should be good to go.


 Re: Module: LatexRender Phorum Mod December 25, 2008 01:42PM Admin Registered: 16 years ago Posts: 8,532
Thanks for bringing back my nightmares (me and Tex have given up being friends long ago ;-)
Also thanks for this contribution to the Phorum community.
I know a few people that still like Tex, who will certainly enjoy this mod.

Maurice Makaay
Phorum Development Team
 Re: Module: LatexRender Phorum Mod October 26, 2009 01:46PM Registered: 11 years ago Posts: 1
Belive me or not ... I wrote a module last week did the same job ( works with LaTeX equation editor for the internet ) :( ... WHY I DIDN'T CAME HERE LAST WEEK ??? NOTE THAT MY MODULE WORKS BETTER :D

anyway good job ... thanks.
 Re: Module: LatexRender Phorum Mod October 26, 2009 01:50PM Admin Registered: 16 years ago Posts: 8,532
Quote
michelkogan
NOTE THAT MY MODULE WORKS BETTER :D

Noted! So, where is it? ;-)

Maurice Makaay
Phorum Development Team
 Re: Module: LatexRender Phorum Mod April 21, 2012 03:19PM Registered: 10 years ago Posts: 9
Hi,

Has anyone got success installing this extension on Phorum 5.2 ?

The readme file says it works with 5.1.23 but with 5.2.18, I get the following error on starting a new thread :
Quote

Warning: include_once(/scratch/collaborate/forum/mods/latexrender/class.latexrender.php) [function.include-once]: failed to open stream: No such file or directory in /home/kwartz/www/phorum/mods/latexrender/latex.php on line 48

Warning: include_once() [function.include]: Failed opening '/scratch/collaborate/forum/mods/latexrender/class.latexrender.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/kwartz/www/phorum/mods/latexrender/latex.php on line 48

I'm taking any solution to insert LaTeX syntax in phorum, either with another module, or with some advices on how to convert a 5.1 module into a 5.2 one.

Thanks.
 Re: Module: LatexRender Phorum Mod April 21, 2012 05:56PM Registered: 9 years ago Posts: 50
You need to modify some of the code in latex.php to take into account the directory structure on your server.

Language: PHP    // adjust this to match your system configuration
$latexrender_path = "/scratch/collaborate/forum/mods/latexrender";$latexrender_path_http = "http://stratus.appmath.columbia.edu/jswright/forum/mods/latexrender";

\$latexrender_path ="/home/kwartz/www/phorum/mods/latexrender";
 Re: Module: LatexRender Phorum Mod April 22, 2012 12:37PM Registered: 10 years ago Posts: 9
Hi,

Thank you very much for your answer. I should have look closely to the error message. Still, these necessary modifications could be pointed out in the readme file ?

Anyway, I now get these errors :
Quote

Warning: unlink(/home/kwartz/www/phorum/mods/latexrender//tmp/592be850470702b07ee1d83abbedfcfd.aux) [function.unlink]: No such file or directory in /home/kwartz/www/phorum/mods/latexrender/class.latexrender.php on line 289

Warning: unlink(/home/kwartz/www/phorum/mods/latexrender//tmp/592be850470702b07ee1d83abbedfcfd.log) [function.unlink]: No such file or directory in /home/kwartz/www/phorum/mods/latexrender/class.latexrender.php on line 290

Warning: unlink(/home/kwartz/www/phorum/mods/latexrender//tmp/592be850470702b07ee1d83abbedfcfd.dvi) [function.unlink]: No such file or directory in /home/kwartz/www/phorum/mods/latexrender/class.latexrender.php on line 291

Warning: unlink(/home/kwartz/www/phorum/mods/latexrender//tmp/592be850470702b07ee1d83abbedfcfd.ps) [function.unlink]: No such file or directory in /home/kwartz/www/phorum/mods/latexrender/class.latexrender.php on line 292

Warning: unlink(/home/kwartz/www/phorum/mods/latexrender//tmp/592be850470702b07ee1d83abbedfcfd.png) [function.unlink]: No such file or directory in /home/kwartz/www/phorum/mods/latexrender/class.latexrender.php on line 293

I guess that the hosting server (running debian sarge) does not have LaTeX packages installed. Unfortunately I don't have root access on this server, so there is not much I can do now.

Other solutions would be, either to install the necessary LaTeX packages in the user directory (could that work ?), or to use an external server where I have sufficient rights to install LaTeX packages on. Indeed, I already have such a server for a website running a french cms called spip in which the formulas generation can be externalised (for instance http://math.spip.org/tex.php?x%3D\frac{1-t^2}{1%2Bt^2}

Thanks.
Sorry, only registered users may post in this forum.