3 minute read


MathJax๋Š” ๋งˆํฌ๋‹ค์šด ๊ธฐ๋ฐ˜์˜ ์‚ฌ์ดํŠธ์—์„œ ๋„๋ฆฌ ์‚ฌ์šฉ๋˜๋Š” $\LaTeX$ ์ˆ˜์‹ ๋ Œ๋”๋ง JS ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž…๋‹ˆ๋‹ค.

์ด ํฌ์ŠคํŠธ๋Š” ์ œ๊ฐ€ MathJax๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ ๊ฒฝํ—˜ํ•œ ๊ฒƒ๋“ค๊ณผ ๋„์›€์ด ๋œ ์ž๋ฃŒ๋“ค์„ ์ •๋ฆฌํ•˜๋Š” ํฌ์ŠคํŠธ์ž…๋‹ˆ๋‹ค :)


MathJax ๊ณต์‹ ๋„ํ๋จผํŠธ

  • TeX and LaTeX math delimiters1
    • ๋งˆํฌ๋‹ค์šด ๋‚ด์—์„œ MathJax ๋ Œ๋”๋ง์— ์“ฐ๋Š” $์™€ ๋‹ฌ๋Ÿฌ๋ฅผ ํ‘œ์‹œํ•  ๋•Œ ์“ฐ๋Š” $์˜ ๊ตฌ๋ถ„์— ๋Œ€ํ•œ ๋ฌธ์„œ์ž…๋‹ˆ๋‹ค. processEscapes: true๋กœ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • The TeX/LaTeX Extension List
    • equation numbering์„ ์œ„ํ•ด ams extension์„ ์‚ฌ์šฉํ•˜๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค.
  • Automatic Equation Numbering
    • tag: ams์™€ \begin{equation} ... \end{equation} ๊ตฌ๋ฌธ์„ ์ด์šฉํ•ด ์ ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

LaTeX / MathJax ๋ฌธ๋ฒ•

๋ชจ๋‘ ์ ์ง€๋Š” ์•Š๊ณ , ํ—ท๊ฐˆ๋ฆฌ๋Š” ๋ฌธ๋ฒ•๋งŒ ์ ๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

  • ์ค‘๊ด„ํ˜ธ { }: inlineMath vs. displayMath
    • inlineMath: \\{ ... \\}์œผ๋กœ ์‚ฌ์šฉ
    • displayMath: \{ ... \}์œผ๋กœ ์‚ฌ์šฉ
  • Scalable ์ค‘๊ด„ํ˜ธ
    • ininteMath: \left\\{ ... \right\\}
    • displayMath: \left\{ ... \right\}
    • EX) $\left\{\dfrac{x}{y}\right\}$
  • ๋ถ„์ˆ˜; fraction
    • \frac{}{}: $\frac{x}{y}$
    • \dfrac{}{}: $\dfrac{x}{y}$
    • \tfrac{}{}: $\tfrac{x}{y}$
    • \frac๊ณผ \tfrac์€ inline์—์„  ๊ฑฐ์˜ ์ฐจ์ด๊ฐ€ ์•ˆ ๋‚˜๊ณ , display์—์„œ๋Š” ์ฐจ์ด๊ฐ€ ๋ช…ํ™•ํžˆ ๋‚˜ํƒ€๋‚œ๋‹ค.
    • ๋ฐ˜๋ฉด์— \dfrac๊ณผ \frac์€ display์—์„œ ๊ฑฐ์˜ ์ฐจ์ด๊ฐ€ ์•ˆ ๋‚œ๋‹ค.

๏ผŠ (display) frac

\[\frac{x^3+5x^2+4}{x^2-2}(x+6)^2\]

๏ผŠ (display) tfrac

\[\tfrac{x^3+5x^2+4}{x^2-2}(x+6)^2\]

๏ผŠ (display) dfrac

\[\dfrac{x^3+5x^2+4}{x^2-2}(x+6)^2\]
  • Alignment
    • ์ˆ˜์‹ ์—ฌ๋Ÿฌ ๊ฐœ๋ฅผ ํ˜•์‹์— ๋งž์ถฐ ์ž‘์„ฑํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค.
      \begin{aligned}
      ax &= ay \\
      x &= y
      \end{aligned}
      
\[\begin{aligned} ax &= ay \\ x &= y \end{aligned}\]
  • disjoint union
    • ๊ณต์‹ $\LaTeX$์—์„  \uplus $\uplus$๋งŒ ์ง€์›ํ•˜๋Š” ๊ฒƒ ๊ฐ™๋‹ค.
    • {\cup\mkern-13mu\cdot\mkern5mu}๋ฅผ ํ†ตํ•ด์„œ ${\cup\mkern-13mu\cdot\mkern5mu}$ ๊ธฐํ˜ธ๋ฅผ ์ง์ ‘ ์ปค์Šคํ…€ํ•ด์•ผ ํ•œ๋‹ค.
    • ๋˜๋Š” ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž โŠ๋ฅผ ์ง์ ‘ ๋„ฃ๋Š” ๋ฐฉ๋ฒ•๋„ ์žˆ๋‹ค. $โŠ$

mathjax-support

์ œ๊ฐ€ ์“ฐ๋Š” MathJax ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” html ํŒŒ์ผ์ž…๋‹ˆ๋‹ค.

<script>
    MathJax = {
      tex: {
        inlineMath: [['$', '$'], ['\\(','\\)']],
        displayMath: [ ['$$', '$$'], ['\\[','\\]'] ], // ok to remove
        processEscapes: true, // make distinguishable with $ and \$.
        categories: 'ams', // equation numbering
      }
    };
</script>

<script type="text/javascript" id="MathJax-script" async
  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>

MathJax ๊ณต์‹ ๋ฌธ์„œ์— ๋”ฐ๋ฅธ ์•„๋ž˜์˜ ๊ตฌ๋ฌธ์„ ํ†ตํ•ด MathJax์˜ latest ๋ฒ„์ „์„ ๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

<script type="text/javascript" id="MathJax-script" async
  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>

๊ทธ ์™ธ์˜ Reference


  1. delimiter: ๊ตฌ๋ถ„ ๋ฌธ์ž; ์˜์—ญ ์‚ฌ์ด ๊ฒฝ๊ณ„๋ฅผ ์ง€์ •ํ•˜๋Š” ์‚ฌ์šฉํ•˜๋Š” ํ•˜๋‚˜์˜ ๋ฌธ์ž. C์–ธ์˜ ์„ธ๋ฏธ์ฝœ๋ก  ;๊ฐ€ ๋Œ€ํ‘œ์ ์ธ ์˜ˆ์ด๋‹ค.ย 

Tags:

Categories:

Updated: