mathtools ExpandEnvi - yarakos95/LaTeX-for-math GitHub Wiki
cf. The mathtools Package, §4.4 Spreading equations
spreading 環境を利用しよう.この環境内では,テキストモードで文字が挿入でき,かつ数式では-ed
環境ではないことに注意したい.
\begin{spreadlines}{<dimen>} <contents>\end{spreadlines}
<dimen>
で数式の行間を指定する.
\begin{spreadlines}{20pt} % ここでは20pt の行間を取っている
Large spaces between the lines.
\begin{gather}
a = b \\
c=d
\end{gather}
\end{spreadlines}
Back to normal spacing.
\begin{gather}
a = b \\
c=d
\end{gather}
cf. The mathtools Package, §4.5 Gathered environments
通常のgathered 環境では中央揃えになるが,これを左揃えや右揃えにする環境が提供されている.
環境名 | |
---|---|
中央揃え | gathered |
左揃え | lgathered |
右揃え | rgathered |
また,gathered 環境を任意に定義することも可能である.
\newgathered{<name>}{<pre_line>}{<post_line>}{<after>} % 新しいgathered 環境を定義
\renewgathered{<name>}{<pre_line>}{<post_line>}{<after>} % 既存のgathered 環境を定義
\newcounter{steplinecnt}
\newcommand{\stepline}{\stepcounter{steplinecnt}\thesteplinecnt}
\newgathered{stargathered}
{\llap{\stepline}$*$\quad\hfil} % \hfil for centering
{\hfil} % \hfil for centering
{\setcounter{steplinecnt}{0}} % reset counter
以下のような結果を得る.
cf. The mathtools Package, §4.6 Split fractions
\frac
で分数を作成する際に,分子や分母にsprit 環境のように複数行の数式を挿入することが出来るコマンドがある.
\splitfrac
を使おう.
\begin{equation}
a = \frac{
\splitfrac{xy + xy + xy + xy + xy}
{+ xy + xy + xy + xy}
}
{z}
= \frac{
\splitdfrac{xy + xy + xy + xy + xy}
{+ xy + xy + xy + xy}
}
{z}
\end{equation}
特徴 | |
---|---|
\splitfrac |
引数にテキストモードの数式を強制する |
\splitfracd |
引数にテキストモードの数式を強制しない |
\splitfrac
を入れ子にすることは可能だが,入れ子になっている\splitfrac
側には\mathstrut
を挿入することが推奨されている.以下のように利用しよう.
\begin{equation}
\frac{
\splitfrac{xy + xy + xy + xy + xy}
{
\splitfrac{xy + xy + xy + xy + xy}
{+ xy + xy + xy + xy}
}
}
{z}
= \frac{
\splitfrac{xy + xy + xy + xy + xy}
{
\splitfrac{\mathstrut xy + xy + xy + xy + xy}
{+ xy + xy + xy + xy}
}
}
{z}
\end{equation}