「Mathjax 2.7」の版間の差分

提供:yonewiki
223行目: 223行目:
*[[Mathjax2.x系 Neo Eulerフォントのサンプルページ]]
*[[Mathjax2.x系 Neo Eulerフォントのサンプルページ]]


*[[Mathjax2.x コード一覧]] Loadするのに時間がかかるページで処理も重たいです。アクセスにはご注意下さい。
*[[Mathjax2.x コード一覧]] ※Loadするのに時間がかかるページで処理も重たいです。アクセスにはご注意下さい。Mathjaxを動作させずに、コードの動作結果を確認できる軽量版を作成予定です。


*[[Mathjax2.x 練習場]]
*[[Mathjax2.x 練習場]]

2025年1月10日 (金) 01:09時点における版

MathJaxに戻る。

概要

 2018-04-03にmathjax2.7.4が最後に更新されたのが最後ですが、現在のVersion3と機能のほとんどは使えます。やりたいことをやろうとすると少し手順が多いというデメリットはあるものの、できないということは少ないはずです。なんといってもNeo Euler ネオオイラーフォントが使えるのはありがたいですよね。オイラーフォントはHermann Zapf(ハーマン ザフ)さんが使ったもので AMS Euler > Neo Eulerのように更新されています。AMS Eulerはもう入手困難です。とはいってもmathjaxではWebフォントを使いますので、選べません。Neo Euler一択です。

 

MathJax is not defined. Global keys: NORLQ, RLCONF, RLPAGEMODULES, RLQ, RLSTATE, __playwright__binding__, __pwInitScripts, adsbygoogle, alert, atob, blur, btoa, c, caches, cancelAnimationFrame, cancelIdleCallback, captureEvents, clearInterval, clearTimeout, clientInformation, close, closed, confirm, cookieStore, createImageBitmap, credentialless, crossOriginIsolated, crypto, css_browser_selector, customElements, devicePixelRatio, document, documentPictureInPicture, event, external, fence, fetch, find, focus, frameElement, frames, getComputedStyle, getScreenDetails, getSelection, history, indexedDB, innerHeight, innerWidth, isCompatible, isSecureContext, launchQueue, length, localStorage, location, locationbar, matchMedia, mediaWiki, menubar, moveBy, moveTo, mw, name, navigation, navigator, onabort, onafterprint, onanimationend, onanimationiteration, onanimationstart, onappinstalled, onauxclick, onbeforeinput, onbeforeinstallprompt, onbeforematch, onbeforeprint, onbeforetoggle, onbeforeunload, onbeforexrselect, onblur, oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncontentvisibilityautostatechange, oncontextlost, oncontextmenu, oncontextrestored, oncuechange, ondblclick, ondevicemotion, ondeviceorientation, ondeviceorientationabsolute, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, onformdata, ongotpointercapture, onhashchange, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onlanguagechange, onload, onloadeddata, onloadedmetadata, onloadstart, onlostpointercapture, onmessage, onmessageerror, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onoffline, ononline, onpagehide, onpagereveal, onpageshow, onpageswap, onpause, onplay, onplaying, onpointercancel, onpointerdown, onpointerenter, onpointerleave, onpointermove, onpointerout, onpointerover, onpointerrawupdate, onpointerup, onpopstate, onprogress, onratechange, onrejectionhandled, onreset, onresize, onscroll, onscrollend, onscrollsnapchange, onscrollsnapchanging, onsearch, onsecuritypolicyviolation, onseeked, onseeking, onselect, onselectionchange, onselectstart, onslotchange, onstalled, onstorage, onsubmit, onsuspend, ontimeupdate, ontoggle, ontransitioncancel, ontransitionend, ontransitionrun, ontransitionstart, onunhandledrejection, onunload, onvolumechange, onwaiting, onwebkitanimationend, onwebkitanimationiteration, onwebkitanimationstart, onwebkittransitionend, onwheel, open, openDatabase, opener, origin, originAgentCluster, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, performance, personalbar, postMessage, print, prompt, queryLocalFonts, queueMicrotask, releaseEvents, reportError, requestAnimationFrame, requestIdleCallback, resizeBy, resizeTo, scheduler, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollBy, scrollTo, scrollX, scrollY, scrollbars, self, sessionStorage, setInterval, setTimeout, sharedStorage, showDirectoryPicker, showOpenFilePicker, showSaveFilePicker, speechSynthesis, status, statusbar, stop, structuredClone, styleMedia, toolbar, top, trustedTypes, visualViewport, webkitCancelAnimationFrame, webkitRequestAnimationFrame, webkitRequestFileSystem, webkitResolveLocalFileSystemURL, window

 Version2.0系に関する記事です。現在の2.0系最新バージョンは

 

