Sie sind auf Seite 1von 11

Review

I picinpar: the window environment


I parbox and the minipage environment
LATEX Seminar: Summer Semester, 2009 I the letter class file;
\address, \name, \date, \signature the letter
environment; \opening, \closing, \location,
Clifford E. Weil1 \telephone,\cc, \encl, \makelables
1 Departmentof Mathematics I the msuphdthesis class; list of figures, and the bibliography
Michigan State University I the beamer class file;
East Lansing, MI USA
weil@math.msu.edu I preamble: \title, \author, \inst, \institute, \date
I frames; \titlepage, \tableofcontents
June 17, 2009 I beamer commands:
\alert, \againframe, \begin{columns} with \cloumn
and overlay specifications
I slides; \pause, \only, \onslide and \beamercovered
I navigation bar
I beamer themes

Text Mode vs Math Mode Entering Mathematical and Technical Expressions


In text mode the default font in most classes (not beamer) is Before typing material of a technical nature, load the packages
Roman/upright/medium. In math mode the default is amsmath, amssymb and amsthm. ALL characters used as
Roman/italics/medium. Compare text mode, f(x), to math mode mathematical symbols should be typed in math mode. For example
f (x ). if the letter v is to be used to denote velocity, type, “Let $v$ be
Also when typing in math mode, either in line or display, all spaces the velocity of the particle.” so it comes out as “Let v be the
are ignored as is one carriage return. But two or more consecutive . . . ”, rather than, “Let v be the . . . ”. When in math mode use the
carriage returns will result in an error message. LATEX knows how commands for the common functions such as sine, logarithm etc.
much horizontal space to put between consecutive alphabetic For example type, “Let $f(x)=\sin x$, which produces, “Let
characters and how much space to put before and after such f (x )= sin x ”. When in math mode a word or abbreviation should
symbols such as <, >, =, etc. One exception is the small amount be entered as regular (not math) text using the \text command.
Rof space that the user should insert before a differential such as in For example, type the $n^\text{th}$ term to get, “the n th
f (x ) dx done by typing $\int f(x)\, dx$. term”.
Typesetting Fractions Typesetting Binomial Coefficients
The basic command to produce a fraction, which can only be used Recall the conclusion of the Binomial Theorem.
in math mode, is $\frac{numerator }{denominator }$. In a case n  
2
such as $\frac{x^2}{z^e}$ the output zx e can be difficult to
X n k n−k
(b + a)n = b a
read. To use a larger font size, the one used in display math mode, k
k=1
x2
type instead $\dfrac{x^2}{z^e}$, which produces e and is the The so-called binomial coefficients are produced in a fashion
z
same as in display mode, $$\frac{x^2}{z^e}$$. To produce the analogous to fractions. Specifically $\binom{m}{n}$
  produces
smaller version in display mode type $$\tfrac{x^2}{z^e}$$. m
 m
Compare n while $\dbinom{m}{n}$ produces . Likewise in display
 n
x2 2 m
to zx e . mode $$\binom{m}{n}$$ produces and
ze  n
m
$$\tbinom{m}{n}$$ produces n .

Modular Equivalence Typesetting Roots


