Title: Math support in Maruku LaTeX preamble: math_preamble.tex LaTeX use listings: true CSS: math.css style.css use numbered headers: true
This document describes Maruku's support of inline LaTeX-style math.
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.
- toc {:toc}
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:
$x^{n}+y^{n} \neq z^{n}$ for$n \geq 3$
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.}
\]
[ \sum_{n=1}^\infty \frac{1}{n} \text{ is divergent, but } \lim_{n \to \infty} \sum_{i=1}^n \frac{1}{i} - \ln n \quad \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:
$$ \alpha $$ (A)
[ \beta ] (B)
[ \delta \label{D} ]
You can now refer to (eq:A), (eq:B), \eqref{C}, \eqref{D}.
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] = 'itex2mml'
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
itex2mml supports much more LaTeX commands/environments than ritex.
Install itextomml with
$ gem install itextomml
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:
Install with
$ gem install ritex
ritex's abilities are very limited, but it is the easiest to install since, unlike itextomml
, it is a pure-ruby implementation.
Download from http://www.blahtex.org. Make sure you have
the command-line blahtex
in your path.
- Mozilla wants files to have the
.xhtml
extension.
...
-
Globals[:math_png_dir]
-
Globals[:math_png_dir_url]
...
-
using
ex
-
IE7 bug
...