La Te X Math ML

Cookbook

PmWiki

pmwiki.org

La Te X Math ML
Summary: Translating LaTeX math notation dynamically to Presentation MathML
Version: 2007-10-04
Prerequisites: pmwiki-2.0.0
Status: Stable
Maintainer: Nicolas Poulain
Categories: Markup

Questions answered by this recipe

  • How can I translate LaTeX math notation dynamically to Presentation MathML

Description

Embed MathML contents in webpages with LaTeX syntax.

Notes

LaTeXMathML is a JavaScript program has been created by modifying Peter Jipsen's ASCIIMathML.js script.
See :http://www.maths.nottingham.ac.uk/personal/drw/lm.html for informations.

  1. Download LaTeXMathML.zipΔ
  2. Unzip LaTeXMathML.zip package into your PmWiki's root folder so that
    1. the LaTeXMathML.php file goes into your PmWiki's cookbook/ directory
    2. the LaTeXMathML.js file goes into a new directory called LaTeXMathML/ into your PmWiki's pub/ directory
  3. Add the following line to a local customization file:
    include_once('cookbook/LaTeXMathML.php');

The script adds $$ ... $$ and $...$ markups that display MathML from LaTeX syntax, the first form centers the equation, while the second generates the equation "inline".

Release Notes

Comments

Achoo, 02 July 2008: Thanks for the great job! However, while the markup $ .. $ for inline mode works fine, I can't manage to make the display mode $$ .. $$ to work. Any ideas/clues? (note: when I unzip the attachment it gives the date of 2006 instead of 2007, is it possible that the old version is uploaded by mistake?)

Well, I'm SO happy it works! I don't mind that the $$...$$ doesn't work in any way whatsoever!
They're not as pretty as the ones shown... really cramped and titchy like mimetex... bit of downer. promsan ...actually I do... I got the smooth and lovely fonts running, but only inline {$...$}; so I've rigged up jsMath... which produces the centred fonts but so far only in rougharse mimetex - no delicious PDF-smooth integral signs yet! promsan

RvdB, 27 feb 2009: The markup code for the $$..$$ seems to be wrong. I have replaced Markup('$$', '<{$', with Markup('$$', '<$', and now i get a centered equation in the div with align=center attribute (probably a typo, or the $ directive was orignally intended to be {$). But alas, the \displaystyle wrapper doesn't seem to work; i still get the inline style for the equations, in my case sub en super scripts for the integral limits.

Brian C. Becker, 20 August, 2009: For $$ to work properly (equation centered on its own line), add this line to the end of LaTeXMathML.php. If you would like to use LaTeX's usual \begin{equation}...\end{equation} as well, you can add the second line as well:

Markup("working$$", "_begin", "/\\$\\$(.*?)\\$\\$/", "<div align=\"center\">\$$1\$</div>");
Markup("nlequation", "_begin", "/^\\\begin{equation}\s*(.*?)\s*\\\end{equation}/m", "<div align=\"center\">\$$1\$</div>");

See Also

Contributors

Nicolas Poulain

User notes? : If you use, used or reviewed this recipe, you can add your name. The following format is recognized:
* (+) Optional positive comment. Name, date
* (-) Optional negative comment. Name, date

These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Recent Changes (All) | Edit SideBar Page last modified on May 23, 2010, at 06:37 PM Edit Page | Page History
Powered by PmWiki