For our educational site we needed a way to enter relatively complex math
formulas. I wrote a filter which converts LaTeX (http://www.latex-project.org/)
formulas into images. Tested on Drupal 4.5.1 and 4.6.0

latexrender.tgz

My php knowledge is too limited to convert this module to drupal standards
so you will have to edit some files manually to reflect your installation directories
(see INSTALL file).

Module is based on LatexRender for PHP by Steve Mayer
http://www.mayer.dial.pipex.com/tex.htm#latexrender
http://www.mayer.dial.pipex.com/latexrender/latexrender.htm

Thanks,
Gintaras

Comments

ezheidtmann’s picture

I haven't tested this, but it looks awesome! I've wanted this for a while!

Please put this on drupal.org as a project so we can submit patches and so it doesn't get lost in the forum.

QV’s picture

As I understand it, every submitted code should comply to the coding standards. Sorry, but I am not a coder and learning php is not in my current wish-list. I simply don't have time to do it.
It would be great if someone who has more expierence could finish and maintain this module. It is under GPL.

This functionality could be very useful in educational Drupal sites (see phpBB example).

G.

kuba.zygmunt’s picture

I like this filter, perhaps thanks to my mother, who used to write in Tex :P
I'll look into this code in my free time, but now I'm focusing on SoC so I don't know when I'll have free time :)

- I wonder how am I perceived when passion enters me :-) -

healthyJessica’s picture

I tested it and it's excellent. I searched around whole net and I finally found exactly what I need.

crac’s picture

great one, two thumbs up ;)

axel’s picture

It's really interesting thing. I updated my old latex module from 4.3 to 4.6. This module converts simple set of TeX commands to HTML, but without formulas. I'll try to merge it with latexrender.

--
Axel,
JabberID: laika@jabber.org
Drupal in Russia | Darcs repo of my projects

Ray Fix’s picture

Hello, I am a Drupal newbie (< 1 week) but the availability of this module is the one that really sealed the deal for me.

After installing it and fussing around sometime, it is working great for me.
I decided to improve it a little. Here is what I did:

  • The script depended on ImageMagick to go from tex -> dvi -> postscript -> png. Instead, I use the now standard latex tool dvipng to bypass the entire postscript step. This is probably faster, and, has the advantage that dvipng can do true transparents. (To put credit where it is do, I got this idea from a post I saw on MediaWiki which I can't now, for the life of me, find.)
  • There were paths sprinkled through all three of the files that made the installation process a bit fragile. I consolidated everything into a single config.php file.
  • Image sizes were being checked with an external program. I got rid of this program and used the PHP native function getimagesize.

If I were really good, I would make the setup variables all appear on the Drupal control panel. But I am not there yet. So for now this is what I have. You can get my "tweaked" version here: http://nul.tzo.com/public/latexrender.tar.gz

If you have any feedback, let me know.

Ray

PS: it is working on my 4.7 install

intu.cz’s picture

Hello, I was just wandering if the link realy contains the "tweaked" version. I'd love to try it but the install instructions and the files still look as if the dvi > ps > png process is there instead of the dvipng shortcut... Thanks for any info.

Roman

dan90’s picture

I was wondering if you had had any chats with the DruTeX crew about incorporating your work into theirs..?

dwees’s picture

As far as I remember, Drutex uses a similar process for LateXRendering.

In fact, I've written a similar module using code from the MediaWiki site to make a LaTeXRender ages ago, and found the information about bypassing the LONG way of converting the images as well. Unfortunately my shared host wouldn't allow me to install LaTeX, and so I abandoned my code.

If you are in a situation where you do not have LaTeX on your server, check out the Mathfilter module alternative.

Dave