Jump to content

Extension:SimpleMathJax

From mediawiki.org
This page is a translated version of the page Extension:SimpleMathJax and the translation is 42% complete.
MediaWiki 拡張機能マニュアル
SimpleMathJax
リリースの状態: 安定
実装 タグ
説明 MediaWiki の数式スタイルを含む MathJax を使用して、数式をレンダリングできるようにする
作者 jmnote and the contirubtors
最新バージョン 0.8.8 (2025-12-14)
MediaWiki 1.29+
データベースの変更 いいえ

  • $wgSmjUseCdn
  • $wgSmjUseChem
  • $wgSmjDisplayMath
  • $wgSmjExtraInlineMath
  • $wgSmjScale
  • $wgSmjEnableMenu
  • $wgSmjDisplayAlign
  • $wgSmjWrapDisplaystyle
ライセンス MIT ライセンス
ダウンロード
README
zetawiki.com

SimpleMathJax 拡張機能は JavaScript ライブラリMathJaxを使用して MediaWiki の内でmathタグ形式をTeX数式で表現してくれます。 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.

インストール

  • ダウンロードして、ファイルをextensions/フォルダー内のSimpleMathJaxという名前のディレクトリ内に配置します。
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'SimpleMathJax' );
    
  • Configure at your convenience
  • Yes 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

Or you can git clone.

$ git clone --depth 1 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 --depth 1 --recursive --shallow-submodules 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.

環境設定

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

バージョン 設定名 既定値 説明
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

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;

サンプル

比較
その他の例

関連項目

外部リンク