LATEX provides four different way to express that x and y are Square roots are produced, only in math mode, with the command
equivalent modulo a positive integer n; that is, y−x = kn for $\sqrt{expression}$.
√ For example typing $\sqrt{x^3-8}$
some integer (positive or negative) k . They are presented in the produces x 3 − 8 for math modep in line and typing
following table. $$\sqrt{x^3-8}$$ produces x 3 − 8 in display math mode.
Note the extra space at the top of the expression. An optional
Typing Produces
argument for the command produces general
√ roots. For example
x\equiv y \mod{n} x ≡ y mod n
typing $\sqrt[7]{x^3-8}$ produces 7 x 3 − 8 forpmath mode in
x\equiv y \bmod{n} x ≡ y mod n 7
line and typing $$\sqrt[7]{x^3-8}$$ produces x 3 − 8 in
x\equiv y \pmod{n} x ≡ y (mod n)
display math mode.
x\equiv y \pod{n} x ≡ y (n)
Display Style in Line Matrices: Introduction
It’s possible to produce the display version of any mathematical The matrix environments are: matrix, pmatrix, bmatrix,
expression appearing in line with the declaration \displaystyle.
p Bmatrix, vmatrix, Vmatrix, and smallmatrix. The first 5
3 use the same syntax. For example
For example √ $\displaystyle\sqrt{x^3-8}$ produces x − 8
instead of x 3 − 8. The scope of the declaration can be limited to produce type
using a pair of braces. For example
1 2 3 4 $$\begin{matrix}
${\displaystyle\sqrt{x^3-8}}\;\frac{2}{3}$ which
p a b c d 1&2&3&4\\
produces x 3 − 8 23 .
−3 −2 −1 0 a&b&c&d\\
-3&-2&-1&0
\end{matrix}$$

If typed in line, the baseline of the line will be alined with the
center of the matrix. No optional argument is available to change
the alignment.

Matrix Examples Dots in Matrices


The first three matrices below were produced with the pmatrix Dots are often used in matrices. For example
the bmatrix and the Bmatrix environments. This matrix is produced by typing
 
a1 a2 . . . an
     
1 2 3 4 1 2 3 4 1 2 3 4 $\begin{matrix}
a . . . . . . . . . . . . . . . . .
b c d  a b c d a b c d a_1&a_2&\dots&a_n\\%a_1&a_2&\dots&a_{n}\\
x1 x2 . . . xn
−3 −2 −1 0 −3 −2 −1 0 −3 −2 −1 0 \hdotsfor{4}\\
 
x_1&x_2&\dots&x_{n}
The next two examples were produced with the vmatrix and the \end{matrix}$
Vmatrix environments. Other dot command that can be used as entries in a matrix are
\vdots and \ddots for vertical and diagonal dots respectively.
1 2 3 4 1 2 3 4

a b c d a b c d

−3 −2 −1 0 −3 −2 −1 0
The smallmatrix Environment Single Line Displayed Formulas
The smallmatrix environment is intended for inline matrices. The easiest method to produce single line, unnumbered, displayed
The user must select in what delimiters (if any) the matrix will be formulas is with the formula bracketed by $$ and $$. For example
the displayed formula in an earlier slide,
1 2 3 4
enclosed. For example a b c d is produced by typing

−3 −2 −1 0
$\left|\begin{smallmatrix}1&2&3&4\\a&b&c&d (a+b)3 = a 3 + 3a 2 b + 3ab 2 + b 3 .
\\-3&-2&-1&0\end{smallmatrix}\right|$. (The \left and
\right commands are explained in the next frame.) The matrix was produced by typing
can be moved up or down with the \raisebox command
$$ (a+b)^3=a^3+3a^2b+ab^2+b^3. $$

Numbered formulas and multi-line formulas require special


environments, which are made available by the amsmath package.

The Displayed Formula Environments Numbering a Single Line Displayed Formula


The amsmath package provides environments that can be used to The equation environment is used to produce a single line,
display mathematical expression. numbered equation. Loading the {amsmath} package
Those that number displays are: Those that don’t number displays automatically creates the equation environment. So in the body
1. equation are: of the document type the formula inside an equation
5. equation* environment. For example
2. align
3. gather 6. align* \begin{equation}\label{eq1}
4. multline 7. gather* (a+b)^3= a^3+3a^2b+3ab^2+b^3
8. multline* \end{equation}
9. split produces
Numbers for any numbered formula come from the counter (a+b)3 = a 3 + 3a 2 b + 3ab 2 + b 3 (1)
equation.
Multi-Lined Displayed Formulas with align An align Example
The align environment is the one most frequently used for Typing
multi-lined formulas or expressions. Each line (except the last) is
ended with a \\ and an & in each line denotes the point of \begin{align}
alignment. In addition each line in the expression is assigned a \sin(x+\frac{\pi}{2})&=\sin x\cos\frac{\pi}{2}+
number. The & should always be placed before an relational \cos x\sin\frac{\pi}{2}\label{eq1}\\
symbol such as =, <, ≤, etc. Because each line is numbered, each &=\cos x\label{eq2}
line can be assigned a label. The \begin{align} automatically \end{align}
begins math mode; consequently don’t insert any dollar signs. produces
The numbers for all displayed equations come from the counter,
π π π
equation. sin(x + ) = sin x cos + cos x sin (2)
2 2 2
= cos x (3)

