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: