LoginSignup
116
94

More than 3 years have passed since last update.

数式をもっと楽に書ける TeX の physics パッケージまとめ

Last updated at Posted at 2020-07-03

全部を紹介するのは大変なので、とりあえず自分が使いそうなものだけ挙げています。
より詳しくはドキュメントをご参照ください。

使う時は

\usepackage{physics}

をします。

Automatic bracing

カッコのサイズは自動調整されます。

メジャーなカッコ

\qty()

\qty( \int_0^1 x^2 dx )

$$
\left(\int_0^1 x^2 dx\right)
$$

\qty{}

\qty{ \int_0^1 x^2 dx }

$$
\left\{ \int_0^1 x^2 dx \right\}
$$

\qty[]

\qty[ \int_0^1 x^2 dx ]

$$
\left[ \int_0^1 x^2 dx \right]
$$

\qty|| または \abs{}

\abs{ \int_0^1 x^2 dx }

$$
\left| \int_0^1 x^2 dx \right|
$$

\norm{}

\norm{ \int_0^1 x^2 dx }

$$
\left\| \int_0^1 x^2 dx \right\|
$$

オーダー記法

\order{}

\order{ x^2 } 

$$
\mathcal{O}(x^2)
$$

Vector notation

ベクトル関係の記法です。

\vb{} "vector bold" の略です
\va{} "vector arrow" の略です
\vu{} "vector unit" の略です

\vb{ v }

$$
\boldsymbol{ v }
$$

\va{ v }

$$
\boldsymbol{ \overrightarrow{v} }
$$

\vu{ v }

$$
\boldsymbol{ \hat{v} }
$$

\vdot
\cross

\va{a} \vdot \va{b}

$$
\boldsymbol{ \overrightarrow{a} \cdot \overrightarrow{b} }
$$

\va{a} \cross \va{b}

$$
\boldsymbol{ \overrightarrow{a} \times \overrightarrow{b} }
$$

\grad
\div
\curl
\laplacian

\grad{ \Psi }

$$
\boldsymbol{\nabla \Psi}
$$

\div{ \va{a} }

$$
\boldsymbol{\nabla \cdot \overrightarrow{a}}
$$

\curl{ \va{a} }

$$
\boldsymbol{\nabla \times \overrightarrow{a}}
$$

\laplacian{ \Psi }

$$
\nabla^2 \Psi
$$

Operators

いくつかの演算子が追加されています。

トレース: \tr e.g. \tr A
階数: \rank e.g. \rank A
留数: \Res e.g. \Res[f(z)]
実部: \Re{} e.g. \Re{z}
虚部: \Im{} e.g. \Im{z}

Quick quad text

数式内において、両端に空白(\quad)を入れつつテキストを挿入したい場合に、\qq{} が便利です。

e^{\pi i} = -1 \qq{オイラー} e^{\pi i} + 1 = 0

$$
e^{\pi i} = -1 \quad \mbox{オイラー} \quad e^{\pi i} + 1 = 0
$$

Derivatives

微分関係の記法です。

\dd

\dd{x}

$$
\mathrm{d} x
$$

\dd[3]{x}

$$
\mathrm{d}^3 x
$$

\dv

\dv{x}

$$
\dfrac{\mathrm{d}}{\mathrm{d} x}
$$

\dv{f}{x}

$$
\dfrac{\mathrm{d} f}{\mathrm{d} x}
$$

\dv[n]{f}{x}

$$
\dfrac{\mathrm{d}^n f}{\mathrm{d} x^n}
$$

\pdv

\pdv{x}

$$
\dfrac{\partial}{\partial x}
$$

\pdv{f}{x}

$$
\dfrac{\partial f}{\partial x}
$$

\pdv[n]{f}{x}

$$
\dfrac{\partial^n f}{\partial x^n}
$$

\pdv{f}{x}{y}

$$
\dfrac{\partial^2 f}{\partial x \partial y}
$$

Matrix macros

行列関係の記法です。

\mqty()

\mqty(a & b \\ c & d)

$$
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
$$

\mqty|| または \mdet{}

\mdet{a & b \\ c & d}

$$
\begin{vmatrix}
a & b \\
c & d
\end{vmatrix}
$$

\imat{n} "identity matrix" の略です

\mqty( \imat{3} )

$$
\begin{pmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{pmatrix}
$$

\dmat{a, b, c, ...} "diagonal matrix" の略です

\mqty( \dmat{1, 2, 3} )

$$
\begin{pmatrix}
1 & & \\
& 2 & \\
& & 3
\end{pmatrix}
$$

\mqty( \dmat[0]{1, 2, 3} )

$$
\begin{pmatrix}
1 & 0 & 0 \\
0 & 2 & 0 \\
0 & 0 & 3
\end{pmatrix}
$$


\mqty( \dmat{1, 2&3\\4&5} )

$$
\begin{pmatrix}
1 & & \\
& 2 & 3 \\
& 4 & 5
\end{pmatrix}
$$

\admat{a, b, c, ...} "anti-diagonal matrix" の略です

\mqty( \admat{1, 2, 3} )

$$
\begin{pmatrix}
& & 1 \\
& 2 & \\
3 & &
\end{pmatrix}
$$

\xmat{x}{n}{m}

\mqty( \xmat{1}{2}{3} )

$$
\begin{pmatrix}
1 & 1 & 1 \\
1 & 1 & 1
\end{pmatrix}
$$

\mqty( \xmat*{a}{2}{3} )

$$
\begin{pmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23}
\end{pmatrix}
$$

116
94
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
116
94