Topic on Project:Support desk

How to add a script excerpt to the header of each page to introduce MathJax (without SimpleMathJax extension)

2
121.223.31.126 (talkcontribs)

How to add a <script> excerpt to the header of each page to introduce MathJax (without SimpleMathJax extension)

I've tried editing the MediaWiki:Common.js file, adding <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"> </script>, as I would add to the header of a normal HTML document. This doesn't work, however, perhaps because the javascript isn't inserted verbatim (as far as I can tell, on inspection of the the source of pages afterwards). I've been going through the php files that seem relevant (OutputPage.php, Html.php, WebStart.php) and attempting to have them directly write this code snippet to the header, but I'm new to PHP and my dogged, misguided attempts garner me little success.

I tried the SimpleMathJax extension initially, but including it in LocalSettings.php only crashed the site (though other extensions I've manually added work correctly).

I'd rather use the MathJax formatting ($$...$$, \(...)\), so would be more grateful for suggestions on how to get MathJax into the header than mend the SimpleMathJax extension. Any help at all is highly appreciated, of course!

Ciencia Al Poder (talkcontribs)

Add this to MediaWiki:Common.js

$(function() {
	importScriptURI('http://cdn.mathjax.org/mathjax/latest/MathJax.js');
});
Reply to "How to add a script excerpt to the header of each page to introduce MathJax (without SimpleMathJax extension)"