Eric Partlo edited Chapter_3_Typesetting_Mathematical_Formulae3__.html  over 3 years ago

Commit id: 4cb14abe4111f2ba3a461196a8088c3487e8f3f1

deletions | additions      

       

Chapter 3 - Typesetting Mathematical Formulae

3.1 Formulae
3.1  The AMS-LATEX bundle
If bundle
If  you want to typeset (advanced) mathematics, you should use AMS-LATEX.  The AMS-LATEX bundle is a collection of packages and classes for mathematical typesetting.  AMS-LATEX is produced by The American Mathematical Society and it is used extensively for mathematical typesetting.  LATEX itself does provide some basic features and environments for mathematics, but they are limited and in some cases inconsistent.  

AMS-LATEX  
AMS-LATEX  is a part of the required distribution and is provided with all recent LATEX distributions.  We assume amsmath is loaded in the preamble; \usepackage{amsmath}.

3.2 \usepackage{amsmath}.
3.2  Single Equations
Equations
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).  Mathematical equations within a paragraph are entered between $ and $.
\(a^2  + b^2 = c^2">\(a^2 + b^2 = c^2\)
\(\lim_{x c^2\)
\(\lim_{x  \to 2} f(x) = 5\)
\(\lim_{n 5\)
\(\lim_{n  \to \infty} \sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6}\)

If \frac{\pi^2}{6}\)
If  you want to name the equation something specific, you \tag it instead.

3.2.1 instead.
3.2.1  Math Mode
There Mode
There  are also differences between math mode and text mode.  For example, in math mode:
  1. Most mode:
    1. 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
    2. Empty \qquad
    3. Empty  lines are not allowed.  Only one paragraph per formula.
    4. Each formula.
    5. Each  letter is considered to be the name of a variable and will be typeset as such.  

    \(\forall  x \in \mathbf{R}: \qquad x^{2} \geq 0">\(\forall x \in \mathbf{R}: \qquad x^{2} \geq 0\)
    \(x^{2} 0\)
    \(x^{2}  \geq 0\qquad \text{for all }x\in\mathbf{R}\)

    3.3 }x\in\mathbf{R}\)
    3.3  Building Blocks of a Mathematical Formula
    Most Formula
    Most  of the commands in this section will not require amsmath, but load it anyways.  

    Lowercase  
    Lowercase  Greek Letters are entered as \alpha, \beta, \gamma, and uppercase letters are entered as \Gamma, \Delta, ...
    \(\lambda,  \xi, \pi, \theta, \mu, \Phi, \Omega, \Delta">\(\lambda, \xi, \pi, \theta, \mu, \Phi, \Omega, \Delta\)

    Exponents, \Delta\)
    Exponents,  Superscripts, and Subscripts can be specified using the ^ and _ characters.  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: {...}.  
    \(p^3_{ij}\)
    \(m_\text{Knuth}\)
    \(\sum_{k=1}^3 k\)
    \(p^3_{ij}\)
    \(m_\text{Knuth}\)
    \(\sum_{k=1}^3 k\)
    \(a^x+y  \neq a^{x+y}">\(a^x+y \neq a^{x+y}\)
    \(e^{x^2}\)
    \({e^x}^2\)

    The a^{x+y}\)
    \(e^{x^2}\)
    \({e^x}^2\)
    The  square root is entered as \sqrt; the nth root is generated with \sqrt[n].  The size of the root sign is determined automatically by LaTeX.  
    \(\sqrt{x}  
    \(\sqrt{x}  \Leftrightarrow x^{1/2}\)
    \(\sqrt[3]{2}\)
    \(\sqrt{x^{2} x^{1/2}\)
    \(\sqrt[3]{2}\)
    \(\sqrt{x^{2}  + \sqrt{y}}\)
    \(\surd[x^2  + y^2]">\(\surd[x^2 + y^2]\)

    The y^2]\)
    The  dot sign to indicate the multiplication operation is normally left out, it is sometimes written tho help the eye in grouping a formula.  Use \cdot to typeset a single centered dot.  \cdots is three centered dots while \ldots sets the dots low (on the baseline).  Besides that, there are \vdots for vertical and \ddots for diagonal dots.  
    \(\Psi  
    \(\Psi  = v_1 \cdot v_2 \cdot \ldots\)
    \(n!  = 1 \cdot 2 \cdots (n-1) \cdot n">\(n! = 1 \cdot 2 \cdots (n-1) \cdot n\)


    The n\)
    The  commands \overline and \underline create horizontal lines directly over or under an expression.  
    \(0.\overline{3}\)

    The  
    \(0.\overline{3}\)
    The  commands \overbrace and \underbrace create long horizontal braces over or under an expression.  
    no \overbrace{a+b+c}
    no \underbrace{a+b+c}

    To  
    no \overbrace{a+b+c}
    no \underbrace{a+b+c}
    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.
    The \widehat.
    The  apostrophe mark ' gives a prime.  
    \(f(x) = x^2\)
    \(f(x)  = 2x">\(f'(x) x^2\)
    \(f'(x)  = 2x\)
    \(f''(x)  = 2">\(f''(x) = 2\)
    \(\hat{xy}\)
    no \widehat{XY}
    \(\bar{x_0}\)
    \(\bar{x}_0\)

    Vectors 2\)
    \(\hat{xy}\)
    no \widehat{XY}
    \(\bar{x_0}\)
    \(\bar{x}_0\)
    Vectors  are often specified by adding small arrow symbols on the tops of variables.  This is done with the \vec command.  The two commands \overrightarrow and \overleftarrow are useful to denote the vector from A to B.  
    \(\vec{a}\)
    \(\vec{AB}\)
    no \overrightarrow{AB}
    \(\lim_{X  
    \(\vec{a}\)
    \(\vec{AB}\)
    no \overrightarrow{AB}
    \(\lim_{X  \rightarrow 0} \frac{\sin x}{x}=1\)
    no \DeclareMathOperator
    no x}{x}=1\)
    no \DeclareMathOperator
    no  a\bmod b
    no b
    no  x\equiv a \pmod{b}

    \pmod{b}
    A  built-up fraction is typeset with the \frac{...}{...} command.  
    \(3/8\)
    \(\frac{3}{8}\)
    \(\tfrac{3}{8}\)
    In  
    \(3/8\)
    \(\frac{3}{8}\)
    \(\tfrac{3}{8}\)
    In  text style: class="ltx_Math" contenteditable="false" data-equation="1\frac{1}{2}">\(1\frac{1}{2}\)
    \(1\dfrac{1}{2}\) hours

    \partial class="math ltx_Math v1">\(1\frac{1}{2}\)
    \(1\dfrac{1}{2}\) hours
    \partial  command for partial derivatives is used.
    \(\sqrt{\frac{x^2}{k+1}}\)
    \(x^\frac{2}{k+1}\)
    \(\sqrt{\frac{x^2}{k+1}}\)
    \(x^\frac{2}{k+1}\)
    \(\frac{\partial^2f}  {\partial x^2}">\(\frac{\partial^2f} {\partial x^2}\)

    To x^2}\)
    To  typeset binomial coefficients or similar structures, use the command \binom from amsmath.
    \(\binom{n}{k} amsmath.
    \(\binom{n}{k}  = \binom{n-1}{k} + \binom{n-1}{k-1}\)
    no \binom{n-1}{k-1}\)
    no  f_n(x) \stackrel{*}{\approx} 1

    The 1
    The  integral operator is generated with \int, the sum operator with \sum, and the product operator with \prod.  The upper and lower limits are specified with ^ and _ like subscripts and superscripts.  
    \(\sum_{i=1}^n\)
    \(\int_0^{\frac{\pi}{2}}\)
    \(\prod_\epsilon\)

    LaTeX  
    \(\sum_{i=1}^n\)
    \(\int_0^{\frac{\pi}{2}}\)
    \(\prod_\epsilon\)
    LaTeX  provides all sorts of symbols for bracketing and other delimiters.  
    \({a,b,c}  \neq \{a,b,c\}">\({a,b,c} \neq \{a,b,c\}\)

    If \{a,b,c\}\)
    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.  
    \(1  
    \(1  + \left(\frac{1}{1-x^{2}} \right)^3\)

    3.4 \right)^3\)
    3.4  Single Equations that are Too Long: multline
    If multline
    If  an equation is too long, we have to wrap it somehow.  Unfortunately, wrapped equations are usually less easy to read than not wrapped ones.  To improve the readability, there are certain rules on how to do the wrapping:
    1. In wrapping:
      1. In  general one should always wrap an equation before an equality sign or an operator.
      2. operator.
      3. A  wrap before an equality sign is preferable to a wrap before any operator.
      4. operator.
      5. A  wrap before a plus- or minus-operator is preferable to a wrap before a multiplication-operator.
      6. Any multiplication-operator.
      7. Any  other type of wrap should be avoided if at all possible.
      problems possible.
    problems  with multline

    3.5 multline3.5  Multiple Equations
    3.5.1 Equations3.5.1  Problems with Traditional Commands

    no \begin{align}
    no \begin{eqnarray}

    3.5.2 Commandsno \begin{align}no \begin{eqnarray}3.5.2  IEEEeqnarray Environment
    The EnvironmentThe  IEEEeqnarray environment is a very powerful command with many options.  First of all, in order to be able to use the IEEEeqnarray environment one needs to load the package IEEEtrantools.  The strength of IEEEeqnarray is the ability to specify the number of columns in the equation array.  

    3.5.3  3.5.3  Common Usage

    3.6 Usage3.6  Arrays and Matrices
    To MatricesTo  typeset arrays, use the array environment.  It works somewhat similar to the tabular environment.  The \\ command is used to break the line.

    3.7 line.3.7  Spacing in Math Mode
    If ModeIf  the spacing within formulae chosen by LaTeX is not satisfactory, it can be adjusted by inserting special commands.  
    \(\int_1^2 \ln x \mathrm{d}x\)
    \(\int_1^2  \ln x \,\mathrm{d}x">\(\int_1^2 \mathrm{d}x\)
    \(\int_1^2  \ln x \,\mathrm{d}x\)

    3.7.1 Phantoms
    When \,\mathrm{d}x\)
    3.7.1 Phantoms
    When  vertically aligned text using ^ and _ LaTeX is sometimes just a little too helpful.  Using the \phantom command you can reserve space for characters that do not show up in the final output.  
    \({}^{14}_{6}\text{C}\) vs. \({}^{14}_{\phantom{1}6}\text{C}\)

    3.8  
    \({}^{14}_{6}\text{C}\) vs. \({}^{14}_{\phantom{1}6}\text{C}\)
    3.8  Fiddling with the Math Fonts
    Changing Fonts
    Changing  styles generally affects the way big operators and limits are displayed.  

    3.8.1  
    3.8.1  Bold Symbols
    It Symbols
    It  is quite difficult to get bold symbols in LaTeX; this is probably intentional as amateur typesetters tend to overuse them.  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.  There is a \boldmath command, but this can only be used outside math mode.  

    \mu,  
    \mu,  M class="ltx_Math" contenteditable="false" data-equation="\mu, M">\(\mu, M\)
    \mathbf{\mu}, class="math ltx_Math v1">\(\mu, M\)
    \mathbf{\mu},  \mathbf{M} class="ltx_Math" contenteditable="false" data-equation="\mathbf{\mu}, \mathbf{M}">\(\mathbf{\mu}, \mathbf{M}\)
    no class="math ltx_Math v1">\(\mathbf{\mu}, \mathbf{M}\)
    no  \boldmath{$\mu, M} 

    3.9 M} 
    3.9  Theorems, Lemmas,...
    When Lemmas,...
    When  writing mathematical documents, you probably need a way to typeset "Lemmas", "Definitions", Axioms" and similar structures.
    \newtheorem{name}[counter]{text}[section]
    The structures.
    \newtheorem{name}[counter]{text}[section]
    The  name argument is a short keyword used to identify the "theorem".  With the text argument you define the actual name of the "theorem", which will be printed in the final document.  The arguments in square brackets are optional.  They are both used to specify the numbering used on the "theorem".  Use the counter argument to specify the name of a previously declared "theorem".  The new "theorem" will then be numbered in the same sequence.  The section argument allows you to specify the sectional unit within which the "theorem" should get its numbers.  

    3.9.1  
    3.9.1  Proofs and End-of-Proof Symbol
    The Symbol
    The  amsthm package also provides the proof environment.

    3.10 environment.
    3.10  List of Mathematical Symbols
    An Symbols
    An  even more comprehensive list of symbols can be found at CTAN:info/symbols/comprehensive
     CTAN:info/symbols/comprehensive