MathJax failed to load.

 です。

 

利用設定(基本的な部分)

 数式システムを利用するにはヘッダ部で以下のような宣言をするだけです。

 このサイトではVersion2.7.4 と 3.0.4を使い分けていて、2.7の場合は以下のような設定を使っています。

javascript(全ブラウザ共通)

<script src='https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS_HTML-full'>
  MathJax.Hub.Config({
    "fast-preview": {disabled:true},
    tex2jax: {
      preview: "none",
      inlineMath: [['\\@','\\@'],['\\(','\\)']],
      displayMath: [['$$','$$'],['\\[','\\]']],
      skipTags: ["code"],
      processEscapes: true
    },
    "TeX": { 
      extentions:["color.js", "cancel.js"],
    },
    "HTML-CSS": {
      undefinedFamily: "'Neo Euler Medium', Meiryo, STIXGeneral, 'Arial Unicode MS', serif",
      webFont :"Neo Euler Medium"
    }
  });
</script>


Extensionについては、複数を使う時、公式ページでは上記のように記述しろとなっているのだけれど、2つめ以降がうまく取り込まれないみたい。なので、面倒だけどページごとに \$ \require{cancel} \$ と、エクステンションの機能を使う直前に記述して対応します。なんすかね。これ。でもそのページで一回、記述すれば、それ以降はずっとそのページでExtensionが適用されるみたいなので、よしとします。

使用例 \$ \require{cancel} \$

mathjax

$ \require{cancel} $ 
$$ f(x)= \int^{\infty}_{-\infty}\color{red}{\frac{1}{\sqrt{2\pi}\sigma \cancel{\sigma} }}e^{-\frac{1}{2\sigma^2}(x-\mu)^2} $$


確率密度関数 $$ \require{cancel} f(x)= \int^{\infty}_{-\infty}\color{red}{\frac{1}{\sqrt{2\pi}\sigma \cancel{\sigma} }}e^{-\frac{1}{2\sigma^2}(x-\mu)^2} $$


Neo Eulerフォントの利用

1.まずNeo EulerのWebfontを入手します。https://font.download/font/neo-eulerの@Download @Font Face Kitの方をダウンロードします。

2.解凍したファイル群の中のEuler.woffファイルを自分のWebサーバにアップロードします。

3.数式を使うページのCSSにに以下のコードを埋め込みます。


@font-face {
    font-family: 'Neo Euler Medium';
    src: url('./font/euler.woff') format('woff');
}


./font/euler.woffの部分は、自分のサイトにおける、数式を使うページからeuler.woffファイルへの相対アドレスか絶対アドレスを入力します。

4.数式を使うページの最初の宣言とコンフィグを以下のように設定します。


<script src='https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS_HTML-full'>
  MathJax.Hub.Config({
    "fast-preview": {disabled:true},
    tex2jax: {
      preview: "none",
      inlineMath: [['\\@','\\@'],['\\(','\\)']],
      displayMath: [['$$','$$'],['\\[','\\]']],
      skipTags: ["code"],
      processEscapes: true
    },
    "HTML-CSS": {
      undefinedFamily: "'Neo Euler Medium', Meiryo, STIXGeneral, 'Arial Unicode MS', serif",
      webFont :"Neo Euler Medium"
    }
  });
</script>


関連情報

  • Mathjax2.x コード一覧 ※Loadするのに時間がかかるページで処理も重たいです。アクセスにはご注意下さい。Mathjaxを動作させずに、コードの動作結果を確認できる軽量版を作成予定です。

 

MathJaxに戻る。