SoC 2006: DruTeX

This group should probably have more organizers. See documentation on this recommendation.

This group is dedicated to the development of DruTeX, a powerfull LaTeX module for Drupal.

Features include:

  • rendering of maths or arbitrary TeX via latex + ImageMagic / dvipng
  • support of classical LaTeX-math environments like $x^2$, \[ x^2 \]
  • some plain latex2html and html2latex facilities (no external program needed)
  • pdf generation of nodes (with LaTeX)
  • highly-configurable input formats
  • security-enhanced modes (to allow even anonymous users to write latex)
  • Drupal / LaTeX UTF-8 (utf8) support

Features in development (partly done):

  • latex math 2 MathML via some external application, e.g. blahtex
  • support to render gnuplot, eukleides, chemestry and so on
  • using mimetex instead of latex to render images

CVS repository, CVS messages

Project page, Issues, Documentation

rezaervani's picture

Notice: Use of undefined constant filter - assumed 'filter' in preg_replace() (.../modules/drutex/drutex.module(363) : regexp code).

Dear All,
I try to use DruTex for the first time here : - It is able to render my TeX code, but I still got error on my frontpage that is looked like this :

Notice: Use of undefined constant filter - assumed 'filter' in preg_replace() (line 1 of /home/rezaerv/public_html/modules/drutex/drutex.module(363) : regexp code).
Notice: Trying to get property of non-object in drutex_linebreak_node2html_postprocess() (line 49 of /home/rezaerv/public_html/modules/drutex/

What should I do ?

Thank You,

Reza Ervani

Read more
Daimon's picture

Image conversion

I have just successfully installed Drutex on a shared server. As it turned out, for whatever reason my host does not support dvipng, but they do support ImageMagick. However, the convert binary does not accept a dvi input, and so a third program is required to run after latex and before convert. Luckily the binary dvips is included with the texlive package my host installed, making this not a very big hurdle. After creating the custom commands for Drutex the latex finally rendered correctly.

Read more
Rubio's picture

How to use CCK custom fields on DruTeX


I just installed TeXlive and DruTeX on a VPS and they're working fine.

I even tweaked the DruTeX template to get the layout I need, but I can't figure out how to render to LaTeX custom fields created by CCK.

I need to render some text input by the user along with some headers and titles hardcoded in the template, son I need at least 15 fields to be filled by the user and render by DruTeX.

I don't know enough Drupal or PHP to fully understand the code, but I found some clues in the -- -- file, but I don't know how to tell drutex which CCK field to use.

Read more
Steven Jones's picture

Next Version

Ideas for the next version of DruTeX at:

Read more
bobca's picture

Math server

I'm relatively new to Drupal which I installed with ease. Now I'm trying to render mathematics within my pages, so I installed DruteX. My server can't handle latex requests since I can't install software onto it (except all kind of php of course).
I can access a math server, which transforms gracefully math formulae into images, e.g.\int_0^1x^2dx
gives the expected result (a PNG image, of course).

How can I use that remote server ?

Read more
markfoodyburton's picture


I've just integrated tth into a filter, simply because somebody wanted to throw a load of latex onto my site.
It worked - it took 1/2 an hour to do.

I dont think it's exactly tryng to solve the same problem as drutex, I'm not sure, but it seems remarkably close, and would probably work for most people?

tth can be found here:

I'm not especially fixated on it, I'd appreciate hearing other peoples opinions.

If anybody wants the module, it's fairly trivial, I could check it in if it helps....

Read more
franqui's picture

Issues on the PDF and TeX generation

I found two disturbing issues when creating a PDF or a Tex file from a node.

First, the PDF is not updated, once it is created the first time. The reason is this test located in the drutex_node2pdf_wrapper function:

  if (!is_file("$pdf_dir/{$node->nid}.pdf")) {

I just commented the test in my site. PDF should be generated each time it is requested, as node might have been updated in the meanwhile.

Read more
franqui's picture

PDF Generation error

Hi folks:

I've been playing around with the module, and I found an error when converting html tags to latex commands (more precisely, when converting the tag <em> to the \emph{} command).

For some reason I got a "\" before the opening curly bracket, so the command - \emph{ whatever } - was not properly recongized.

Read more
markfoodyburton's picture


Hi, just posted a tiny module which "works for me" - it's not pretty and its not cleaver, but it might be helpful to others who use latex. It simply allows you to put some latex code, with embedded php code within it, onto a content type - and then gives you the ability to download the resulting PDF. The module itself is the trivial part - getting your php code and latex to work just the way you want it - thats the real problem. I'd guess most people would hack the module about a bit too... Anyway, it maybe helpful to some people.

Read more
dagray07's picture

Drutex 5.0

Hey everyone -

I just got my own local copy of drutex working for drupal 5.0 (I still need to get an install of latex for my server; its a hosted server - I'm looking into server farms, but haven't been able to find anything reasonable yet)

I just installed drupal for the first time, so this was sort of a get oriented with the system project. I expected it to take a long time.... it took 5 minutes! (granted, I still have to install latex on my server - but it appears drutex is working fine)

Read more
grover1729's picture

<equations> vs. \begin{eqnarray}

A friend and I are starting a Drupal for mathematicians (who know LaTeX, but little else). Anyway, I am wondering if there is a good reason why Drutex uses <equations>...</equations> instead of just supporting the \begin{eqnarray}...\end{eqnarray} environment from LaTeX. At least for my target audience, the latter would be preferable. Thanks in advance for any comments/advice.


Read more
DFG's picture


D r u T e X

1. Installation
2. Configuration
3. Usage
4. Additional modules
5. Developer notes
6. Author
Read more
DFG's picture

Installation Instructions

1) Download the DruTeX module from the Drupal website and unpack it to the modules directory. You now have a directory modules/drutex.

2) Go to the module admin section and enable "drutex".

