HTML

Mathjax 에 제3자 추가 확장 패키지(third party extensions) 넣기: 문법 넣는 방법 예제도 포함

공시탈출넘버원 2023. 9. 15. 21:21

Mathjax 기본 패키지 말고, 다른 패키지들이 필요해서 넣는답시고 반나절을 헤맸다.

특히 \underbracket 문법을 지원하는 mathtools가 필요했다.

 

적절한 구문은 아래와 같다. HTML의 헤드 부분에 집어넣어준다.

필요하면 다른 수식설정을 script로 더 집어넣어 준다.

<head>

  <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
  <script>
    window.MathJax = {
      loader: {load: ['[tex]/mathtools']},
      tex: {packages: {'[+]': ['mathtools']}}
    };
  </script>  

</head>

 

패키지 제대로 불러오기 이전 (왼쪽 그림)  && 이후 (오른쪽 그림)

 


출처와 찾은 방법

 

구글에 각종 찾아줘요 구문을 넣었으나 실패. 아래는 그 키워드

how to ; import ; third party ; extra ; package ; extension ; mathjax ; HTML ; Latex

 

그러다가 아예 스택오버플로우에서만 검색해 보았다.

extension ; mathjax ; HTML

https://stackoverflow.com/search?q=mathjax+extension+cdn 

 

Human verification

Stack Overflow | The World’s Largest Online Community for Developers

stackoverflow.com

 

그랬더니 10개 정도가 나왔고, 그 중에 쓸만한 질의응답 3개와 기존 문법 설명서를 활용해서 해결했다.

(기존 문법에서 제공되는 구문을, 어디에 어떻게 넣어야 하는지를 몰랐다. 그래서 답변 결과를 보고 비슷한 형태로 집어넣었다.)

https://stackoverflow.com/questions/74199222/physics-package-does-not-load-with-mathjax-on-test-web-page/74225228#74225228

 

Physics package does not load with MathJax on test web page

I have created this simple html file to test various configurations for MathJax. In this example the file loads the latest version of MathJax with a configuration file TeX-AMS-MML_HTMLorMML from a ...

stackoverflow.com

https://stackoverflow.com/questions/57939212/problems-with-configuration-of-mathjax-3/57946865#57946865

 

problems with configuration of mathjax 3

I have a probem with three options while configuring Mathjax v.3 in my application. The minimal code to reflect the problem is an html file and two js file, one being tex-svg.js downloaded from git...

stackoverflow.com

 

https://docs.mathjax.org/en/latest/input/tex/extensions/mathtools.html

 

mathtools — MathJax 3.2 documentation

The mathtools extension implements the mathtools style package from LaTeX. The package provides a number of tools for advanced mathematical typesetting. See the CTAN page for more information and documentation of mathtools. This package is not autoloaded,

docs.mathjax.org