highlight.pack.js

2014年11月23日日曜日

AMS-LaTeXの環境に関するタグの使い方

基本的な環境

split以外の環境名の直後に*を付けると、式番号が振られなくなる。

equation 環境

一つの数式を表示する。

\begin{equation}
  a=b
\end{equation}
\begin{equation*}
  a=b=c
\begin{equation*}
実際の表示
\begin{equation} a=b \end{equation} \begin{equation*} a=b=c \end{equation*}

align 環境

複数の数式を&記号の後の文字でそろえて表示する。

例1

\begin{align}
a &= b \\
  &= c
\end{align}
\begin{align*}
d &= e + f \\
  &= g - h
\end{align*}
実際の表示1
\begin{align} a &= b \\ &= c \end{align} \begin{align*} d &= e + f \\ &= g - h \end{align*}

例2

\begin{align}
x   &= y   & X   &= Y \\
x'  &= y'  & X'  &= Y \\
x'' &= y'' & X'' &= Y \\
\end{align}
実際の表示2
\begin{align} x &= y & X &= Y \\ x’ &= y’ & X’ &= Y \\ x” &= y” & X” &= Y \\ \end{align}

gather 環境

複数の数式を整列せずに表示する。

\begin{gather}
a = b + c \\
c = d + e + f + g
\end{gather}
\begin{gather} a = b + c \\ c = d + e + f + g \end{gather}

実際の例

multline 環境

一行に入りきらない数式を複数行に分割して表示する。

\begin{multline}
  a=b+c+d+e+f+g+h+i+\\
    j+k+l+m+n+o+p+q+r+\\
    s+t+u+v+w+x+y+z
\end{multline}
実際の表示
\begin{multline} a=b+c+d+e+f+g+h+i+\\ j+k+l+m+n+o+p+q+r+\\ s+t+u+v+w+x+y+z \end{multline}

split 環境

他の環境の中で使うことで、複数行に跨がる数式を作ることが出来る。
equation 環境と合わせて使うことで、複数行に跨がりながら一つの数式番号しか与えないようなことも出来る。

\begin{equation}
  \begin{split}
    x_1 + y_1 &= a_1 \\
    x_2 + y_2 &= a_2 \\
    x_3 + y_3 &= a_3
  \end{split}
\end{equation}
実際の表示
\begin{equation} \begin{split} x_1 + y_1 &= a_1 \\ x_2 + y_2 &= a_2 \\ x_3 + y_3 &= a_3 \end{split} \end{equation}

notag, tag, tag*, text, eqref コマンド

notag
現在の行の数式に式番号を与えない。
tag
現在の行に任意の式番号を括弧付きで与える。
tag*
現在の行に任意の式番号を括弧なしで与える。
text
数式に注釈を入れることが出来る。
eqref
式番号を参照することが出来る。

\begin{equation}
  x^2 + 2x + 1 = 0 \notag
\end{equation}
\begin{equation}
  (x + 1)^2 = 0 \tag{}
  \label{eq:star}
\end{equation}
\begin{equation}
  (x - 1)^2 \neq 0 \tag*{式1}
  \label{eq:dagger}
\end{equation}
\begin{equation}
  x = -1 \qquad \text{\eqref{eq:star}から重解}
\end{equation}
実際の表示
\begin{equation} x^2 + 2x + 1 = 0 \notag \end{equation} \begin{equation} (x + 1)^2 = 0 \tag{※} \label{eq:star} \end{equation} \begin{equation} (x - 1)^2 \neq 0 \tag*{式1} \label{eq:dagger} \end{equation} \begin{equation} x = -1 \qquad \text{\eqref{eq:star}から重解} \end{equation}

gathered, aligned 環境

数式の幅が実際に文字が置かれている分だけになる。
括弧で括りたい場合などに使う。

例1

\begin{equation*}
  \left.
  \begin{gathered}
    &\nabla \times \boldsymbol{E} - \dfrac{\partial \boldsymbol{B}}{\partial t} = 0 \\
    &\nabla \times \boldsymbol{H} + \dfrac{\partial \boldsymbol{D}}{\partial t} = \boldsymbol{i} \\
    &\nabla \cdot \boldsymbol{D} = \rho \\
    &\nabla \cdot \boldsymbol{B} = 0
  \end{gathered}
  \right\} 
  \quad \text{マクスウェルの方程式}
\end{equation*}
実際の表示1
\begin{equation*} \left. \begin{gathered} &\nabla \times \boldsymbol{E} - \dfrac{\partial \boldsymbol{B}}{\partial t} = 0 \\ &\nabla \times \boldsymbol{H} + \dfrac{\partial \boldsymbol{D}}{\partial t} = \boldsymbol{i} \\ &\nabla \cdot \boldsymbol{D} = \rho \\ &\nabla \cdot \boldsymbol{B} = 0 \end{gathered} \right\} \quad \text{マクスウェルの方程式} \end{equation*}

2014年11月15日土曜日

AUCTeX のチートシート

AUCTeX を使うときに便利なコマンドを纏めておく。

C-c C-p C-p現在位置の図や数式のプレビュー状態を切り替え
C-c C-p C-c C-p現在位置の図や数式のプレビューを削除