Extensão:SimpleMathJax

From mediawiki.org
Jump to navigation Jump to search
This page is a translated version of the page Extension:SimpleMathJax and the translation is 22% complete.
Other languages:
English • ‎Tiếng Việt • ‎Türkçe • ‎dansk • ‎español • ‎français • ‎polski • ‎português • ‎português do Brasil • ‎中文 • ‎日本語 • ‎한국어
Manual de extensões do MediaWiki
OOjs UI icon advanced.svg
SimpleMathJax
Estado de lançamento: estável
Implementação Etiqueta
Descrição Permite mostrar fórmulas matemáticas no estilo matemático do MediaWiki
Autor(es) jmnote, vedmaka, jamesmontalvo3, badshah400
Última versão 0.8.2 (2021-01-01)
MediaWiki 1.29+[1]
Alterações à base de dados Não
Licença Licença MIT
Transferência
README
Exemplo zetawiki.com

  • $wgSmjUseCdn
  • $wgSmjUseChem
  • $wgSmjDisplayMath
  • $wgSmjExtraInlineMath
  • $wgSmjScale
  • $wgSmjEnableMenu
  • $wgSmjDisplayAlign
  • $wgSmjWrapDisplaystyle

Verifique a utilização e a matriz de versões

A extensão SimpleMathJax usa MathJax, uma biblioteca JavaScript, para a composição de fórmulas TeX no MediaWiki, em ambientes matemáticos. This extension will load resources from cdn.jsdelivr.net on all wiki pages that have math or chem tags.

<math>E=mc^2</math>
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 the samples.

Instalação

Para utilizadores que tenham o MediaWiki versão 1.24 ou anteriores:

As instruções acima descrevem a nova forma de instalar esta extensão, usando a extensão wfLoadExtension(). Se precisar de instalar esta extensão nestas versões anteriores (MediaWiki 1.24 e anteriores), em vez de wfLoadExtension( 'SimpleMathJax' );, use:

require_once "$IP/extensions/SimpleMathJax/SimpleMathJax.php";

Or you can git clone.

$ git clone https://github.com/jmnote/SimpleMathJax.git

If you want to use local MathJax scripts (and not a CDN), then you can use git clone recursive. In most cases, CDN is much faster than your server. However, a CDN may not be available if you have a hardened PHP installation due to disabled_functions restrictions.

$ git clone --recursive https://github.com/jmnote/SimpleMathJax.git

SimpleMathJax is meant to be used as an alternative to the Math extension. If the Math extension is installed it may take precedence and cause SimpleMathJax to not work. The SimpleMathJax extension is the only thing you need to start rendering equations.

Parâmetros de configuração

The following variables can be defined in LocalSettings.php after calling wfLoadExtension( 'SimpleMathJax' );. Note that for a simple site adding $wgSmjScale = 1.1; might be all you need to make it Just Work™.

Version Setting name Default value Descrição
0.7.0+ $wgSmjUseCDN true Using CDN or Local resource
0.7.0+ $wgSmjUseChem true enable <chem> tags
( defaults to use chem tags )
0.8.0+ $wgSmjEnableMenu true Make MathJax context menu available
This setting is missed since 0.8.0; it would be a mistake
0.8.0+ $wgSmjExtraInlineMath [] can add some additional inlineMath symbols pairs
0.8.1+ $wgSmjScale 1 The default font size for SimpleMathJax
0.7.4 $wgSmjShowMathMenu false (removed)
(replaced by $wgSmjEnableMenu)
0.6.1 $wgSmjSize 110 (removed)
(replaced by $wgSmjScale)
0.6.1 $wgSmjInlineMath [] (removed)
(replaced by $wgSmjExtraInlineMath)
0.6.1 $wgSmjDisableChem false (removed)
(replaced by $wgSmjUseChem)
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']
(removed)
(replaced by $wgSmjUseCDN)
can use local or another remote scripts
( defaults to use cloudflare CDN )
0.6 $wgSimpleMathJaxSize 125 (removed)
(replaced by $wgSmjSize)
0.6 $wgSimpleMathJaxUseCDN true (removed)
(replaced by $wgSmjScripts)
0.6 $wgSimpleMathInlineMath [] (removed)
(replaced by $wgSmjInlineMath)

If you want to change font size, set $wgSmjScale like below.

wfLoadExtension( 'SimpleMathJax' );
$wgSmjScale = 1.5;

If you want to enable some additional inlineMath symbol pairs, set $wgSmjExtraInlineMath like below.

wfLoadExtension( 'SimpleMathJax' );
$wgSmjExtraInlineMath = [ [ "$", "$" ], [ "\\(", "\\)" ] ];

If you want to use local module, set $wgSmjUseCDN like below.

wfLoadExtension( 'SimpleMathJax' );
$wgSmjUseCDN = false;

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:

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);

Samples

Comparação
Mais exemplos

Ver também

External links

  1. SimpleMathJax 0.8.0+ uses manifest_version 2. Manual:Extension.json/Esquema