To eliminate all numbers, replace align with align*.

Multi-Lined Formula with One Number A Better Way


Numbering every line of a multi-lined formula is often excessive. An often better method to assign a single number to a multi-line
The number at the end of any line may be eliminated with the expression is to combine the equation environment with the
command \notag before the \\ command. For example typing split environment. The split environment must be used in
conjunction with another environment, usually the equation
\begin{align} environment. It works the same way that the align environment
\sin(x+\frac{\pi}{2})&=\sin x\cos\frac{\pi}{2}+ works as will be demonstrated in the following example.
\cos x\sin\frac{\pi}{2}\notag\\
&=\cos x\label{eq3}
\end{align}

produces
π π π
sin(x + ) = sin x cos + cos x sin
2 2 2
= cos x (4)
A split Environment Example Locating and Changing the Tags
For example typing Equations, like assertions, may be numbered according to the
section in which they appear with the preamble command
\begin{equation}\label{eq4} \numberwithin{equation}{section}
\begin{split} The user may override the number tags with a personal choice
\sin(x+\frac{\pi}{2})&=\sin x\cos\frac{\pi}{2}+ using the command \tag{label} or \tag*{label}. These
\cos x\sin\frac{\pi}{2}\\ commands are placed before the \\ command. The first results in
&=\cos x the user’s choice surrounded by parentheses while the second omits
\end{split} the parentheses.
\end{equation} By choosing the option[tbtags] for the amsmath package the
produces number in the preceding example is moved to the bottom of the
displayed formula (and flush to the right margin), or if, in addition
π π π the option [leqno] for the documentclass has been selected, the
sin(x + ) = sin x cos + cos x sin
2 2 2 (5) number will appear at the top flush with the left margin.
= cos x

BREAK TIME!!

Other Multi-Lined Environments Two or More Columns of Equations


The gather and gather* environments center all lines and, in the The align and align* environments may be used to align the
case of gather, numbers each line. The multline and equations (or expressions) in two or more columns of equations (or
multline* environments place the first line flush to the left expressions). The first & aligns the equations in the first column
margin, place the last line flush to the right margin and centers all and the second & separates the first and second columns while the
other lines. In the case of multline a number appears after the next & aligns the equations in the second column, etc.
last line flush to the right margin unless the class option leqno has
been selected in which case the number is placed before the first
line flush with the left margin. The alignment character & must
not appear in any line of any of these environments.
A Two Column Example Alternate Numbering
For example typing When the expressions are closely related as in the previous
example, it’s convenient to have a method of numbering them to
\begin{align*} reflect that fact. The subequations environment provides this
6&\equiv 0\bmod{6}&9&\equiv 3\bmod{6}\\ method. To produce
7&\equiv 1\bmod{6}&10&\equiv 4\bmod{6}\\
8&\equiv 2\bmod{6}&11&\equiv 5\bmod{6}\\ sin(x ± y) = sin x cos y ± cos x sin y (6a)
\end{align*} cos(x ± y) = cos x cos y ∓ sin x sin y (6b)
produces
type
6 ≡ 0 mod 6 9 ≡ 3 mod 6 \begin{subequations}
7 ≡ 1 mod 6 10 ≡ 4 mod 6 \begin{align}
8 ≡ 2 mod 6 11 ≡ 5 mod 6 \sin(x \pm y)&=\sin x \cos y \pm\cos x \sin y \\
\cos(x \pm y)&=\cos x \cos y \mp\sin x \sin y
\end{align}
\end{subequations}

