Skip to content

MathJax equation numbering vs MediaWiki MathJax extension equation numbering

Davide P. Cervone edited this page May 27, 2013 · 3 revisions

From https://groups.google.com/d/topic/mathjax-users/ci3QbWHWZwc/discussion

I'm trying to make a wiki using MathJax for all the math typesetting, and it's working pretty well so far. I want to use the AMSmath equation, align and multline environments, with the automatic numbering given by the autoNumber: "AMS" or autoNumber: "all" configurations.

But I get into trouble on pages where I have equations both with and without labels. It seems that the counter for labeled equations is separate for the counter for un-labeled equations. A very simple example showing the error is here.

This happens both with "AMS" and with "all". Any ideas?

I could of course always put a dummy label in each of my "un-labeled" equations, but that would be a huge job, just because they all have to be different.


A quick look at the MediaWiki MathJax Extension shows that the extension is messing with your labels and tags:

/**
 * MathJax_parser_stage2(&$parser, &$text, &$strip_state)
 *
 * The stage 2 math parser will "strip" (replace by place holders) all math 
 * environments, adding them to the $strip_state->nowiki ReplacementArray.
 * Additionally we register the \label{}, if present, of the math environment and 
 * replace it by an auto numbered \tag{} and then replace all occurrences of 
 * \eqref{} by the correct formula number. Existing \tag{} commands are also 
 * registered such that they can be referenced using \eqref{}.
 */

So you would need to modify the MathJax extension to disable this if you want MathJax to handle the labels and references. MathJax is properly handling the TeX that it receives, but that TeX has been modified from what you typed by the MediaWiki MathJax extension.

Davide


Clone this wiki locally