확장기능:SimpleMathJax

From mediawiki.org
This page is a translated version of the page Extension:SimpleMathJax and the translation is 52% complete.
Outdated translations are marked like this.
미디어위키 확장 기능 설명서
SimpleMathJax
출시 상태: 안정
구현 태그
설명 MathJax를 이용하여 미디어위키 math 스타일대로 수식을 렌더링할 수 있습니다.
만든 이 jmnote, vedmaka, jamesmontalvo3, badshah400
최신 버전 0.8.4 (2023-11-04)
MediaWiki 1.29+[1]
데이터베이스 변경 아니오
라이선스 MIT 허가서
다운로드
README
예제 zetawiki.com

  • $wgSmjUseCdn
  • $wgSmjUseChem
  • $wgSmjDisplayMath
  • $wgSmjExtraInlineMath
  • $wgSmjScale
  • $wgSmjEnableMenu
  • $wgSmjDisplayAlign
  • $wgSmjWrapDisplaystyle
Public wikis using 909 (Ranked 270th)

SimpleMathJax 확장기능은 자바스크립트 라이브러리 MathJax를 사용하여 미디어위키 내에서 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>
특장점
  • 간편함
  • 가벼움
  • UTF-8 지원
  • 모바일 보기 지원
  • 글자크기 설정 가능
  • 미디어위키 스타일 그대로! 샘플을 보세요.

설치

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는 Math 확장기능의 대안으로 사용할 수 있습니다. Math 확장기능이 설정되어 있다면, SimpleMathJax가 작동하지 않을 수 있을 수 있습니다. SimpleMathJax 확장기능 하나만 있으면 바로 수식 렌더링이 됩니다.


구성 설정

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™.

버전 설정 이름 기본값 설명
0.7.0+ $wgSmjUseCdn true Using CDN or Local resource
0.7.0+ $wgSmjUseChem true ‎<chem> 태크 비활성화 여부
( 기본값은 chem 태그 사용 )
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 [] 추가적인 인라인math 기호 쌍을 사용할 수 있음
0.8.1+ $wgSmjScale 1 SimpleMathJax확장기능의 태그에 둘러싸인 글자의 크키를 설정 합니다. 기본은 100입니디.
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)
로컬 스크립트 또는 다른 원격 스크립트를 사용할 수 있음
( 기본값은 cloudflare CDN 사용 )

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

폰트 크기를 바꾸려면, 아래와 같이 $wgSmjSize 를 설정하세요.

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

추가로 인라인math 기호 쌍을 사용하려면, 아래와 같이 $wgSimpleMathJaxInlineMath 를 설정하세요.

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

샘플

비교
추가 예시

같이 보기

외부 링크

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