3) Go to the input-filters admin section and create a new input format. You can choose an arbitrary name, but "DruTeX" would make sense. When you create a new format, you can select an input filter from a list: Just choose DruTeX.

4) Go again to the input-filters admin section, and select "configure" for the newly added input format. Click on the "configure" tab, and you are able to adjust many settings of DruTeX.

Read more
marknewlyn's picture

Drupal key to our non-profit progress

Hi Everyone

Keeping this short is tough (and off to a bad start ;) - at home (South Africa) there is huge social disparity which is perpetuated by only the well-off having access to resources that could potentially break the cycle. We are focused on education. Many students in poorer schools (>50%) do not even have sufficient textbooks. Enter our project - a note: without publishers', editors' and authors' royalties a hard cover 250 page books costs less than ZAR20 (<$2.5) to print:


FHSST (Free High School Science Texts) is a project that aims to provide free science and mathematics textbooks for Grades 10 to 12 science learners in South Africa.

Read more
claus2080's picture

Hello, I want to contribute to drutex

Hi! I'd like to start contributing to drutex. I've installed it on my server and guess what? It didn't work. So I'm asking myself: Why doesn't it work? I've added a couple of useful debugging features to my own, one which is related to an issue posted a while ago, stating that the message TeX Embedding failed! was not enough ( The other one was trying to access the latex error log. Both were quite simple.

Read more
njivy's picture

Linked references

In items 4.2 and 4.3 of our technical specification, we talked about links between \ref{equation-id} and <equation id="equation-id"></equation>. What plans do we have to include this functionality in DruTeX?

Read more
dwees's picture

Mimetex.cgi hack

I've created a hack for converting Drutex from using LateX to render the pictures to using Mimetex.cgi to render them. The image quality isn't quite as good, but it works. The hack is currently in the really ugly stage where a lot of the Drutex stuff probably doesn't work (like multi-line equations), but I will test this stuff out, and see if I can modify the code to support this. I'm a real beginner in PhP so I'm not able to answer any fancy questions about it. Also, please note that you will want to change the URL to the Mimetex.cgi, and that Mimetex.cgi needs to be installed into the CGI-BIN directory of your webhost.

Read more
robertDouglass's picture

Any news here?

It would be nice to get an update on progress.

Read more
njivy's picture

Technical specification

Our technical specification is available through (Ask for the password.) We finished the technical spec on May 30 and excised one line on June 6, 2006.

Read more
Subscribe with RSS Syndicate content

SoC 2006: DruTeX

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week