メインコンテンツまでスキップ

LaTeX Cheat Sheet

数式

式番号

式番号が必要な場合:

\begin{eqnarray}
y=\alpha x + \beta
\end{eqnarray}
y=αx+β(1) y=\alpha x + \beta \tag{1}

式番号が必要ない場合:

\[
y=\alpha x + \beta
\]
y=αx+β y=\alpha x + \beta

数式を揃える

イコールの位置で複数の数式を揃える場合は & を使います.

\[
a&=b+c \\
d+e&=f
\]
a=b+c d+e=f\begin{aligned} a&=b+c \\\ d+e&=f \end{aligned}
\begin{eqnarray}
a&=b+c \\
d+e&=f
\end{eqnarray}
a=b+c d+e=f\begin{aligned} a&=b+c \\\ d+e&=f \end{aligned}

連立方程式

\begin{eqnarray}
\begin{cases}
(x - 2)^2 + y^2 + z^2 = 1\\
x + z = 3
\end{cases}
\end{eqnarray}
{(x2)2+y2+z2=1 x+z=3\begin{cases} \left(x - 2\right)^2 + y^2 + z^2 = 1\\\ x + z = 3 \end{cases}
\begin{numcases}
{}
(x - 2)^2 + y^2 + z^2 = 1\\
x + z = 3
\end{numcases}
{(x2)2+y2+z2=1 x+z=3\begin{cases} \left(x - 2\right)^2 + y^2 + z^2 = 1\\\ x + z = 3 \end{cases}

行列

\begin{eqnarray}
\left(
\begin{array}{cc}
a & b \\
c & d
\end{array}
\right)
\end{eqnarray}
(ab cd)\begin{pmatrix} a & b \\\ c & d \end{pmatrix}

ソースコード

minted

tex ファイル内で直接コードを書くときは minted を使います.

\begin{minted}[linenos, breaklines, frame=lines]{c}
#include <stdio.h>
int main(){
printf("Hello, World!");
return 0;
}
\end{minted}

ファイルを指定してソースコードを載せるときは inputminted を使います.

\inputminted[linenos, breaklines, frame=lines]{language}{src/hello.c}

画像

画像を1枚載せたい場合の例です.下の例では here というパッケージを使用することで指定した位置に画像を挿入しています.(\usepackage{here}

\begin{figure}[H]
\centering
\includegraphics[width=10cm]{path2image}
\caption{hoge}
\label{fig1}
\end{figure}

表は次のように書くことができますが,Table generatorなどを使って自動で作成したほうが楽です.

\begin{table}[H]
\centering
\caption{title}
\label{tbl:1}
\begin{tabular}{ccc}
\hline
e1 & e2 & e3 \\
\hline
11 & 12 & 13 \\
21 & 22 & 23 \\
31 & 32 & 33 \\
\hline
\end{tabular}
\end{table}

注釈

\footnote[number]{text}

特殊な文字や演算子

Σ

\sum_{\alpha=0}^{\beta}
α=0β\sum_{\alpha=0}^{\beta}

\int_{\alpha}^{\beta}
αβ\int_{\alpha}^{\beta}

lim

\lim_{n \to \infty}
limn\lim_{n \to \infty}

\neq
\neq

\approx
\approx

\fallingdotseq
\fallingdotseq

\equiv
\equiv

>

\gt
>\gt

<

\lt
<\lt

\geq
\geqq
\geq\\ \geqq

\leq
\leqq
\leq\\ \leqq

×

\times
×\times

÷

\div
÷\div

±

\pm
±\pm

\in
\in

\subset
\subset

\cap
\cap

\cup
\cup

空集合∅

\emptyset
\emptyset

\infty
\infty

ベクトル

\vec{a}
a\vec{a}
\bm{a}
a\bm{a}

Partial, Del, ∂

\partial
\partial