公式输入法

by Yan on 4月 27, 2007

升级 drupal 到 5.1,顺便安装了一个新的 LaTeX 插件:DruTeX。比一直来用的 Latexrender 强大,更重要的是这个 DruTeX 有人更新维护。

现在在格志输入公式和在 LaTeX 环境下是一样的,复制一段 DruTeX 的使用方法,方便参考。

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

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

10 comments

可以支持TeX吗?好像不支持

$!\sum_{k=1}^\infty \frac{1}{k}$ 

by views63 on 2009/12/11 at 16:45. 回复 #

Leave your comment

Required.

Required. Not published.

If you have one.