Extension:Math
Math リリースの状態: 安定 |
|
---|---|
![]() |
|
実装 | タグ |
説明 | 数式をレンダリングできるようにする |
作者 |
|
最新バージョン | continuous updates |
MediaWiki | 1.25+ |
データベースの変更 | はい |
テーブル | math mathoid mathlatexml |
ライセンス | GNU 一般公衆利用許諾書 2.0 以降 |
ダウンロード | |
|
|
<math> |
|
translatewiki.net で翻訳を利用できる場合は、Math 拡張機能の翻訳にご協力ください | |
問題点 | 未解決のタスク · バグを報告 |
Math拡張機能は、数式を表現するためのサポートを提供します。この拡張機能で現在できることの概要は、英語版ウィキペディアのドキュメントにあります。
古いバージョンを含め、この拡張機能のインストールと設定に関する詳細はExtension:Math/高度な設定 にあります。
数式の表示
Math 拡張機能は、MathML を SVG (文字を <path> に変換) または PNG (least preferentially) 内の画像にそれぞれフォールバックして出力しようとします。 使用しているデバイスの機能に応じて、出力の種類が選択されます。 基本的な数式のサポートはすべてのブラウザーで機能します。ただし最適なレンダリングを行うには、以下のような特定の調整が必要かもしれません:
- Firefox やその他の Gecko ブラウザーでは、ネイティブ MathML 拡張機能と数式フォントをインストールする必要があります。 アクセシビリティサポートは、NVDA、VoiceOverまたはOrcaによって提供されます。 これらに加えて、NVDAで数式を読み取るには、 MathPlayerプラグインが必要です。
- Safariその他の WebKit を使用するブラウザーでは、ネイティブの MathML レンダリングを有効にするには数式フォントをインストールし、ブラウザー設定のカスタム スタイルシートにいくつかの CSS ルールを挿入します。
アクセシビリティサポートはVoiceOverスクリーンリーダーで提供されますが、まだOrcaでは提供されていません。
- Chrome では、ChromeVox によるアクセシビリティ支援や MathJax プラグイン経由の視覚的レンダリングを利用するには、ブラウザーの設定のカスタム スタイルシートにいくつかの CSS ルールを挿入する必要があります。
- いくつかのバージョンの Internet Explorer では、MathPlayer を支援技術として使用できます。
インストール
- Vagrant を使用している場合は、
vagrant roles enable math --provision
でインストールしてください
- 手動インストール
- ダウンロードして、ファイルを
extensions/
フォルダー内のMath
という名前のディレクトリ内に配置します。 - 以下のコードを LocalSettings.php の末尾に追加します:
wfLoadExtension( 'Math' ); // インストール要件と構成設定については、以下を参照してください。
- 更新スクリプトを実行します。このスクリプトは、この拡張機能が必要とするデータベース テーブルを自動的に作成します。
- 平文以外の出力で数式を表示するには、以下の手順に従い、さまざまな数式の出力モードを有効にします。
- 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。
You should additionally go to the page Special:MathStatus to see whether all of the components of the Math extension now work. 何か問題が発生した場合は、https://phabricator.wikimedia.org にタスクを作成することをお勧めします
残念ながら、Mathoid とRESTBase のインストールについては、Math拡張機能を使用するための十分にテストされたガイドはありませんが、少なくとも作業用のドラフトはあります。 Extension:Math/Restbase に貢献してください。
数式の出力モード
$wgMathValidModesを設定すると、レンダリングに使用できる出力モードの名前を持つ配列が保持されます。 複数のモードが有効になっている場合、ログインしているユーザーは、自分の個人設定ページの表示から設定できます。
$wgDefaultUserOptions設定を使用して、これらのモードのどれをデフォルトにするかを設定することもできます。例:
$wgDefaultUserOptions['math'] = 'mathml';
Mathoid
モード: 'mathml' (pre-July 2015: MW_MATH_MATHML)
MW 1.23以上の場合、MathJaxを使用するMathoidサーバーを使用して、サーバー側のtexvc入力をMathML+SVGレンダリングに変換できます。 これが最も推奨されるオプションです。Mathoidは将来Wikipediaで使用されるレンダリングモードです。
Mathoid をサービスとして提供する
Mathoidをサービスとして提供してパフォーマンス上の利点を得るには、次の設定をお勧めします。
// 既定のレンダリング設定としてMathMLを設定する
$wgDefaultUserOptions['math'] = 'mathml';
$wgMathFullRestbaseURL = 'https://en.wikipedia.org/api/rest_';
$wgMathMathMLUrl = 'https://mathoid-beta.wmflabs.org/';
独自のMathoidサーバーを実行する方法については、Mathoidを参照してください。 2017年3月現在の注記事項として、これにはさらに RESTBase サーバー/インストールが必要な場合があります (タスク T154394を参照してください。)
Mathoidの CLI インターフェース
Mathoidの CLI インターフェース利用は設定が簡単で、永続的なメモリ消費を避けることができ、パフォーマンスは低下するものの、次の設定をお勧めします。
// MathMLを既定の解析オプションとして設定
$wgDefaultUserOptions['math'] = 'mathml';
// まず先に、config.yamlを作成してください。テンプレートはMathoidリポジトリにあります。
$wgMathoidCli = ['/path/to/mathoid/cli.js', '-c', '/path/to/mathoid/config.yaml'];
// mathoid向けに、MediaWikiのメモリ上限を1.2Gに引き上げます。
$wgMaxShellMemory = 1228800;
If you run MediaWiki under system containing SELinux and you get Mathoid cli '/path/to/mathoid/cli.js' is not executable
message from the error log, you can run
setsebool -P httpd_execmem 1 setsebool -P httpd_setrlimit 1
to make sure the Apache server allow to change system limits.
LaTeX
モード: 'png' (pre-July 2015: MW_MATH_PNG)
Since MediaWiki 1.32, this mode will also require a Mathoid server to work. In older versions, it requires installing texvc and texvccheck, which may require the most setup work.
LaTeXML
モード: 'latexml' (pre-July 2015: MW_MATH_LATEXML)
LaTeXML ユーティリティを使用。 オンラインサービスを経由して解析処理します (既定値のある$wgLaTeXMLUrlとともに設定。)
解析処理をしない
モード: 'source', (pre-July 2015: MW_MATH_SOURCE)
This mode will forward the Latex input without rendering, presenting it in a <span>
element, surrounded by $ :formula $.
Make sure to set $wgMathDisableTexFilter to 'always' (see below) if you only want the raw latex formula, else an error will appear due to the failed check for PNG depictions.
MathJax
重要な構成設定のリスト
設定名 | 既定値 | 説明 |
---|---|---|
$wgMathValidModes | array( 'png', 'source', 'mathml' )
|
サーバー上で許可されるモードを定義します。 |
$wgMathDisableTexFilter | 'never'
|
Texフィルタを無効にするオプションについて。「true」に設定した状態でLaTeX表示があると、セキュリティ上の弱点になる可能性があります。「false」に設定すると、TeXコマンドのサブセットのみ有効になります。詳細はヘルプ:数式の書き方を参照してください。 この機能を無効にするには「always」を使用してください。 |
$wgMathFullRestbaseURL | false | 数式の拡張機能の既定の設定は、ビジュアルエディターにある場合はそこから取ってきます。 詳細. |
カテゴリの追跡
The extension creates a number of tracking categories to detect errors and deprecated features. The exact name of the categories is determined by pages in the MediaWiki namespace.
MediaWiki ページ | 既定値 | 説明 |
---|---|---|
MediaWiki:Math-tracking-category-error | Category:Pages with math errors | Pages where there is a syntax error in the formula causing the rendering to fail |
MediaWiki:Math-tracking-category-render-error | Category:Pages with math render errors | Pages where there has been a temporary error in the rendering pipeline causing the rendering to fail. These normally fix themselves |
MediaWiki:Math-tracking-category-texvc-deprecation | Category:Pages that use a deprecated format of the math tags | Pages which use deprecated texvc syntax like $ % \and \or \part \ang \C \H \bold \Bbb\ \pagecolor , which should be replaced by more standard LaTeX \$ \% \land \lor \partial \angle \Complex \mathbb{H} \mathbf \mathbb (removed) respectively. Extension:Math/Roadmap を参照してください。
|
MediaWiki:Math-tracking-category-mhchem-deprecation | Category:Pages that use a deprecated format of the chem tags |
Deprecated chemical markup, see Extension:Math/Roadmap#Step 1 Part C: Manual fixing of mhchem syntax. |
ヒントとトリック
- FirefoxのアドオンMathML コピーを使うと、数式を Microsoft Wordなど他のアプリケーションに (video)、g(Math)プラグインを使うとGoogle docs (video) にそれぞれ転写できます。
- 個人設定と既定の解析モードをオーバーライドするには、<math>要素に
forcemathmode
変数を追加し、例えば画像を強制的に<math forcemathmode="png">...</math>でレンダリングさせます。
- All images of rendered formula are stored in a cache and not automatically recreated if the page is viewed or edited.
To force the re-rendering of all formulas of a page, purge using the ?action=purge&mathpurge=true
action. For example the URL https://en.wikipedia.org/w/index.php?title=Integral&action=purge&mathpurge=true will force re-rendering of the w:Integer article. Afterwards you need to bypass your browser cache so that the new created images of the formulas are actually downloaded.
エラーの報告
数式拡張機能でなにか問題が発生した場合は、Phabricatorに報告をお願いします。さらに、CoverageTestページから生成される自動化単体テストと、発生した問題に関連があるかどうか、点検する必要があります。
更なる情報
古いバージョンの情報ならびにその他の情報はExtension:Math/高度な設定 で確認します。
下位ページ
関連項目
- Extension:Math/Roadmap
- Mathoid
- Extension:SimpleMathJax - texvcやLaTeXanを利用せずに、別の方法でウィキ上で数式の解析サポートを提供するには
- texvc - texvcの説明
- TexvcのPHPでの代替
- LaTeX on a shared host
- もう一つの方法とは: LaTeX with google chart
- Manual:Enable TeX/problems
- Manual:数式
この拡張機能は 1 つ以上のウィキメディアのプロジェクトで使用されています。 これはおそらく、この拡張機能が安定していて高いトラフィックのウェブサイトでも十分に動作することを意味します。 この拡張機能がインストールされている場所を確認するには、ウィキメディアの設定ファイル CommonSettings.php および InitialiseSettings.php 内で、この拡張機能の名前を探してください。 特定のウィキにインストールされている拡張機能の完全な一覧は、そのウィキの Special:Version ページにあります。 |