The \intertext Command Spacing Hint


The command\intertext{text to insert} is used to insert a line When aligning on a relationship and a line must be broken before
or more of text between lines of any of the multi-lined the next relationship, break and align on a + or −, but put extra
environments introduced. For example space after the &. For example to produce
to produce type
(a + b + c) × (A + B + C ) = aA + aB + aC + bA + bB + bC
f (x ) = x 2 \begin{align*} + cA + cB + cC
f(x)&= x^2
and \intertext{and} type
g(x)&=6x-7
g(x ) = 6x − 7 \end{align*} \begin{align*}
(a+b+c)\times(A+B+C)&=aA+aB+aC+bA+bB+cB\\
Note that there is no newline command after the first formula nor
&\phantom{=}+cA+cB+cC
after the intertext command.
\end{align*}
The aligned and gathered Environments An aligned Example
Unlike the previous environments, these two can be used in line For example the sentence
and don’t automatically change to math mode. Hence each must u xx + u yy = 0 for x 2 + y 2 < 1
“The pair is a boundary value
be preceded with a $. The formatting rules for each of these u(x,y) = f (x,y) for x 2 + y 2 = 1
environments are the same as those of their namesakes. The problem.”
example to follow uses the command \text which is a convenient is produced by typing
way to insert text mode text while in math mode. Note that the
extra space needed to separate x from the text is done with a The pair
space in the argument of \text where a space is recognized. $\begin{aligned}
u_{xx}+u_{yx}&=0\text{ for }x^2+y^2<1\\
u(x,y)&=\f(x,y)\text{ for }x^2+y^2=1
\end{aligned}$ is a boundary value problem.

The gathered environment works the same way.

The cases Environment An All to Common Problem


