2024-7-5

このブログのMarkdownでLaTeXを使う

このブログのMarkdownでLaTeXを使う方法

Table of Contents

LaTeXの基本的な使い方

  1. 簡単なインライン数式:

    markdown
    インライン数式の例:
    - 円の面積:$A = \pi r^2$
    - 二次方程式の解の公式:$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$
    - アインシュタインの有名な式:$E = mc^2$

    出力:

    インライン数式の例:

    • 円の面積:A=πr2A = \pi r^2
    • 二次方程式の解の公式:x=b±b24ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
    • アインシュタインの有名な式:E=mc2E = mc^2
  2. 基本的なブロック数式:

    markdown
    ガウス積分:
    $$
    \int_{-\infty}^\infty e^{-x^2} dx = \sqrt{\pi}
    $$

    出力:

    ガウス積分:

    ex2dx=π\int_{-\infty}^\infty e^{-x^2} dx = \sqrt{\pi}

高度な数式

  1. 行列の演算:

    markdown
    $$
    \begin{pmatrix}
        a & b \\
        c & d
    \end{pmatrix}
    \begin{pmatrix}
        x \\
        y
    \end{pmatrix} =
    \begin{pmatrix}
        ax + by \\
        cx + dy
    \end{pmatrix}
    $$

    出力:

    (abcd)(xy)=(ax+bycx+dy)\begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} ax + by \\ cx + dy \end{pmatrix}
  2. 複数行の数式と位置合わせ:

    markdown
    $$
    \begin{align}
        (x + y)^3 &= (x + y)(x + y)^2 \\
        &= (x + y)(x^2 + 2xy + y^2) \\
        &= x^3 + 3x^2y + 3xy^2 + y^3
    \end{align}
    $$

    出力:

    (x+y)3=(x+y)(x+y)2=(x+y)(x2+2xy+y2)=x3+3x2y+3xy2+y3\begin{align} (x + y)^3 &= (x + y)(x + y)^2 \\ &= (x + y)(x^2 + 2xy + y^2) \\ &= x^3 + 3x^2y + 3xy^2 + y^3 \end{align}

その他の例

markdown
$$
    A \cap (B \cup C) = (A \cap B) \cup (A \cap C)
$$

出力:

A(BC)=(AB)(AC) A \cap (B \cup C) = (A \cap B) \cup (A \cap C)
markdown
$$
    \forall x \in \mathbb{R}, \exists y : y > x
$$

出力:

xR,y:x<y \forall x \in \mathbb{R}, \exists y : x < y
markdown
$$
    P(A|B) = \frac{P(B|A)P(A)}{P(B)}
$$

出力:

P(AB)=P(BA)P(A)P(B) P(A|B) = \frac{P(B|A)P(A)}{P(B)}
markdown
$$
    \frac{d}{dx}\left[\int_a^x f(t)dt\right] = f(x)
$$

出力:

ddx[axf(t)dt]=f(x) \frac{d}{dx}\left[\int_a^x f(t)dt\right] = f(x)
markdown
$$
    \sum_{n=0}^{\infty} x^n = \frac{1}{1-x}, |x| < 1
$$

出力:

n=0xn=11x,x<1 \sum_{n=0}^{\infty} x^n = \frac{1}{1-x}, |x| < 1
markdown
$$
    \lim_{x \to 0} \frac{\sin x}{x} = 1
$$

出力:

limx0sinxx=1 \lim_{x \to 0} \frac{\sin x}{x} = 1
markdown
数学で最も美しい方程式:
$$
    e^{i\pi} + 1 = 0
$$

出力:

数学で最も美しい方程式:

eiπ+1=0 e^{i\pi} + 1 = 0
markdown
$$
    \zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^s} \quad \text{(Riemann zeta function)}
$$

出力:

ζ(s)=n=11ns(Riemann zeta function) \zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^s} \quad \text{(Riemann zeta function)}
markdown
$$
    \Gamma(z) = \int_0^{\infty} t^{z-1}e^{-t}dt \quad \text{(Gamma function)}
$$

出力:

Γ(z)=0tz1etdt(Gamma function) \Gamma(z) = \int_0^{\infty} t^{z-1}e^{-t}dt \quad \text{(Gamma function)}
markdown
$$
    \vartheta(z) = \sum_{n=-\infty}^{\infty} e^{-\pi n^2 z} \quad \text{(Theta function)}
$$

出力:

ϑ(z)=n=eπn2z(Theta function) \vartheta(z) = \sum_{n=-\infty}^{\infty} e^{-\pi n^2 z} \quad \text{(Theta function)}
LaTeXにおける空白
種類記法出力
負の空白$a \! b$a ⁣ba\!b
小さい空白$a \, b$aba\,b
中程度の空白$a \; b$a  ba\;b
大きい空白$a \quad b$aba\quad b
さらに大きい空白$a \qquad b$aba\qquad b

関連記事