Extension talk:MathJax

[UNRELATED] MathJax and Extension:Collection
How to use the MathJax Extension together with the Collection printing extension? TomBombadil 08:59, 8 August 2011 (UTC)


 * I have no idea what you mean? MathJax is not meant for printing but for web content mathematics...

[FIXED] Error in Internet explorer
Hi. Please excuse me if this is not a right place to ask about my issue.

I can't see formulas with microsoft internet explorer. That's important since some of my friends use it, and I want them to be able to read my pages. At the same time mathjax test page displays perfect. Tested with IE 6 and 8.

You can find sample wiki on my machine at http://138.26.76.81/gt MathJax is installed at http://138.26.76.81/mathjax MathJax test page: http://138.26.76.81/mathjax/test

Any help would be very appreciated.

--Alexey ( kaikaikai@yandex.ru )

'''UPD: I changed script mwMathJaxConfig.js - it contained lists like {a, b, c,} and IE didn't work because of last comma. So changing those scripts to like {a, b, c} resolved the problem.'''


 * Thanks for noticing. I new about this comma problem but didn't realize I had comma's in there. I've put a modified configuration file online. Thanks again! --Dirk Nuyens 15:58, 15 February 2011 (UTC)

[FIXED] Error in the MathJax.php script
In later versions of MediaWiki $parser::MARKER_SUFFIX; should be $parser->mMarkerSuffix;

The MathJax.php file should be modified to work with marker suffixes for all versions. I would do it if I knew any php. Which I don't :-) --Preceding unsigned comment added by 83.109.137.194 on 23:52, 30 November 2010.


 * This has been fixed in the new version (0.5.1). --Dirk Nuyens 12:43, 1 December 2010 (UTC)

[FIXED] Multiple \tag ?
It there a reason that

\begin{equation}\label{foo} x = y \tag{$\star$} \end{equation}

gives an error? --Preceding unsigned comment added by 184.77.153.207 on 2 February 2011.

This has been fixed in the new version (0.5.2). The eqrefs are now also hyper linked to the formula. --Dirk Nuyens 15:15, 3 February 2011 (UTC)

[UNRELATED] Math not rendering
I have MathJax installed at webroot/mathjax/, and MediaWiki installed at webroot/w/. The problem is that I have $wgArticlePath = "/wiki/$1". When I remove this everything works fine. Not sure how to change the line:

$wgMathJaxJS = array("/mathjax/MathJax.js" => "$IP/extensions/MathJax/mwMathJaxConfig.js");

Any ideas? --Joejoebob 16:29, 6 February 2011 (UTC)


 * This is a problem with your local config, not with this extension. I have multiple wikis running, some of them using $wgArticlePath, some of them without; all of them play nicely with the MathJax extension. Try getting your config correct before playing with any extensions, then you at least know your MW setup is correct. --Dirk Nuyens 16:40, 7 February 2011 (UTC)

Found a simmilar error, until i found out paths in MathJaxJS are case-sensitive.

[COULD NOT REPRODUCE] Math does not render after  tags on page
Just like it says in the title. All the math before the   tags renders just fine, but it refuses to render after them on the page.


 * Can't reproduce this. Can you give an explicit example? It could be the formatting is messed up due to some other reason and therefore MathJax isn't able to detect the maths. (I did notice that eqref does not work inside the pre tags though.) --Dirk Nuyens 16:40, 7 February 2011 (UTC)

[EXTERNAL CAUSE] Equation numbers not visible when rendering equations in mathml mode
The equation numbers render fine in html-css mode but are not visible when rendering in mathml mode (selected from the menu after right clicking on an equation). (this may just be a mathjax issue)


 * It is indeed a MathJax issue. You could try it out with the MathJax sample files, e.g., mathjax/test/sample-dynamic.html: enter a formula using \tag{1} and then observe the rendering with mathml and html-css. There is no support for \tag's with mathml ;( Anyway, mathml doesn't look nice enough for my taste... --Dirk Nuyens 16:40, 7 February 2011 (UTC)

[HINT] Settings Can Lead to Speed Increase
FYI, I noticed a large increase in the speed of rendering when I changed

$wgMathJaxJS = array("http://mysite.com/MathJax/MathJax.js" => "/home/user/web/mysite/extensions/MathJax/mwMathJaxConfig.js")

to

$wgMathJaxJS = array("/MathJax/MathJax.js" => "$IP/extensions/MathJax/mwMathJaxConfig.js");

which is closer to the instructions you have posted. This may be worth pointing out to other users.


 * Thanks for the remark, I added it to the main page. Feel free to add clarifications there yourself if you want to. --Dirk Nuyens 16:40, 7 February 2011 (UTC)

[UNRELATED] Math in transclusion variables
I have a template which takes in variables l,r. When I place math with }}'s, the transclusion is prematurely ended, resulting in a nice mess.

$$ This error can be avoided by adding a space between the two }'s, but is quite inconvenient. Is there a way around this? --Joejoebob 02:28, 8 February 2011 (UTC)


 * This is a parsing problem with WM. Same thing happens if you want to use a pipe symbol inside your formula, e.g., |x| as absolute value of x. That won't work either since WM considers this the separation mark for template arguments. In that case you could use \mid or so instead of |. --Dirk Nuyens 13:23, 8 February 2011 (UTC)

[FIXED] Doesn't work in a subpage?
Hello. The extension doesn't work in a subpage?

You can see a test of this in: 

In this page there are a link to a subpage... The page and its subpage have the same latex code - $\Gamma$

Thanks.
 * Fernando Carpani 20:27, 1 March 2011 (UTC)
 * SOLVED !
 * The problem was that I put a really relative path in the $wgMathJaxJS ! :-)
 * array( "../../../mycommonsdir ..." => ...)
 * That's not a good idea. :-)
 * Fernando Carpani 19:57, 4 March 2011 (UTC)

[FIXED] NoWiki Broken
I've found a bug with the MathJax extension. It breaks the standard wiki syntax. Specifically,   ends up being rendered as         in the final output. It is normally rendered and should be rendered as &amp;lt;tt&amp;gt;


 * This is really needed for fix especially when we want to use syntaxhighlight extension for some codes. If there's any part of code matching preprocessing delimiters, there's no way to avoid this problem. I guess we need some option for part of page (or global option to turn on/off delimiters like jsMath extension does) being skipped from preprocessing. As an example, following command will not display correctly:

`echo $file | sed 's/\(.*\.\)jpg/\1png/'`


 * Any suggestions on how to fix? I posted this as a bug to the MathJax github and they had some suggestions on how to fix the mediawiki extension. Unfortunately, I don't know php well enough to suggest a fix. Could any kindly people who are having the same problem share their fix?
 * https://github.com/mathjax/MathJax/issues/166


 * UPDATE: I resolved this same problem by making sure to use the mathjax javascript locally as opposed to calling it from the webpage. Somehow this fixed everything.


 * The handling of  has been changed, everything should now work as expected (similarly for

More about CDN: http://www.mathjax.org/docs/1.1/start.html

--Evan

Another possibility is, to set the -variable in the presented Installation to the cdn-URL of MathJax. Worked finde for me without installation of MathJax. Maybe one might add that to the installation instructions --Ronny


 * That's weird... I also did that before, where in the wgMathJaxJS I mapped    mathjax-cdn-url =>  ""  (to be empty), and it didn't work for me. If I remember correctly the math tag worked but other delimiters did not, which seems a bit strange to me. Maybe the other delimiters worked but not the math tag. In any case, this way preserves the configuration in mwMathJaxConfig.js, if there is anything extra in there...  --Evan


 * I've changed the way this works and have the usage of the CDN now as the default. Dirk Nuyens (talk) 23:47, 22 April 2012 (UTC)

[ADDED] Disable $ Delimiter for math mode
Is there an easy way to disable the $ delimiter with the extension? We love this extension but have several pages on our wiki with markup like:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib echo $LD_LIBRARY_PATH

Which renders like:



When wrapped in source tags the problem disappears.


 * I have added a tag for this. You can also disable processing of  by disabling it in the new config by doing   on that page. Dirk Nuyens (talk) 23:53, 22 April 2012 (UTC)

[FIXED] Update
By editing $IP/extensions/MathJax/mwMathJaxConfig.js I'm able to disable inline parsing on $. However I have a new problem: generated pre tags are different. Here is some example mediawiki markup

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib echo $LD_LIBRARY_PATH $herp $derp

With the MathJax extension disabled this is the resulting HTML:

With the MathJax extension enabled I get (Note the space before echo and $herp):

I assume the extra spaces are being added after $IP/extensions/MathJax/MathJax.php parses the mediawiki markup but I don't know how to fix it.

--Spt5007 16:39, 23 March 2011 (UTC)
 * Maybe this is related to the problem seen here:
 * Test on Wikipedia (ok)
 * Same test on GeoGebraWiki (wrong!)
 * Helder 17:19, 30 April 2011 (UTC)


 * This has been fixed in the new version as well. Dirk Nuyens (talk) 23:53, 22 April 2012 (UTC)

[FIXED] $ 100,000 causes rendering with MathJax
While testing, we found that any value that is is writing with a leading $ such as $100,000 are getting rendered with MathJax. The description said that only what is inside $...$ would get rendered (single leading $ should not be recognized by MathJax). Any help on how to resolve this would be much appreciated --MWJames 17:43, 23 June 2011 (UTC)

This is a big issue for me also, because I have to replace all single $ by USD, in all my wikipedia-like pages... this is tedious ! Phcalle 15:22, 1 October 2011 (UTC)


 * You can now wrap this in tags or disable the dollar sign in the new config by doing  on that page. Actually wrapping this in   is also an option... Dirk Nuyens (talk) 23:53, 22 April 2012 (UTC)

[FIXED] $ sign prevents some wiki code from being parsed
I have disabled single $ sign in the configuration - see an excerpt below: inlineMath: [ ["\\(","\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ], processEscapes: false,

However, when a page contains some $ signs, the generated HTML code contains unparsed wiki code, as in the example below:

Testing $ sign problem:
 * Bug when the MathJax extension is loaded:

and a $2.4M budget - which we abbreviate as our 50/2/2 program. \( \sfrac{a}{b} \) - Is MathJax active?

See Crash course on OSE (replace 2.4M dollars budget with $2.4M budget'')

Overview for New People
Test $2

Testing $ sign problem: and a $2.4M budget - which we abbreviate as our 50/2/2 program. \( \sfrac{a}{b} \) - Is MathJax active?
 * After disabling the MathJax extension (by removing the line require_once("$IP/extensions/MathJax/MathJax.php"); from LocalSettings.php), I get this:

See Crash course on OSE (replace 2.4M dollars budget with $2.4M budget) [edit] Overview for New People Test $2

And here's some version info:
 * MathJax.js v1.1.7
 * TeX Input Jax v1.1.1
 * HTML-CSS Output Jax v1.1.5
 * mml Element Jax v1.1.1
 * tex2jax Extension v1.1.3
 * MathMenu Extension v1.1.4
 * Chrome v14.0.835.202 — otf fonts
 * MediaWiki 1.16.0

--Elifarley 00:30, 17 October 2011 (UTC)


 * This has been fixed and amended in the new version. You can turn of dollar parsing or protect your dollar sign. The parser will also not touch any white space anymore. Dirk Nuyens (talk) 23:57, 22 April 2012 (UTC)

mwMathJaxConfig.js and MW 1.17 Resourceloader
Do you have any idea how to get MathJax/mwMathJaxConfig.js working with the 1.17 Resourceloader, it would be nice to know how this can be achieved since all Javascripts in 1.17+ can be loaded through MW's own Resourceloader. --MWJames 13:47, 22 June 2011 (UTC)

[ADDED] Using magic words to enable/disable MathJax functionality per page
Is it possible to have some magic words such as __USEMATHJAX__ and __NOMATHJAX__ to enable or disable mathjax rendering on a page level.

We encountered that on pages with large amount of content and no mathematical formula present, the MathJax script still tries to render the page which costs some display performance. We would rather like to see a possibility that on pages that uses mathematical formulas MathJax can be activated individually by using the magic word (or used in templates etc.) or by default the extension always tries to render but as soon as __NOMATHJAX__ is present the extension would skip the step and does not interact with MathJax. --MWJames 11:32, 23 June 2011 (UTC)


 * Any update on this? Dc321 05:46, 5 September 2011 (UTC)


 * Configuration can now be done through such words like  and  . Similar for other options of the MathJax parser. Dirk Nuyens (talk) 00:00, 23 April 2012 (UTC)

[Fixed]Landing page corrupted if not logged in
Problem disappeared after adding  to the configuration an clearing the caches (no idea why).

looks like

instead of

See at http://vtadwikialt.vtad.de/index.php/VTADwiki:Portal

Undefined property: Parser::$mUniqPrefix, MathJax.php on line 226
While testing MathJax, a fatal error occurred:

Notice: Undefined property: Parser::$mUniqPrefix in ...extensions\MathJax\MathJax.php on line 226

Fatal error: Call to a member function getMaxIncludeSize on a non-object in ...\includes\parser\Parser.php on line 2827 --MWJames 02:10, 2 July 2011 (UTC)

\eqref in image caption
<tt>\eqref{}</tt>'s in image captions are not linked to the referenced equation - the global <tt>$MathJax_eqnumbers</tt> isn't set. Possible workaround: $wgHooks['ParserAfterTidy'][] = 'efParserAfterTidy'; function efParserAfterTidy( &$parser, &$text ) { global $MathJax_eqnumbers; $text = preg_replace_callback('(\\\\(eq)?ref\\{(.*?)\\})', 'MathJax_replace_eqrefs', $text); return true; } --Jlerner 15 August 2011

Does not render Mathjax
I followed all the steps.

1. Downloaded the latest zip distribution, uploaded and extracted it to `/home/user/public_html/wiki/` (the directory where the wiki installation lies)

2. Checked that it works by going to `/mathjax/test/sample.html` Here I see nicely rendered math.

3. Placed `MathJax.php` and `mwMathJaxConfig.js` on the folder `public_html/wiki/extensions/MathJax`

4. Appended to `LocalSettings.php` as instructed by adding the following code: I have tediously checked that the directory paths are all right and removed any errors. I do not get any errors anymore, but the MathJax just won't render. How do I get mathjax to work on my wiki?


 * Do not unzip the distribution into the wiki folder, but instead into the your document root, for you: /home/user/public_html/mathjax. The test file should be at http://www.yourdomain/mathjax/test/sample.html Also, did you probably disable JavaScript in your browser?

= User Settings not possible / ignored =

Hi,

first: thanks for this plugin (and for MathJax, if any of its developers reads this). The rendering is beautiful.

After installing the extension, there is no configuration property in the user setting page to enable or disable MathJax. The setting is left to "PNG". It works but is slightly unpretty (as, sometimes, users might want to change the rendering method). Is there a way to add the corresponding configuration property? Or did I miss something? --06:55, 21 October 2011 (UTC)

= [FIXED] Problems with labels in \begin style and display style environments =

This code causes mis-numbered equations (example) $$ \label{mylabel} e^{i\pi} +1 = 0 $$

We consider, for various values of $s$, the $n$-dimensional integral \begin{align} \label{def:Wns} W_n (s) &:=  \int_{[0, 1]^n} \left| \sum_{k = 1}^n \mathrm{e}^{2 \pi \mathrm{i} \, x_k} \right|^s \mathrm{d}\boldsymbol{x} \end{align} 128.54.254.180 18:44, 21 November 2011 (UTC)


 * Anyone figure this out? 128.54.254.180 20:49, 16 January 2012 (UTC)


 * Yes, thanks for that! I now parse the numbering twice and this numbers the formula's in order of appearance... Dirk Nuyens (talk) 00:02, 23 April 2012 (UTC)

= [ADDED] changes to get 1.18 to work =

I modified the MathJax.php to get it to work (hopefully I didn't break anything), just modified it so that everything is consistent with the newer StripState. Attached is the patch file.

Basically I just changed prefixes/suffixes and used addNoWiki

http://math.nyu.edu/~chou/MathJaxExtension118Patch.diff

(Well, I would attach but I'm not in autoconfirmed users yet)

--EvanChou 22:45, 29 November 2011 (UTC)
 * well, it works. thanks. --9peppe 02:56, 14 January 2012 (UTC)
 * The link is broken. Can anyone upload the path here?--Kevin42 (talk) 07:22, 19 February 2012 (UTC)
 * Sorry about that! Accidentally deleted it. Now it should work. I'll see if I can't upload it here too. --EvanChou (talk) 22:53, 26 February 2012 (UTC)


 * Thanks! The new version now works with 1.18. Dirk Nuyens (talk) 00:05, 23 April 2012 (UTC)

[RESOLVED] Renders all equations in plain text inside of \( \) symbols
We are just trying to get the MathJax extension working on our wiki. We have followed the steps given on the extension page: we have the MathJax JS library installed on the server, the configuration files in the /extensions/MathJax/ folder and we have enabled the extension in LocalSettings.php. The MathJax test page works perfectly well, but the math on the wiki pages shows up as plaintext between \( \) symbols. For example, if we have inline: $$f(x)$$ then it renders as \(f(x)\) inline. Any assistance is much appreciated. -- Chad Lieberman, 6 December 2011
 * exactly same problem for me -- David M. 21 March 2012
 * Had the same problem after patching MW 1.18, but it is actually the $wgMathJaxJS path there is wrong. Try with the full url instead "$wgMathJaxJS = array("FULL_URL_TO_MATHJAX/mathjax/MathJax.js?config=default" => "$IP/extensions/MathJax/mwMathJaxConfig.js");" -- Søren M. 31 March 2012


 * New version just uses the CDN in its default install so you don't have to do anything anymore.
 * I've got a similar problem but in different circumstances. First, I installed a wiki (MW 1.19) in a subdomain - the MathJax extension worked perfectly, then I decided to install two wikis in two subfoldes of the subdomain and the MathJax extension rendered a sort of \(f(x)\). So using Søren's recommendation above I entered the following line into LocalSettings.php: . After that everything worked fine. Let me draw your attention that I used not only FULL_URL_TO_MATHJAX = "http://cdn.mathjax.org" but also inserted "latest/" between "mathjax/" and "MathJax.js". So, my conclusion is that some corrections in the MathJax extension are needed. Any way tanks a lot to Søren -- Oleg Bondarenko, 7 May 2012

= MathJax extension gives empty pages = Hello, I have installed MediaWiki via BitNami MAMPStack+MediaWiki, and MathJax extension per instructions. MathJax test page works fine, but if I have some math in a wikipage, I get served an empty page (that is completely empty, no wiki menus or anything). I rechecked the paths many times and these should be fine. Thanks for any help.

17 January 2012


 * This probably means there is a problem with the php code. You are using an old version of the MathJax extension with a newer MediaWiki. You find the errors in a file called  and  . Use the updated extension, then it should work.

= [RESOLVED] php error in MathJax.php = I have installed MathJax following the instructions. When I try to add some math, I get the following error:

Fatal error: Call to a member function setPair on a non-object in /Users/dddd/Sites/mediawiki/extensions/MathJax/MathJax.php on line 424

Thanks for any help.

--Ivan, 17 Jan 2012

Sorry, it works fine after applying the above patch for 1.18.
 * New version includes that patch (and is now a complete rewrite).

Recent changes breaks
After I follow the steps described (install MathJax in public_html/mathjax) and add MathJax extention I can see the test page properly rendered. Though after the lines

require_once("$IP/extensions/MathJax/MathJax.php"); $wgMathJaxJS = array("$IP/mathjax/MathJax.js" => "$IP/extensions/MathJax/mwMathJaxConfig.js");

are added to the LocalSetting.php the RecentChanges will not display and when I try to add a page which contains any math tags it will not render them and return an error.

Are there any hints on what am I doing wrong? I beg pardon for a vague question.
 * It might help to tell us what error you are seeing. Please try with the new version of the extension. This might have been a problem with the configuration specification of MathJax which has changed.

= MathJax not rendered in wiki on Internet Explorer (IE8 or IE9) =

The MathJax sample page renders correctly in all browsers which I have tested (IE8, IE9, Firefox, and Chrome).

However, when tested in a wiki page, the MathJax markup is NOT rendered in Internet Explorer (IE8 or IE9). But it is working correctly in Firefox and Chrome.

I am running MediaWiki version 1.17.1 and PHP 5.3.8 (apache2handler),

I did some more testing on the actual wiki server using IE8 and found something interesting.
 * 1) When I access the wiki via "localhost" (" http://localhost/wiki/Wiki_Sandbox#MathJax "), MathJax is rendered correctly.
 * 2) When I access the wiki via the server name (" http://wikiservername/wiki/Wiki_Sandbox#MathJax "), MathJax is NOT rendered.

Any ideas?

-Dan O, 24 January 2012
 * My best guess would be something related to (relative) path names in the configuration file, but I'm not really sure. --EvanChou (talk) 01:21, 27 February 2012 (UTC)


 * I guess you installed a local version of MathJax and your server config is blocking in the second case. The new version of the extension is using the CDN, this could help. Dirk Nuyens (talk) 00:10, 23 April 2012 (UTC)

= [FIXED/ADDED EXTENSION] Clash with automatic numbering from MathJax and from the extension =

I want all equations, not just the ones with labels, to be numbered. This is possible with MathJax on it's own (using the  or   settings), but when using the MathJax extension for MediaWiki, the automatic numbering of the two methods clash: The extension reads in all  's and  's, and replaces them with  's and references to those tag-numbers. The built-in automatic numbering of MathJax then ignores all the equations with a  in them, and only numbers the equations that are left. Hence, you get sequences like 1, 2, 1 (labeled), 3, 4, 5, 2 (labeled) when you really wanted 1, 2, 3 (labeled), 4, 5, 6, 7 (labeled).

Would it be possible to simply stop the extension from changing the  and   codes, such that the MathJax script could do it the right way?

- Pia Jensen (Bozack) (talk) 10:48, 15 March 2012 (UTC)


 * After a bit of hacking around, I found a solution. In MathJax.php, comment out the following lines (they are in different places in the code):




 * This should stop the script from replacing  commands and   commands, and lets the native MathJax numbering work instead.


 * - Pia Jensen (Bozack) (talk) 09:54, 16 March 2012 (UTC)


 * I have added an option to not do the numbering. In the near future it might become the default to let MathJax handle the numbering, but for some reason it is not working properly when I try it. The option is . Dirk Nuyens (talk) 00:14, 23 April 2012 (UTC)

I get an error
This is a mediawiki extensions and can't be run from the command line. Warning: Cannot modify header information - headers already sent by (output started at http://wiki.iq-infinity.com/wiki/lat/extensions/MathJax/MathJax.php:1) in /home/djordje/public_html/wiki/wiki/lat/includes/WebResponse.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at http://wiki.iq-infinity.com/wiki/lat/extensions/MathJax/MathJax.php:1)

I did nothing wrong


 * I guess you copy/pasted the code from the wiki page and have an empty line in the beginning of the script. (There is a new version available, download only to prevent this mistake.) Dirk Nuyens (talk) 00:14, 23 April 2012 (UTC)

=$$Dom_{Pol}$$ - Maths in heading not rendered in TOC link= the title says it all OrenB | <sup style="position:relative">talk contib 10:05, 5 May 2012 (UTC)

some other issues
 * $${\left\vert D \right\vert}>>{\left\vert P \right\vert}$$
 * $$a>b\ge d>c$$


 * Could you specify which version of MediaWiki you are using? This works correctly on 1.18.2 and Extension:MathJax v0.7 when I test this. Please also tell us what rendering problem you have with the two other examples. They look correct when I test them. Dirk Nuyens (talk) 08:50, 6 May 2012 (UTC)