Firefox PHP

Module: LatexRender Phorum Mod

Posted by jswright 
All files from this thread

File Name File Size   Posted by Date  
latexrender_example.png 50.1 KB open | download jswright 12/21/2008 Read message
latexrender.tar.gz 54.3 KB open | download jswright 12/21/2008 Read message
Module: LatexRender Phorum Mod
December 21, 2008 10:09PM
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 [tex] and [/tex] 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 hook (latexrender.php)
+ 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):
+ added l.4-7 to info.txt
-/+ 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 [tex] and [/tex] 
tags, and you should be good to go. 



Attachments:
open | download - latexrender.tar.gz (54.3 KB)
Re: Module: LatexRender Phorum Mod
December 25, 2008 01:42PM
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
my blog linkedin profile secret sauce
Re: Module: LatexRender Phorum Mod
October 26, 2009 01:46PM
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
Quote
michelkogan
NOTE THAT MY MODULE WORKS BETTER :D

Noted! So, where is it? ;-)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: LatexRender Phorum Mod
April 21, 2012 03:19PM
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

Fatal error: Class 'LatexRender' not found in /home/kwartz/www/phorum/mods/latexrender/latex.php on line 53

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
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
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.

Click here to login