LoginSignup
25
25

More than 5 years have passed since last update.

MathJax サンプル

Last updated at Posted at 2015-07-01

MathJaxとは

数式をウェブブラウザ上で表示するためのJavascriptライブラリ

Vimで使うには

~/.vim/bundle/previm/preview/index.html<head> に以下のタグを追加する。

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

~/.vim/bundle/previm/preview/js/previm.jsloadPreview 関数を次のように変更する

if (needReload && (typeof getContent === 'function') && (typeof getFileType === 'function')) {
    _doc.getElementById('preview').innerHTML = transform(getFileType(), getContent());
    autoScroll('body');
}

if (needReload && (typeof getContent === 'function') && (typeof getFileType === 'function')) {
    _doc.getElementById('preview').innerHTML = transform(getFileType(), getContent());
    (+) MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ["\\(","\\)"]] } });
    (+) MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
    autoScroll('body');
}

Qiitaで使うには

mathコードブロックを作り、その中に数式を書いていく。

```math
数式1
数式2

サンプル

上付き、下付き文字

x^2
x^2
x_2
x_2

分数

\frac{1}{x}
\frac{1}{x}

指数

x^2
x^2

平方根(ルート)

\sqrt{x}
\sqrt{x}

円周率

\pi
\pi

ベクトル

\vec{a} = (a_1, a_2, \cdots, a_n)
\vec{a} = (a_1, a_2, \cdots, a_n)

行列

A = \left(
    \begin{array}{ccc}
      1 & 2 & 3 \\
      4 & 5 & 6 \\
      7 & 8 & 9
    \end{array}
  \right)\\
A^T
A = \left(
    \begin{array}{ccc}
      1 & 2 & 3 \\
      4 & 5 & 6 \\
      7 & 8 & 9
    \end{array}
  \right)\\
A^T

シグマ

\sum_{n=1}^{100} x^2 \\
\sum_{n=1}^\infty\frac{1}{n^2}=\frac1{1^2}+\frac1{2^2}+\frac1{3^2}+\frac1{4^2}+\frac1{5^2}+\cdots
\sum_{n=1}^{100} x^2 \\
\sum_{n=1}^\infty\frac{1}{n^2}=\frac1{1^2}+\frac1{2^2}+\frac1{3^2}+\frac1{4^2}+\frac1{5^2}+\cdots

微分

\frac{dy}{dx} \\
\frac{(d^2y)}{dx^2}
\frac{dy}{dx} \\
\frac{(d^2y)}{dx^2}

積分

\int f(x)dx \\
\int_1^\infty \frac{1}{x^2}dx
\int f(x)dx \\
\int_1^\infty \frac{1}{x^2}dx

極限

\lim_{x \to \infty} f(x)
\lim_{x \to \infty} f(x)

角度

180^\circ
180^\circ

対数

log_e(x)
log_e(x)

不等式

x\neq 0 \\
1 < x \\
1 \leq x \\
100 > x \\
100 \ge x \\
\alpha \sim 1 \\
\beta \simeq 0 \\
\gamma \approx 10
x\neq 0 \\
1 < x \\
1 \leq x \\
100 > x \\
100 \ge x \\
\alpha \sim 1 \\
\beta \simeq 0 \\
\gamma \approx 10

その他

オイラーの公式

e^{i\theta}=\cos\theta+i\sin\theta
e^{i\theta}=\cos\theta+i\sin\theta

参考サイト

Vim で Markdown を使って数学の板書を取ってフル単する
QiitaでTeX記法が使えることをご存知ですか?
LaTeXコマンド集
WEB数式 MathJax

25
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
25