### 3 Typesetting Mathematics: Part II

#### 3.1 Text in Mathematics

• \textrm can not be used in math mode
• \mathrm is not appropriate:

Input:

 $\mathrm{see why?}$

Output:

• Use \mbox; this takes you out of math mode.

Input:

 For nonzero integers $x$, $y$, $z$, and $n$,   where $n > 2$, there are no solutions to the   equation   $x^{n} + y^{n} = z^{n} \quad \mbox{(proof is obvious)}$

Output:

• Alternatively, use the \text command of the amsmath package. This command also deals appropriately with textual subscritps. Compare

Input:

 $I_{\mbox{\scriptsize Na}}$

Output:

with

Input:

 $I_{\text{Na}}$

Output:

#### 3.2 Multiple Equations

Use the eqnarray environment:

Input:

 \begin{eqnarray}      \frac{du}{dt} & = & u + v^2 \\      \frac{dv}{dt} & = & v - u   \end{eqnarray}

Output:

eqnarray* works like the eqnarray environment, except equations are not numbered.

#### 3.3 Multi-line Equation

Use the eqnarray environment for this as well:

Input:

 \begin{eqnarray}      (x + y)^6         & = & x^6 + 6 x^5 y + 15 x^4 y^2               + 20 x^3 y^3 \nonumber \\         &   & \mbox{} + 15 x^2 y^4               + 6 x y^5 + y^6   \end{eqnarray}

Output:

#### 3.4 Subordinate Equation Numbering; Arbitrary Equation Numbers

Standard LaTeX provides equation numbers such as (3), (5.2), etc. But what about (3a), (3b), (5.2*)?

Use the amsmath package:

Input:

 \begin{subequations}   \label{eq:group}   \begin{align}      \frac{du}{dt} &= u + v^2 \label{eq:part1} \\      \frac{dv}{dt} &= v - u \label{eq:part2}   \end{align}   \end{subequations}   The second equation is \eqref{eq:part2},   while the entire group is \eqref{eq:group}.   Here's an equation with an arbitray number:         a^{2} + b^{2} = c^{2} \tag{5*}

Output:

#### 3.5 Bold Greek Letters

• \mathbf only changes the style of letters, numbers, and uppercase Greek letters to bold, plus it switches to an upright font.
• \boldmath declaration causes everything in a formula to be bold. However, it cannot be used in math mode!

##### 3.5.1 Example 1

Input:

 \boldmath   $f + 2^x \beta - \beta$

Output:

##### 3.5.2 Example 2

Input:

 $\mathbf{f} + 2^x \mbox{\boldmath \beta} - \beta$

Output:

Define a new command:

\newcommand{\bbeta}{\mbox{\boldmath $\beta$}}

Or more generic:

\newcommand{\bm}[1]{\mbox{\boldmath $#1$}}

##### 3.5.3 Example 3

Input:

 $\bm{y} = \bbeta \cdot \bm{x} + \bm{\epsilon}$

Output:

Alternatively, use the \boldsymbol command of the amsmath package.

Input:

 $A \boldsymbol{x} = \boldsymbol{b}$

Output:

_______________________________________________________
Last updated: October 27, 2002
Site maintained by: Clyde Clements clyde@mathstat.dal.ca