<div><b>Chapter 3 - Typesetting Mathematical Formulae</b></div><div></div><div><b>3.1 The AMS-LATEX bundle</b></div><div>If you want to typeset (advanced) mathematics, you should use AMS-LATEX. &nbsp;The AMS-LATEX bundle is a collection of packages and classes for mathematical typesetting. &nbsp;AMS-LATEX is produced by&nbsp;<i>The American Mathematical Society</i>&nbsp;and it is used extensively for mathematical typesetting. &nbsp;LATEX itself does provide some basic features and environments for mathematics, but they are limited and in some cases inconsistent. &nbsp;</div><div></div><div>AMS-LATEX is a part of the required distribution and is provided with all recent LATEX distributions. &nbsp;We assume amsmath is loaded in the preamble; \usepackage{amsmath}.</div><div></div><div><b>3.2 Single Equations</b></div><div>A mathematical formula can be typeset in-line within a paragraph (text style), or the paragraph can be broken and the formula typeset separately (display style). &nbsp;Mathematical equations within a paragraph are entered between $ and $.</div><div><span class="math ltx_Math v1">\(a^2 + b^2 = c^2\)</span></div><div><span class="math ltx_Math v1">\(\lim_{x \to 2} f(x) = 5\)</span></div><div><span class="math ltx_Math v1">\(\lim_{n \to \infty} \sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6}\)</span></div><div></div><div>If you want to name the equation something specific, you \tag it instead.</div><div></div><div>3.2.1 Math Mode</div><div>There are also differences between math mode and text mode. &nbsp;For example, in math mode:</div><ol><li>Most spaces and line breaks to not have any significance, as all spaces are either derived logically from the mathematical expressions, or have to be specified with special commands such as \, \quad or \qquad</li><li>Empty lines are not allowed. &nbsp;Only one paragraph per formula.</li><li>Each letter is considered to be the name of a variable and will be typeset as such. &nbsp;</li></ol><div></div><div><span class="math ltx_Math v1">\(\forall x \in \mathbf{R}: \qquad x^{2} \geq 0\)</span></div><div><span class="math ltx_Math v1">\(x^{2} \geq 0\qquad \text{for all }x\in\mathbf{R}\)</span></div><div></div><div><b>3.3 Building Blocks of a Mathematical Formula</b></div><div>Most of the commands in this section will not require amsmath, but load it anyways. &nbsp;</div><div></div><div>Lowercase Greek Letters are entered as \alpha, \beta, \gamma, and uppercase letters are entered as \Gamma, \Delta, ...</div><div><span class="math ltx_Math v1">\(\lambda, \xi, \pi, \theta, \mu, \Phi, \Omega, \Delta\)</span></div><div></div><div>Exponents, Superscripts, and Subscripts can be specified using the ^ and _ characters. &nbsp;Most math mode commands act only on the next character, so if you want a command to affect several characters, you have to group them together using curly braces: {...}. &nbsp;</div><div><span class="math ltx_Math v1">\(p^3_{ij}\)</span></div><div><span class="math ltx_Math v1">\(m_\text{Knuth}\)</span></div><div><span class="math ltx_Math v1">\(\sum_{k=1}^3 k\)</span></div><div><span class="math ltx_Math v1">\(a^x+y \neq a^{x+y}\)</span></div><div><span class="math ltx_Math v1">\(e^{x^2}\)</span></div><div><span class="math ltx_Math v1">\({e^x}^2\)</span></div><div></div><div>The square root is entered as \sqrt; the nth root is generated with \sqrt[n]. &nbsp;The size of the root sign is determined automatically by LaTeX. &nbsp;</div><div><span class="math ltx_Math v1">\(\sqrt{x} \Leftrightarrow x^{1/2}\)</span></div><div><span class="math ltx_Math v1">\(\sqrt[3]{2}\)</span></div><div><span class="math ltx_Math v1">\(\sqrt{x^{2} + \sqrt{y}}\)</span></div><div><span class="math ltx_Math v1">\(\surd[x^2 + y^2]\)</span></div><div></div><div>The dot sign to indicate the multiplication operation is normally left out, it is sometimes written tho help the eye in grouping a formula. &nbsp;Use \cdot to typeset a single centered dot. &nbsp;\cdots is three centered dots while \ldots sets the dots low (on the baseline). &nbsp;Besides that, there are \vdots for vertical and \ddots for diagonal dots. &nbsp;</div><div><span class="math ltx_Math v1">\(\Psi = v_1 \cdot v_2 \cdot \ldots\)</span></div><div><span class="math ltx_Math v1">\(n! = 1 \cdot 2 \cdots (n-1) \cdot n\)</span></div><div></div><div></div><div>The commands \overline and \underline create horizontal lines directly over or under an expression. &nbsp;</div><div><span class="math ltx_Math v1">\(0.\overline{3}\)</span></div><div></div><div>The commands \overbrace and \underbrace create long horizontal braces over or under an expression. &nbsp;</div><div>no \overbrace{a+b+c}</div><div>no \underbrace{a+b+c}</div><div></div><div>To add mathematical accents such as small arrows or tilde signs to variables, wide hats and tildes covering several characters are generated with \widetilde and \widehat.</div><div>The apostrophe mark ' gives a prime. &nbsp;</div><div><span class="math ltx_Math v1">\(f(x) = x^2\)</span></div><div><span class="math ltx_Math v1">\(f'(x) = 2x\)</span></div><div><span class="math ltx_Math v1">\(f''(x) = 2\)</span></div><div><span class="math ltx_Math v1">\(\hat{xy}\)</span></div><div>no \widehat{XY}</div><div><span class="math ltx_Math v1">\(\bar{x_0}\)</span></div><div><span class="math ltx_Math v1">\(\bar{x}_0\)</span></div><div></div><div>Vectors are often specified by adding small arrow symbols on the tops of variables. &nbsp;This is done with the \vec command. &nbsp;The two commands \overrightarrow and \overleftarrow are useful to denote the vector from A to B. &nbsp;</div><div><span class="math ltx_Math v1">\(\vec{a}\)</span></div><div><span class="math ltx_Math v1">\(\vec{AB}\)</span></div><div>no \overrightarrow{AB}</div><div><span class="math ltx_Math v1">\(\lim_{X \rightarrow 0} \frac{\sin x}{x}=1\)</span></div><div>no \DeclareMathOperator</div><div>no a\bmod b</div><div>no x\equiv a \pmod{b}</div><div></div><div>A built-up fraction is typeset with the \frac{...}{...} command. &nbsp;</div><div><span class="math ltx_Math v1">\(3/8\)</span></div><div><span class="math ltx_Math v1">\(\frac{3}{8}\)</span></div><div><span class="math ltx_Math v1">\(\tfrac{3}{8}\)</span></div><div>In text style:&nbsp;<span class="math ltx_Math v1">\(1\frac{1}{2}\)</span></div><div><span class="math ltx_Math v1">\(1\dfrac{1}{2}\)</span>&nbsp;hours</div><div></div><div>\partial command for partial derivatives is used.</div><div><span class="math ltx_Math v1">\(\sqrt{\frac{x^2}{k+1}}\)</span></div><div><span class="math ltx_Math v1">\(x^\frac{2}{k+1}\)</span></div><div><span class="math ltx_Math v1">\(\frac{\partial^2f} {\partial x^2}\)</span></div><div></div><div>To typeset binomial coefficients or similar structures, use the command \binom from amsmath.</div><div><span class="math ltx_Math v1">\(\binom{n}{k} = \binom{n-1}{k} + \binom{n-1}{k-1}\)</span></div><div>no f_n(x) \stackrel{*}{\approx} 1</div><div></div><div>The integral operator is generated with \int, the sum operator with \sum, and the product operator with \prod. &nbsp;The upper and lower limits are specified with ^ and _ like subscripts and superscripts. &nbsp;</div><div><span class="math ltx_Math v1">\(\sum_{i=1}^n\)</span></div><div><span class="math ltx_Math v1">\(\int_0^{\frac{\pi}{2}}\)</span></div><div><span class="math ltx_Math v1">\(\prod_\epsilon\)</span></div><div></div><div>LaTeX provides all sorts of symbols for bracketing and other delimiters. &nbsp;</div><div><span class="math ltx_Math v1">\({a,b,c} \neq \{a,b,c\}\)</span></div><div></div><div>If you put \left in front of an opening delimiter and \right in front of a closing delimiter, LaTeX will automatically determine the correct size of the delimiter. &nbsp;</div><div><span class="math ltx_Math v1">\(1 + \left(\frac{1}{1-x^{2}} \right)^3\)</span></div><div></div><div><b>3.4 Single Equations that are Too Long: multline</b></div><div>If an equation is too long, we have to wrap it somehow. &nbsp;Unfortunately, wrapped equations are usually less easy to read than not wrapped ones. &nbsp;To improve the readability, there are certain rules on how to do the wrapping:</div><ol><li>In general one should always wrap an equation before an equality sign or an operator.</li><li>A wrap before an equality sign is preferable to a wrap before any operator.</li><li>A wrap before a plus- or minus-operator is preferable to a wrap before a multiplication-operator.</li><li>Any other type of wrap should be avoided if at all possible.</li></ol><div>problems with multline<b>3.5 Multiple Equations</b>3.5.1 Problems with Traditional Commandsno \begin{align}no \begin{eqnarray}3.5.2 IEEEeqnarray EnvironmentThe IEEEeqnarray environment is a very powerful command with many options. &nbsp;First of all, in order to be able to use the IEEEeqnarray environment one needs to load the package IEEEtrantools. &nbsp;The strength of IEEEeqnarray is the ability to specify the number of columns in the equation array. &nbsp;3.5.3 Common Usage<b>3.6 Arrays and Matrices</b>To typeset arrays, use the array environment. &nbsp;It works somewhat similar to the tabular environment. &nbsp;The \\ command is used to break the line.<b>3.7 Spacing in Math Mode</b>If the spacing within formulae chosen by LaTeX is not satisfactory, it can be adjusted by inserting special commands. &nbsp;<span class="math ltx_Math v1">\(\int_1^2 \ln x \mathrm{d}x\)</span></div><div><span class="math ltx_Math v1">\(\int_1^2 \ln x \,\mathrm{d}x\)</span></div><div></div><div>3.7.1 Phantoms</div><div>When vertically aligned text using ^ and _ LaTeX is sometimes just a little too helpful. &nbsp;Using the \phantom command you can reserve space for characters that do not show up in the final output. &nbsp;</div><div><span class="math ltx_Math v1">\({}^{14}_{6}\text{C}\)</span>&nbsp;vs.&nbsp;<span class="math ltx_Math v1">\({}^{14}_{\phantom{1}6}\text{C}\)</span></div><div></div><div><b>3.8 Fiddling with the Math Fonts</b></div><div>Changing styles generally affects the way big operators and limits are displayed. &nbsp;</div><div></div><div>3.8.1 Bold Symbols</div><div>It is quite difficult to get bold symbols in LaTeX; this is probably intentional as amateur typesetters tend to overuse them. &nbsp;The font change command \mathbf gives bold letters, but these are roman (upright) whereas mathematical symbols are normally italic, and furthermore it doesn't work on lower case Greek letters. &nbsp;There is a \boldmath command, but this can only be used outside math mode. &nbsp;</div><div></div><div>\mu, M&nbsp;<span class="math ltx_Math v1">\(\mu, M\)</span></div><div>\mathbf{\mu}, \mathbf{M}&nbsp;<span class="math ltx_Math v1">\(\mathbf{\mu}, \mathbf{M}\)</span></div><div>no \boldmath{$\mu, M}&nbsp;</div><div></div><div><b>3.9 Theorems, Lemmas,...</b></div><div><b></b>When writing mathematical documents, you probably need a way to typeset "Lemmas", "Definitions", Axioms" and similar structures.</div><div>\newtheorem{name}[counter]{text}[section]</div><div>The name argument is a short keyword used to identify the "theorem". &nbsp;With the text argument you define the actual name of the "theorem", which will be printed in the final document. &nbsp;The arguments in square brackets are optional. &nbsp;They are both used to specify the numbering used on the "theorem". &nbsp;Use the counter argument to specify the name of a previously declared "theorem". &nbsp;The new "theorem" will then be numbered in the same sequence. &nbsp;The section argument allows you to specify the sectional unit within which the "theorem" should get its numbers. &nbsp;</div><div></div><div>3.9.1 Proofs and End-of-Proof Symbol</div><div>The amsthm package also provides the proof environment.</div><div></div><div><b>3.10 List of Mathematical Symbols</b></div><div>An even more comprehensive list of symbols can be found at CTAN:info/symbols/comprehensive</div>