Blog »

OborWiki feature highlight: LaTeX in wikipages

December 27, 2017, at 08:07 PM by Obormot in Features (0 comments)

There are two ways to embed mathematical formulas (and other things), written in LaTeX, in wikipages on OborWiki. This post shows you how.

TrueLatex

The Cookbook:True Latex recipe (disabled by default; you can enable it via the Configurator) processes your LaTeX code server-side, rendering it into SVG format and embedding the SVG as an image in your wikipage. Like this:

($$
\frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x).
$$)

Note: the TrueLatex markup is ($ / $). The extra dollar signs are used to enclose a mathematical formula.

By default, formulas are rendered for inline display. For a block-display formula, use an extra set of dollar signs:

($$$
\frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x).
$$$)

The SVG output of a particular LaTeX formula is cached, so it doesn’t need to be re-rendered every time the server gets a request for a page with that formula. You can also download the SVG image generated by TrueLatex, for use elsewhere (in the usual way—right-click, save, etc.).

See the True Latex recipe info page for details.

MathJax

In contrast to TrueLatex, MathJax is a client-side solution, that uses Javascript. Your browser runs the script and renders the LaTeX code, displaying it in the wikipage:

(:mathjax:)
{$
\frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x).
$}

{$ \frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x). $}

And for a block formula, again use an extra set of dollar signs:

{$$
\frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x).
$$}

{$$ \frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x). $$}

Note: the (:mathjax:) directive need only appear once, on any page where MathJax is to be used. It instructs PmWiki to load the MathJax package when displaying that page (by default, it’s not loaded, even if you have the recipe enabled).

See the Mathjax info page for details.

Leave a reply
Your name (required):

Your comment (required):


Enter value: Captcha