28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12.2. St<strong>and</strong>ard features of A M S-L AT E X 265<br />

which functions in the same way as \frac <strong>and</strong> the other fraction comm<strong>and</strong>s.<br />

<br />

\[ \binom{n+1}{k} = \binom{n}{k} n + 1 n n<br />

= +<br />

+ \binom{n}{k-1 \]<br />

k k k − 1<br />

Similarly there are the comm<strong>and</strong>s \tbinom <strong>and</strong> \dbinom analogous <strong>to</strong><br />

\tfrac <strong>and</strong> \dfrac.<br />

User-defined fractions<br />

The amsmath package provides a powerful <strong>to</strong>ol for defining fraction-like<br />

structures:<br />

\genfrac{left brk}{right brk}{thickness}{mathsize}{over}{under}<br />

where left brk <strong>and</strong> right brk are the parenthesis characters on the left <strong>and</strong><br />

right, thickness is the thickness of the horizontal line, <strong>and</strong> {mathsize} is<br />

a number 0–3 representing the math sizes \displaystyle, \textstyle,<br />

\scriptstyle, <strong>and</strong> \scriptscriptstyle, respectively. The last two<br />

arguments, over <strong>and</strong> under, are the texts in the two parts of the fraction,<br />

the same arguments as in \frac <strong>and</strong> \binom.<br />

If the thickness is left blank, the st<strong>and</strong>ard thickness for L AT E X fractions<br />

is used. If mathsize is empty, the font size is determined au<strong>to</strong>matically<br />

by the normal rules in Section 5.5.2.<br />

Rather than repeating \genfrac with the same first four arguments<br />

time <strong>and</strong> again, one should define new fraction comm<strong>and</strong>s with it. For<br />

example, the following definitions are given in amsmath.sty:<br />

\newcomm<strong>and</strong>{\frac}[2]{\genfrac{}{}{}{}{#1}{#2}}<br />

\newcomm<strong>and</strong>{\dfrac}[2]{\genfrac{}{}{}{0}{#1}{#2}}<br />

\newcomm<strong>and</strong>{\tfrac}[2]{\genfrac{}{}{}{1}{#1}{#2}}<br />

\newcomm<strong>and</strong>{\binom}[2]{\genfrac{(}{)}{0pt}{}{#1}{#2}<br />

As a further example, consider the redefinition of the comm<strong>and</strong> \frac<br />

\renewcomm<strong>and</strong>{\frac}[3][]{\genfrac{}{}{#1}{}{#2}{#3}}<br />

in which the line thickness is now an optional first argument; without this<br />

optional argument, the comm<strong>and</strong> behaves as normal. Thus<br />

<br />

\[ \binom{n}{m} =<br />

yields n n!<br />

=<br />

\frac[2pt]{n!}{M!(n-m)!} \]<br />

m<br />

M!(n − m)!<br />

Continued fractions<br />

Continued fractions can be made in A M S-L AT E X with the comm<strong>and</strong><br />

\cfrac[pos]{over}{under}<br />

whereby the denomina<strong>to</strong>r under may contain further \cfrac comm<strong>and</strong>s.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!