This document describes Maruku’s support of inline LaTeX-style math.
At the moment, these features are experimental, are probably buggy and the syntax and implementation are bound to change in the near future.
Also, there are many subtleties of which one must care for correctly serving the XHTML+MathML document to browsers. In fact, this documentation is not enough to get you started, unless you feel very adventurous.
ritex
itex2mml
blahtex
Inline math is contained inside couples of $
.
Everything inside will be passed as-is to LaTeX: no Markdown interpretation will take place.
Example: $x^{n}+y^{n} \neq z^{n}$ for $n \geq 3$
Example: for
Equations are specified using either the $$ ... $$
or \[ ... \]
LaTeX notation. Equations can span multiple lines.
\[
\sum_{n=1}^\infty \frac{1}{n}
\text{ is divergent, but }
\lim_{n \to \infty} \sum_{i=1}^n \frac{1}{i} - \ln n \text{exists.}
\]
Some random AMSTeX symbols:
$$ \beth \Subset \bigtriangleup \bumpeq \ggg \pitchfork $$
Create a label for an equation in two ways:
LaTeX style:
Consider \eqref{a}:
$$ \alpha = \beta \label{a} $$
More readable style:
Consider (eq:a):
$$ \alpha = \beta $$ (a)
You can mix the two.
Labels will work as expected also in the PDF output, whatever style you use: Maruku will insert the necessary \label
commands.
The following are 4 equations, labeled A,B,C,D:
You can now refer to (1), (2), (3), (4).
Use the -m
option to choose the kind of output. Possible choices are:
--math-engine itex2mml
: Outputs MathML using itex2mml.--math-engine ritex
: Outputs MathML using ritex.--math-engine blahtex
: Outputs MathML using blahtex.--math-images blahtex
: Outputs PNGs using blahtex.
You have to enable the math extension like this:
require 'maruku' # loads maruku
require 'maruku/ext/math' # loads the math extension
Use the following to choose the engine:
MaRuKu::Globals[:html_math_engine] = 'ritex'
MaRuKu::Globals[:html_png_engine] = 'blahtex'
Available MathML engines are ‘none’, ‘itex2mml’, ‘blahtex’. ‘blahtex’ is the only PNG engine available.
To output MathML or PNGs, it is needed to install one of the following libraries
ritex
Install with
$ gem install ritex
ritex’s abilities are very limited, but it is the easiest to install.
itex2mml
itex2mml supports much more LaTeX commands/environments than ritex.
Install itex2mml using the instructions at:
This is a summary of the available LaTeX commands:
http://golem.ph.utexas.edu/~distler/blog/itex2MMLcommands.html
Moreover, Jacques Distler is integrating Maruku+itex2mml+Instiki. You can find more information here:
http://golem.ph.utexas.edu/~distler/blog/archives/001111.html
blahtex
Download from http://www.blahtex.org. Make sure you have the command-line blahtex
in your path.
.xhtml
extension.…
Globals[:math_png_dir]
Globals[:math_png_dir_url]
…
using ex
IE7 bug
…