This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
paper:latex:equation [2022/03/30 11:47] odagawa |
paper:latex:equation [2022/12/23 13:16] (current) odagawa |
||
---|---|---|---|
Line 1: | Line 1: | ||
=====数式の書き方===== | =====数式の書き方===== | ||
- | 前提として eqnarray 環境は非推奨. | + | * 前提として eqnarray 環境は非推奨. |
+ | * 数式環境内に空白の行を作るとエラーになる | ||
+ | * amsmath や mathtools が必要なものもある | ||
+ | |||
+ | * 1行の数式を書きたいとき -> equation 環境 | ||
+ | <code latex> | ||
+ | \begin{equation} | ||
+ | y = ax | ||
+ | \label{eq: | ||
+ | \end{equation} | ||
+ | </ | ||
+ | |||
+ | *複数行の数式を書きたいとき,たとえば式変形をするとき -> align 環境 | ||
+ | * 全部の行に式番号が入る | ||
+ | * & の部分が揃う | ||
+ | <code latex> | ||
+ | \begin{align} | ||
+ | (a + b)^2 &= (a + b) (a +b) \label{eq: | ||
+ | &= a^2 + 2ab + b^2 \label{eq: | ||
+ | \end{align} | ||
+ | </ | ||
+ | |||
+ | * 複数の数式を書きたいとき,たとえば複数の関数をならべるとき -> gather 環境 | ||
+ | * 全部の行に式番号が入る | ||
+ | * 中央に揃う | ||
+ | <code latex> | ||
+ | \begin{gather} | ||
+ | A(x) = x \label{eq: | ||
+ | B(x) = x^2 \label{eq: | ||
+ | \end{gather} | ||
+ | </ | ||
+ | |||
+ | * 長い数式を複数行にわけるとき -> split 環境 | ||
+ | * 数式番号は全体でひとつ | ||
+ | * & の部分で揃う | ||
+ | <code latex> | ||
+ | \begin{equation} | ||
+ | \begin{split} | ||
+ | a &= \int_0^\infty f(x)\sin x\cos x dx \\ | ||
+ | &\quad - \int_0^\infty f(-x)\sin x\cos x dx | ||
+ | \end{split} \label{eq: | ||
+ | \end{equation} | ||
+ | </ | ||
+ | |||
+ | * 長い数式を複数行にわけるとき -> multline 環境 | ||
+ | * スペルに注意 | ||
+ | * 一番上が左揃え,一番下が右揃えになる | ||
+ | <code latex> | ||
+ | \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} | ||
+ | </ | ||
+ | |||
+ | * multline を split などと一緒に使いたい -> multlined 環境 | ||
+ | * D 論の式 (9.4), (9.5) | ||
+ | <code latex> | ||
+ | \begin{align} | ||
+ | \begin{split} | ||
+ | \Delta\theta_\mathrm{rad' | ||
+ | &= \!\begin{multlined}[t] | ||
+ | \arctan\left( \left. \frac{-\tan\theta_{x0}\tan\theta_{x1} - \tan\theta_{y0}\tan\theta_{y1} + \tan^2\theta_{x0} + \tan^2\theta_{y0}}{\sqrt{\tan^2\theta_{x0} + \tan^2\theta_{y0} + (\tan^2\theta_{x0} + \tan^2\theta_{y0})^2}} \right. \right. \\ | ||
+ | \hspace{0.3\textwidth} \left. \left. \middle/ \frac{\tan\theta_{x0}\tan\theta_{x1} + \tan\theta_{y0}\tan\theta_{y1} + 1}{\sqrt{\tan^2\theta_{x0} + \tan^2\theta_{y0} + 1}} \right. \right), | ||
+ | \end{multlined} | ||
+ | \end{split} \label{eq: | ||
+ | \begin{split} | ||
+ | \Delta\theta_\mathrm{lat' | ||
+ | &= \!\begin{multlined}[t] | ||
+ | \arctan\left(\left. \frac{-\tan\theta_{y0}\tan\theta_{x1} + \tan\theta_{x0}\tan\theta_{y1}}{\sqrt{\tan^2\theta_{x0} + \tan^2\theta_{y0}}} \right. \right. \\ | ||
+ | \hspace{0.3\textwidth} \left. \left. \middle/ \frac{\tan\theta_{x0}\tan\theta_{x1} + \tan\theta_{y0}\tan\theta_{y1} + 1}{\sqrt{\tan^2\theta_{x0} + \tan^2\theta_{y0} + 1}} \right. \right). | ||
+ | \end{multlined} | ||
+ | \end{split} \label{eq: | ||
+ | \end{align} | ||
+ | </ |