Extension:SimpleMathJax
<languages />
Template:Extension
<translate> The SimpleMathJax extension enables [<tvar name=url>http://www.mathjax.org/</tvar> MathJax], a JavaScript library, for typesetting TeX formula in MediaWiki inside math environments.</translate>
<translate> This extension will load resources from <tvar name=1>cdn.jsdelivr.net</tvar> on all wiki pages that have math or chem tags.</translate>
<math>E=mc^2</math>
<translate>
- Advantages
- Simple
- Lightweight
- UTF-8 Support
- Mobile View OK
- Setting Font Size
- chem tag support for chemistry
- additional inlineMath symbols pairs support
- MediaWiki Style! Look at [[<tvar name=samples>#Samples</tvar>|the samples]].
Installation
</translate> Template:ExtensionInstall
<translate> Or you can git clone.</translate>
$ git clone --depth 1 https://github.com/jmnote/SimpleMathJax.git
<translate> If you want to use local MathJax scripts (and not a CDN), then you can use git clone recursive.</translate>
<translate> In most cases, CDN is much faster than your server.</translate>
<translate> However, a CDN may not be available if you have a hardened PHP installation due to <tvar name=1>disabled_functions</tvar> restrictions.</translate>
$ git clone --depth 1 --recursive --shallow-submodules https://github.com/jmnote/SimpleMathJax.git
<translate> SimpleMathJax is meant to be used as an alternative to the Math extension.</translate> <translate> If the Math extension is installed it may take precedence and cause SimpleMathJax to not work.</translate> <translate> The SimpleMathJax extension is the only thing you need to start rendering equations.</translate>
<translate>
Configuration settings
The following variables can be defined in LocalSettings.php after calling <tvar name=1>wfLoadExtension( 'SimpleMathJax' );</tvar>. Note that for a simple site adding <tvar name=2>$wgSmjScale = 1.1;</tvar> might be all you need to make it Just Work™.
</translate>
| <translate> Version</translate> | <translate> Setting name</translate> | <translate> Default value</translate> | <translate> Description</translate> |
|---|---|---|---|
| 0.7.0+ | $wgSmjUseCdn | true
|
<translate> Using CDN or Local resource</translate> |
| 0.7.0+ | $wgSmjUseChem | true
|
<translate> enable <tvar name=chem>Template:Tag</tvar> tags ( defaults to use chem tags )</translate> |
| 0.8.0+ | $wgSmjEnableMenu | true
|
<translate> Make MathJax context menu available This setting is missed since 0.8.0; it would be a mistake</translate> |
| 0.8.0+ | $wgSmjExtraInlineMath | []
|
<translate> can add some additional inlineMath symbols pairs</translate> |
| 0.8.1+ | $wgSmjScale | 1
|
<translate> The default font size for SimpleMathJax</translate> |
| 0.7.4 | $wgSmjShowMathMenu | false | Template:Removed-inline <translate> (replaced by <tvar name=1>$wgSmjEnableMenu</tvar>)</translate> |
| 0.6.1 | $wgSmjSize | 110 | Template:Removed-inline <translate> (replaced by <tvar name=1>$wgSmjScale</tvar>)</translate> |
| 0.6.1 | $wgSmjInlineMath | [] | Template:Removed-inline <translate> (replaced by <tvar name=1>$wgSmjExtraInlineMath</tvar>)</translate> |
| 0.6.1 | $wgSmjDisableChem | false | Template:Removed-inline <translate> (replaced by <tvar name=1>$wgSmjUseChem</tvar>)</translate> |
| 0.6.1 | $wgSmjScripts | ['//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-AMS-MML_HTMLorMML', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/extensions/TeX/mhchem.js'] |
Template:Removed-inline <translate> (replaced by <tvar name=1>$wgSmjUseCDN</tvar>)</translate> <translate> can use local or another remote scripts</translate> <translate> ( defaults to use cloudflare CDN )</translate> |
| 0.6 | $wgSimpleMathJaxSize | 125 | Template:Removed-inline <translate> (replaced by <tvar name=1>$wgSmjSize</tvar>)</translate> |
| 0.6 | $wgSimpleMathJaxUseCDN | true | Template:Removed-inline <translate> (replaced by <tvar name=1>$wgSmjScripts</tvar>)</translate> |
| 0.6 | $wgSimpleMathInlineMath | [] | Template:Removed-inline <translate> (replaced by <tvar name=1>$wgSmjInlineMath</tvar>)</translate> |
<translate> If you want to change font size, set <tvar name=1>Template:Phpi</tvar> like below. </translate>
wfLoadExtension( 'SimpleMathJax' );
$wgSmjScale = 1.5;
<translate> If you want to enable some additional inlineMath symbol pairs, set <tvar name=1>Template:Phpi</tvar> like below. </translate>
wfLoadExtension( 'SimpleMathJax' );
$wgSmjExtraInlineMath = [ [ "$", "$" ], [ "\\(", "\\)" ] ];
<translate> If you want to use local module, set <tvar name=1>Template:Phpi</tvar> like below. </translate>
wfLoadExtension( 'SimpleMathJax' );
$wgSmjUseCdn = false;
<translate>
SimpleMathJax and Live Preview (versions < 0.8.0)
Prior to version 0.8.0, the following had to be added to MediaWiki:Common.js in order to have the Live Preview in the editor show rendered math output instead of raw LaTeX source code: </translate>
function waitForMathJax($content) {
if (typeof MathJax === 'undefined') {
setTimeout(function () { waitForMathJax($content); }, 1000);
} else {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
}
}
mw.hook('wikipage.content').add(waitForMathJax);
<translate>
Samples
- Comparison
</translate>:
- en:user:Jmkim dot com/TeX Samples <translate> (rendering with wikipedia math engines, English)</translate>
- ko:user:Jmkim dot com/TeX 샘플 <translate> (rendering with wikipedia math engines, Korean)</translate>
- http://zetawiki.com/wiki/TeX_샘플 <translate> (rendering with SimpleMathJax)</translate>
<translate>
- More examples
</translate>:
- http://zetawiki.com/wiki/TeX_문법 <translate> (Grammar)</translate>
- http://zetawiki.com/wiki/TeX_행렬 <translate> (Matrix)</translate>
- http://zetawiki.com/wiki/TeX_특수문자 <translate> (Special Characters)</translate>
- http://zetawiki.com/wiki/Mhchem_테스트 <translate> (chem tags)</translate>
<translate>
See also
</translate>
<translate>
External links
- [<tvar name=url>https://www.mathjax.org/#gettingstarted</tvar> Using MathJax version 3]
</translate>
[[Category:TeX{{#translation:}}]] [[Category:Math display extensions{{#translation:}}]]