DruTeX

Introduction

This page describes how to use Drupal's TeX implementation, DruTeX.

Usage

Rendering LaTeX / Math

Writing maths works as in LaTeX. Use dollar signs to enclose inline math, e.g. $x^2$. Examples for paragraph math are \[ x^2 \] and $$x^2$$ (both variants are equivalent). There is also a display-style inline math environment, compare $\sum_{k=1}^\infty \frac{1}{k}$ and $!\sum_{k=1}^\infty \frac{1}{k}$.

To make a dollar sign, you have to type \$ as in LaTeX!

Arbitrary LaTeX code can be rendered as in this example: <tex>Let $x^2$ be a natural number.</tex>

There are also more elaborate environments to write math - they support auto-numbering, referencing and more. These environments are <equation> and <equations>. They both support the same attributes.

E.g. rendering an equation with a different resolution: <equation dpi="200">e^{i \cdot \pi} = -1.</equation>

To give the equation automatically a number, you have to give it an id: <equation id="euler">e^{i \cdot \pi} = -1.</equation>

You now can produce a link to that equation by typing \ref{euler}, or even better (\ref{euler}).

You can also give it a name instead of a number: <equation id="euler" name="Euler's Identity">e^{i \cdot \pi} = -1.</equation>

An example for the <equations> environment is given by:


<equations>
  \int \ln(x) \;dx
    &= \int 1 \cdot \ln(x) \;dx \\
    &= x \cdot \ln(x) - \int x \cdot \frac{1}{x} \;dx \\
    &= x \cdot \ln(x) - x
</equations>

The spaces on the left are optional.

PDF Generator

The pdf version of a node can be retrieved by accessing drutex/pdf/nid where nid is the node id. But only users with the "access pdf files" flag can access this link! You can configure this on the access controal page admin/access. There is also the possibility to get the LaTeX source by accessing drutex/tex/nid.

Verbatim

To prohibit some text from being processed by DruTeX, you can use <code> and <notex>, e.g. <notex>$x^2$</notex>.


<equations>
  \int \ln(x) \;dx
    &= \int 1 \cdot \ln(x) \;dx \\
    &= x \cdot \ln(x) - \int x \cdot \frac{1}{x} \;dx \\
    &= x \cdot \ln(x) - x
</equations>

The spaces on the left are optional.

PDF Generator

The pdf version of a node can be retrieved by accessing drutex/pdf/nid where nid is the node id. But only users with the "access pdf files" flag can access this link! You can configure this on the access control page admin/access. There is also the possibility to get the LaTeX source by accessing drutex/tex/nid.

Verbatim

To prohibit some text from being processed by DruTeX, you can use <code> and <notex>, e.g. <notex>$x^2$</notex>.

Notes

  1. We've locally modified DruTeX to support <math></math>tags.

References

  1. DruTeX Documentation