To produce the type of structure Sometimes when trying to number a multi-line expression, the
( following situation occurs.
0 if x is a rational number
f (x ) = Z b
1 if x is an irrational number π (R(x ))2 − (r (x ))2 dx

Volume of solid =
a
type Z 1
π (−x + 3)2 − (x 2 + 1)2 dx

=
$$f(x)=\begin{cases} −2
Z1
0&\text{if } x \text{ is a rational number}\\
= π(8 − 6x − x 2 − x 4 ) dx
1&\text{if } x \text{ is an irrational number} −2
\end{cases}$$ h x 3 x 5 i1 117π
= π 8x − 3x 2 − − = = 23.4 × π
The cases environment can be used in line in the same way as the 3 5 −2 5
(7)
aligned environment.
The Solution: The Command \raisetag The Result
The command \raisetag{length} can be used to force LATEX to
put the tag where it should be. Specifically type Z b
π (R(x ))2 − (r (x))2 dx

Volume of solid =
\begin{equation}\label{eq6} a
\begin{split} Z 1
π (−x + 3)2 − (x 2 + 1)2 dx

\text{\textit{Volume of solid}}&=\int_a^b \pi =
−2
\big((R(x))^2-(r(x))^2\big)\,dx\\ Z1
(7)
&=\int_{-2}^1\pi\big((-x+3)^2-(x^2+1)^2\big)\,dx\\ = π(8 − 6x − x 2 − x 4 ) dx
&=\int_{-2}^1\pi(8-6x-x^2-x^4)\,dx\\ −2
&=\pi\Big[8x-3x^2-\frac{x^3}{3}-\frac{x^5}{5}\Big]_{-2}^1
h x 3 x 5 i1 117π
= π 8x − 3x 2 − − = = 23.4 × π
=\frac{117\pi}{5}=23.4\times \pi 3 5 −2 5
\raisetag{4\baselineskip}
\end{split}
\end{equation}

Stating Assertions with the amsthm Package Creating a New Environment


The amsthm package several new environments available for For example placing \newtheorem{theorem}{Theorem} in the
producing assertions such as definitions, lemmas, propositions, preamble creates a new environment theorem whose designation is
theorems, and remarks, etc. with either of two commands Theorem and a new counter called theorem. In the body of the
\newtheorem or \newtheorem*. Each has two mandatory document when \begin{theorem} is typed, LATEX produces,
arguments and the first command has two optional ones as well. Theorem followed by a number identifying the theorem; 1 for the
Both commands must occur in the preamble. In its simplest form first use, 2 for the second, etc. The numbers are assigned from the
the first command has the form counter named theorem. Any assertion can be referred to at any
\newtheroem{environment name}{assertion designation}. This point in the text by including the command
action also creates a counter named environment name. \label{statement name}.
A Simple Example A Numbering Option
For example typing In the case of a long article containing numerous theorems,
numbering them consecutively can become unruly. In such a
\begin{theorem}\label{th1} situation numbering them according to section is an attractive
This is the first theorem. alternative. To do so add the option [section] to the command
\end{theorem} creating the environment. Specifically in the preamble type
\begin{theorem}\label{th2} \newtheorem{theorem}{Theorem}[section]. (The position of
This is the second theorem. this option is important.) Assuming the theorems are being
\end{theorem} created in the fourth section the outcome would be
produces Theorem 4.1. This is the first theorem.
Theorem 1. This is the first theorem. Theorem 4.2. This is the second theorem.
Theorem 2. This is the second theorem.

Additional Types of Assertions Numbering Lemmas and Theorems Consecutively


To include lemmas as well as theorems in the preamble type Using the option [theorem] causes lemmas to be numbered using
\newtheorem{lemma}{Lemma}. Then in the document typing the same counter that numbers theorems; specifically
\newtheorem{lemma}[theorem]{Lemma}. (Note the different
\begin{lemma}\label{lem1} location of the option.) Then what might be seen is
This is the first lemma.
\end{lemma} Lemma 1. This is the first lemma.
Theorem 2. This is the first theorem.
produces
Theorem 3. This is the second theorem.
Lemma 1. This is the first lemma.
If theorems are numbered according to section number, the same
Of course this particular \newtheorem command produces a new
would be true of lemmas. Additional assertions such as
environment and a new counter each named lemma.
propositions and corollaries may also be numbered using the same
counter as is used by theorem. With an optional argument in the
position of this one, no new counter is created.
Other Styles Numbering and Styles
The amsthm package also provides two additional theorem styles An assertion can be numbered with another assertion’s counter
besides the default one already exhibited. They are definition and even if the two assertions are in different styles. For example
remark. They are changed in the preamble by typing typing in the preamble
\theoremstyle{style} before the \newtheorem command that
creates the assertion type. For example typing \newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\theoremstyle{definition} \newtheorem{definition}theorem]{Definition}
\newtheorem{definition}{Definition}
\theoremstyle{remark} could produce something like
\newtheorem{remark}{Remark} Definition 3.1. This assertion is in definition style.
permits Theorem 3. 2. This assertion is in theorem style.
Definition 1. This is an assertion in definition style.
Remark 1. This is an assertion in remark style.

Named Assertions An Option for All Assertion Environments


The preamble command \newtheorem* is used to produce All of the environments created with either of the preamble
assertions that are named rather than numbered. Consequently it commands \newtheorem or \newtheorem* have an optional
produces a new environment, but no new counter. These assertion argument that can be used for inserting additional information
can have any theorem style desired. This command permits only about the assertion before its statement. For example, typing
two mandatory arguments. For example the command
\newtheorem*{WO}{Well Ordering Principle} allows the \begin{lemma}[see \cite{T}]
typing of If $f$ is differentiable at $x$, then $f$ is
continuous at $x$.
\begin{WO} \end{lemma}
Every non-empty set can be well-ordered.
\end{WO} will produce
Lemma 2. (see [7]) If f is differentiable at x, then f is
to produce
continuous at x.
Well Ordering Principle. Every non-empty set can be
assuming that the famous text book by George Thomas is the
well-ordered.
seventh item in the bibliography and that the default method of
identifying bibliographic references is used.

Das könnte Ihnen auch gefallen