| 1 |
% |
| 2 |
% Copyright (C) 1995, 2000, 2013 American Mathematical Society. |
| 3 |
% Copyright (C) 2016-2025 LaTeX Project and American Mathematical Society. |
| 4 |
% |
| 5 |
% This work may be distributed and/or modified under the |
| 6 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 7 |
% of this license or (at your option) any later version. |
| 8 |
% The latest version of this license is in |
| 9 |
% https://www.latex-project.org/lppl.txt |
| 10 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 11 |
% version 2005/12/01 or later. |
| 12 |
% |
| 13 |
% This work has the LPPL maintenance status `maintained'. |
| 14 |
% |
| 15 |
% The Current Maintainer of this work is the LaTeX Project. |
| 16 |
% |
| 17 |
\documentclass[leqno,titlepage,openany]{amsldoc}[1999/12/13] |
| 18 |
|
| 19 |
\def\MaintainedByLaTeXTeam#1{% |
| 20 |
\begin{center}% |
| 21 |
\fbox{\fbox{\begin{tabular}{@{}l@{}}% |
| 22 |
This file is maintained by the \LaTeX{} Project team.\\% |
| 23 |
Bug reports can be opened (category \texttt{#1}) at\\% |
| 24 |
\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} |
| 25 |
|
| 26 |
\ifx\UndEfiNed\url |
| 27 |
\ClassError{amsldoc}{% |
| 28 |
This version of amsldoc.tex must be processed\MessageBreak |
| 29 |
with a newer version of amsldoc.cls (2.02 or later).}{} |
| 30 |
\fi |
| 31 |
|
| 32 |
\renewcommand\bibname{References} |
| 33 |
|
| 34 |
% Definitions that should be moved to amsldoc.cls |
| 35 |
% when it is next updated |
| 36 |
\makeatletter |
| 37 |
\let\cleardouble@page\cleardoublepage |
| 38 |
\AtBeginDocument{% |
| 39 |
\ifx\cleardouble@page\cleardoublepage |
| 40 |
\def\cleardoublepage{\clearpage{\pagestyle{empty}\cleardouble@page}} |
| 41 |
\fi |
| 42 |
} |
| 43 |
|
| 44 |
% #1 is empty or one of class, environment, option, package |
| 45 |
% could use different font in each case |
| 46 |
\makeatletter |
| 47 |
\def\@category@index#1#2{% |
| 48 |
\autoindex{% |
| 49 |
#2\actualchar\string\index#1font{#2}% |
| 50 |
\ifx\@nil#1\@nil\else\space#1\fi |
| 51 |
}% |
| 52 |
} |
| 53 |
|
| 54 |
\let\indexpackagefont\textsf |
| 55 |
\let\indexclassfont\textsf |
| 56 |
\let\indexoptionfont\texttt |
| 57 |
\let\indexenvironmentfont\texttt |
| 58 |
\let\indexfont\texttt |
| 59 |
\makeatother |
| 60 |
% For a package that won't be indexed, i.e. amsmath |
| 61 |
\newcommand{\nipkg}{\textsf} |
| 62 |
\def\tikz/{Ti\textit{k}Z} |
| 63 |
% End definitions for amsldoc.cls |
| 64 |
|
| 65 |
\title{User's Guide for the \nipkg{amsmath} Package (Version~2.1)} |
| 66 |
\author{American Mathematical Society, \LaTeX\ Project} |
| 67 |
\date{1999-12-13\\(revised 2002-02-25, 2016-11-14, 2018-04-05, 2019-10-14, 2020-02-18)} |
| 68 |
\makeatletter |
| 69 |
\def\@thanks{\bigskip\MaintainedByLaTeXTeam{amslatex}} |
| 70 |
\makeatother |
| 71 |
|
| 72 |
% Very minor changes are not listed in the \date above: |
| 73 |
% |
| 74 |
% 2021-08-22: reported typo fixed mathools -> mathtools |
| 75 |
% 2025-05-23: drop spurious option list |
| 76 |
|
| 77 |
|
| 78 |
% Use the amsmath package and amscd package in order to print |
| 79 |
% examples. |
| 80 |
\usepackage{amsmath} |
| 81 |
\usepackage{amscd} |
| 82 |
|
| 83 |
\usepackage{imakeidx} |
| 84 |
% Need alternate coding for vertical bar to get it into index. |
| 85 |
% Based on \qcbang and \cnbang in amsldoc.cls, refined by David Carlisle. |
| 86 |
% Give it a sort field that will be at the end of the symbols; |
| 87 |
% must avoid " and | which have special meanings. |
| 88 |
\DeclareRobustCommand{\qcvert}{\qc\|\index{{z1}@{\ntt\char'174}}} |
| 89 |
\DeclareRobustCommand{\cnvert}{% |
| 90 |
\ncn{\|}\index{{z0}@{\ntt\bslchar\char'174}}} |
| 91 |
% Need alternate index sort field for bang to allow & to sort first |
| 92 |
\DeclareRobustCommand{\altcnbang}{% |
| 93 |
\ncn{\!}\index{"!b@{\ntt\bslchar\qcbang}}} |
| 94 |
\DeclareRobustCommand{\cnamp}{% |
| 95 |
\index{"!a@\texttt{\&}}} |
| 96 |
|
| 97 |
\makeindex[intoc] % generate index data |
| 98 |
\providecommand{\see}[2]{\textit{see} #1} |
| 99 |
|
| 100 |
% The amsldoc class includes a number of features useful for |
| 101 |
% documentation about TeX, including: |
| 102 |
% |
| 103 |
% ---Commands \tex/, \amstex/, \latex/, ... for uniform treatment |
| 104 |
% of the various logos and easy handling of following spaces. |
| 105 |
% |
| 106 |
% ---Commands for printing various common elements: \cn for command |
| 107 |
% names, \fn for file names (including font-file names), \env for |
| 108 |
% environments, \pkg and \cls for packages and classes, etc. |
| 109 |
|
| 110 |
% Many of the command names used here are rather long and will |
| 111 |
% contribute to poor linebreaking if we follow the \latex/ practice |
| 112 |
% of not hyphenating anything set in tt font; instead we selectively |
| 113 |
% allow some hyphenation. |
| 114 |
\allowtthyphens % defined in amsldoc.cls |
| 115 |
|
| 116 |
\hyphenation{ac-cent-ed-sym-bol add-to-counter add-to-length align-at |
| 117 |
aligned-at allow-dis-play-breaks ams-art ams-cd ams-la-tex amsl-doc |
| 118 |
ams-symb ams-tex ams-text ams-xtra bmatrix bold-sym-bol cen-ter-tags |
| 119 |
eqn-ar-ray idots-int int-lim-its latex med-space neg-med-space |
| 120 |
neg-thick-space neg-thin-space no-int-lim-its no-name-lim-its |
| 121 |
over-left-arrow over-left-right-arrow over-right-arrow pmatrix |
| 122 |
qed-sym-bol set-length side-set small-er tbinom the-equa-tion |
| 123 |
thick-space thin-space un-der-left-arrow un-der-left-right-arrow |
| 124 |
un-der-right-arrow use-pack-age var-inj-lim var-proj-lim vmatrix |
| 125 |
xalign-at xx-align-at} |
| 126 |
|
| 127 |
% Prepare for illustrating the \vec example |
| 128 |
\newcommand{\vect}[1]{\mathbf{#1}} |
| 129 |
|
| 130 |
\newcommand{\booktitle}[1]{\textit{#1}} |
| 131 |
\newcommand{\journalname}[1]{\textit{#1}} |
| 132 |
\newcommand{\seriesname}[1]{\textit{#1}} |
| 133 |
|
| 134 |
% Command to insert and index a particular phrase. Doesn't work for |
| 135 |
% certain kinds of special characters in the argument. |
| 136 |
\newcommand{\ii}[1]{#1\index{#1}} |
| 137 |
|
| 138 |
\newcommand{\vstrut}[1]{\vrule width0pt height#1\relax} |
| 139 |
|
| 140 |
% An environment for presenting comprehensive address information: |
| 141 |
\newenvironment{infoaddress}{% |
| 142 |
\par\topsep\medskipamount |
| 143 |
\trivlist\centering |
| 144 |
\item[]% |
| 145 |
\begin{minipage}{.7\columnwidth}% |
| 146 |
\raggedright |
| 147 |
}{% |
| 148 |
\end{minipage}% |
| 149 |
\endtrivlist |
| 150 |
} |
| 151 |
|
| 152 |
\newenvironment{eqxample}{% |
| 153 |
\par\addvspace\medskipamount |
| 154 |
\noindent\begin{minipage}{.5\columnwidth}% |
| 155 |
\def\producing{\end{minipage}\begin{minipage}{.5\columnwidth}% |
| 156 |
\hbox\bgroup\kern-.2pt\vrule width.2pt% |
| 157 |
\vbox\bgroup\parindent0pt\relax |
| 158 |
% The 3pt is to cancel the -\lineskip from \displ@y |
| 159 |
\abovedisplayskip3pt \abovedisplayshortskip\abovedisplayskip |
| 160 |
\belowdisplayskip0pt \belowdisplayshortskip\belowdisplayskip |
| 161 |
\noindent} |
| 162 |
}{% |
| 163 |
\par |
| 164 |
% Ensure that a lonely \[\] structure doesn't take up width less than |
| 165 |
% \hsize. |
| 166 |
\hrule height0pt width\hsize |
| 167 |
\egroup\vrule width.2pt\kern-.2pt\egroup |
| 168 |
\end{minipage}% |
| 169 |
\par\addvspace\medskipamount |
| 170 |
} |
| 171 |
|
| 172 |
% Errors in output shouldn't be \texttt, and they may also be longer |
| 173 |
% than one line, but they should be identified by the "errorbullet". |
| 174 |
% (They were formerly labeled as aubsections.) |
| 175 |
\newenvironment{erroro}[1]{% |
| 176 |
\par\addvspace\medskipamount |
| 177 |
\noindent\hangindent\parindent |
| 178 |
\hbox to\parindent{\errorbullet\hfil}\ignorespaces |
| 179 |
#1\par\vspace{\smallskipamount} |
| 180 |
}{% |
| 181 |
\par\addvspace\medskipamount |
| 182 |
} |
| 183 |
|
| 184 |
% The chapters are so short, perhaps we shouldn't call them by the |
| 185 |
% name `Chapter'. We make \chaptername read an argument in order to |
| 186 |
% remove a following \space or "{} " (both possibilities are present |
| 187 |
% in book.cls). |
| 188 |
|
| 189 |
\renewcommand{\chaptername}[1]{} |
| 190 |
\newcommand{\chapnum}[1]{\mdash #1\mdash } |
| 191 |
\makeatletter |
| 192 |
\def\@makechapterhead#1{% |
| 193 |
\vspace{1.5\baselineskip}% |
| 194 |
{\parindent \z@ \raggedright \reset@font |
| 195 |
\ifnum \c@secnumdepth >\m@ne |
| 196 |
\large\bfseries \chapnum{\thechapter}% |
| 197 |
\par\nobreak |
| 198 |
\vskip.5\baselineskip\relax |
| 199 |
\fi |
| 200 |
#1\par\nobreak |
| 201 |
\vskip\baselineskip |
| 202 |
}} |
| 203 |
\makeatother |
| 204 |
|
| 205 |
% A command for ragged-right parbox in a tabular. |
| 206 |
\newcommand{\rp}{\let\PBS\\\raggedright\let\\\PBS} |
| 207 |
|
| 208 |
% Non-indexed file name |
| 209 |
\newcommand{\nfn}[1]{\texttt{#1}} |
| 210 |
|
| 211 |
% For the examples in the math spacing table. |
| 212 |
%%\newcommand{\lspx}{\mbox{\rule{5pt}{.6pt}\rule{.6pt}{6pt}}} |
| 213 |
%%\newcommand{\rspx}{\mbox{\rule[-1pt]{.6pt}{7pt}% |
| 214 |
%% \rule[-1pt]{5pt}{.6pt}}} |
| 215 |
\newcommand{\lspx}{\mathord{\Rightarrow\mkern-1mu}} |
| 216 |
\newcommand{\rspx}{\mathord{\mkern-1mu\Leftarrow}} |
| 217 |
\newcommand{\spx}[1]{$\lspx #1\rspx$} |
| 218 |
|
| 219 |
% For a list of characters representing document input. |
| 220 |
\newcommand{\clist}[1]{% |
| 221 |
\mbox{\ntt\spaceskip.2em plus.1em \xspaceskip\spaceskip#1}} |
| 222 |
|
| 223 |
% Fix weird \latex/ definition of rightmark. |
| 224 |
\makeatletter |
| 225 |
\def\rightmark{\expandafter\@rightmark\botmark{}{}} |
| 226 |
% Also turn off section marks. |
| 227 |
\let\sectionmark\@gobble |
| 228 |
\renewcommand{\chaptermark}[1]{% |
| 229 |
\uppercase{\markboth{\rhcn#1}{\rhcn#1}}} |
| 230 |
\newcommand{\rhcn}{\thechapter. } |
| 231 |
\makeatother |
| 232 |
|
| 233 |
% Include down to \section but not \subsection, in toc: |
| 234 |
\setcounter{tocdepth}{1} |
| 235 |
|
| 236 |
% Subheadings for the bibliography |
| 237 |
\newif\iffirstbibsubhead \firstbibsubheadtrue |
| 238 |
\newcommand{\bibsubhead}[1]{% |
| 239 |
\iffirstbibsubhead \firstbibsubheadfalse |
| 240 |
\else \addvspace{\medskipamount} |
| 241 |
\fi |
| 242 |
\item[]\hspace*{-\leftmargin}\textbf{#1}\par |
| 243 |
\vspace{\smallskipamount} |
| 244 |
} |
| 245 |
|
| 246 |
\DeclareMathOperator{\ix}{ix} |
| 247 |
\DeclareMathOperator{\nul}{nul} |
| 248 |
\DeclareMathOperator{\End}{End} |
| 249 |
\DeclareMathOperator{\xxx}{xxx} |
| 250 |
|
| 251 |
\usepackage{hyperref} |
| 252 |
\hypersetup{pdfborder=0 0 0} |
| 253 |
\makeatletter |
| 254 |
\let\oldcs\cs |
| 255 |
\def\cs#1{\texorpdfstring{\oldcs{#1}}{\@backslashchar\@backslashchar#1}} |
| 256 |
\let\cn\cs |
| 257 |
\makeatother |
| 258 |
\begin{document} |
| 259 |
|
| 260 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 261 |
\frontmatter |
| 262 |
|
| 263 |
\maketitle |
| 264 |
|
| 265 |
\pagestyle{headings} |
| 266 |
\tableofcontents |
| 267 |
\cleardoublepage % for better page number placement |
| 268 |
|
| 269 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 270 |
\mainmatter |
| 271 |
\chapter{Introduction} |
| 272 |
|
| 273 |
\index{amsmath@\texttt{amsmath} package|(} |
| 274 |
|
| 275 |
The \nipkg{amsmath} package is a \LaTeX{} package that provides |
| 276 |
miscellaneous enhancements for improving the information structure and |
| 277 |
printed output of documents that contain mathematical formulas. Readers |
| 278 |
unfamiliar with \LaTeX{} should refer to \cite{lamport}. If you have an |
| 279 |
up-to-date version of \LaTeX{}, the \nipkg{amsmath} package is normally |
| 280 |
provided along with it. Upgrading when a newer version of the |
| 281 |
\nipkg{amsmath} package is released can be done via |
| 282 |
\url{http://mirror.ctan.org/macros/latex/required/amsmath.zip}. |
| 283 |
|
| 284 |
This documentation describes the features of the \nipkg{amsmath} package |
| 285 |
and discusses how they are intended to be used. It also covers some |
| 286 |
ancillary packages: |
| 287 |
\begin{ctab}{lll} |
| 288 |
\pkg{amsbsy}& \pkg{amsopn}& \pkg{amsxtra}\\ |
| 289 |
\pkg{amscd}& \pkg{amstext}\\ |
| 290 |
\end{ctab} |
| 291 |
These all have something to do with the contents of math formulas. For |
| 292 |
information on extra math symbols and math fonts, see \cite{amsfonts} |
| 293 |
and \url{https://www.ams.org/tex/amsfonts.html}. For documentation of the |
| 294 |
\pkg{amsthm} package or AMS document classes (\cls{amsart}, |
| 295 |
\cls{amsbook}, etc.\@) see \cite{amsthdoc} or \cite{amshandbk} and |
| 296 |
\url{https://www.ams.org/tex/author-info.html}. |
| 297 |
|
| 298 |
If you are a long-time \latex/ user and have lots of mathematics in what |
| 299 |
you write, then you may recognize solutions for some familiar problems |
| 300 |
in this list of \nipkg{amsmath} features: |
| 301 |
\begin{itemize} |
| 302 |
|
| 303 |
\item A convenient way to define new `operator name' commands analogous |
| 304 |
to \cn{sin} and \cn{lim}, including proper side spacing and automatic |
| 305 |
selection of the correct font style and size (even when used in |
| 306 |
sub- or superscripts). |
| 307 |
|
| 308 |
\item Multiple substitutes for the \env{eqnarray} environment to make |
| 309 |
various kinds of equation arrangements easier to write. |
| 310 |
|
| 311 |
\item Equation numbers automatically adjust up or down to avoid |
| 312 |
overprinting on the equation contents (unlike \env{eqnarray}). |
| 313 |
|
| 314 |
\item Spacing around equals signs matches the normal spacing in the |
| 315 |
\env{equation} environment (unlike \env{eqnarray}). |
| 316 |
|
| 317 |
\item A way to produce multiline subscripts as are often used with |
| 318 |
summation or product symbols. |
| 319 |
|
| 320 |
\item An easy way to substitute a variant equation number for a given |
| 321 |
equation instead of the automatically supplied number. |
| 322 |
|
| 323 |
\item An easy way to produce subordinate equation numbers of the form |
| 324 |
(1.3a) (1.3b) (1.3c) for selected groups of equations. |
| 325 |
|
| 326 |
\end{itemize} |
| 327 |
|
| 328 |
The \nipkg{amsmath} package is distributed together with some small |
| 329 |
auxiliary packages: |
| 330 |
\begin{description} |
| 331 |
\item[\nipkg{amsmath}] Primary package, provides various features for |
| 332 |
displayed equations and other mathematical constructs. |
| 333 |
|
| 334 |
\item[\pkg{amstext}] Provides a \cn{text} command for |
| 335 |
typesetting a fragment of text inside a display. |
| 336 |
|
| 337 |
\item[\pkg{amsopn}] Provides \cn{DeclareMathOperator} for defining new |
| 338 |
`operator names' like \cn{sin} and \cn{lim}. |
| 339 |
|
| 340 |
\item[\pkg{amsbsy}] For backward compatibility this package continues |
| 341 |
to exist but use of the newer \pkg{bm} package that comes with \LaTeX{} |
| 342 |
is recommended instead. |
| 343 |
|
| 344 |
\item[\pkg{amscd}] Provides a \env{CD} environment for simple |
| 345 |
commutative diagrams (no support for diagonal arrows). |
| 346 |
|
| 347 |
\item[\pkg{amsxtra}] Provides certain odds and ends such as |
| 348 |
\cn{fracwithdelims} and \cn{accentedsymbol}, for compatibility with |
| 349 |
documents created using version 1.1. |
| 350 |
|
| 351 |
\end{description} |
| 352 |
|
| 353 |
The \nipkg{amsmath} package incorporates \pkg{amstext}, \pkg{amsopn}, and |
| 354 |
\pkg{amsbsy}. The features of \pkg{amscd} and \pkg{amsxtra}, however, |
| 355 |
are available only by invoking those packages separately. |
| 356 |
|
| 357 |
The independent \pkg{mathtools} package \cite{mt} provides some |
| 358 |
enhancements to \nipkg{amsmath}; \pkg{mathtools} loads \nipkg{amsmath} |
| 359 |
automatically, so there is no need to separately load \nipkg{amsmath} |
| 360 |
if \pkg{mathtools} is used. Some \pkg{mathtools} facilities |
| 361 |
will be noted below as appropriate. |
| 362 |
|
| 363 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 364 |
|
| 365 |
\chapter{Options for the \nipkg{amsmath} package}\label{options} |
| 366 |
|
| 367 |
The \nipkg{amsmath} package has the following options: |
| 368 |
\index{options!amsmath@\texttt{amsmath} package options|(} |
| 369 |
\begin{description} |
| 370 |
|
| 371 |
\item[\opt{centertags}] (default) For an equation containing a |
| 372 |
\env{split} environment, place equation |
| 373 |
numbers\index{equationn@equation numbers!vertical placement} |
| 374 |
vertically centered on the total height of the equation. |
| 375 |
|
| 376 |
\item[\opt{tbtags}] `Top-or-bottom tags': For an equation containing |
| 377 |
a \env{split} environment, place equation |
| 378 |
numbers\index{equationn@equation numbers!vertical placement} level with the last |
| 379 |
(resp.\ first) line, if numbers are on the right (resp.\ left). |
| 380 |
|
| 381 |
\item[\opt{sumlimits}] (default) Place the subscripts and |
| 382 |
superscripts\index{subscripts and superscripts!placement}\relax |
| 383 |
\index{limits|see{subscripts and superscripts}} of summation symbols |
| 384 |
above and below, in displayed equations. This option also affects other |
| 385 |
symbols of the same type\mdash $\prod$, $\coprod$, $\bigotimes$, |
| 386 |
$\bigoplus$, and so forth\mdash but excluding integrals (see below). |
| 387 |
|
| 388 |
\item[\opt{nosumlimits}] Always place the subscripts and superscripts of |
| 389 |
summation-type symbols to the side, even in displayed equations. |
| 390 |
|
| 391 |
\item[\opt{intlimits}] Like \opt{sumlimits}, but for |
| 392 |
integral\index{integrals!placement of limits} symbols. |
| 393 |
|
| 394 |
\item[\opt{nointlimits}] (default) Opposite of \opt{intlimits}. |
| 395 |
|
| 396 |
\item[\opt{namelimits}] (default) Like \opt{sumlimits}, but for certain |
| 397 |
`operator names' such as $\det$, $\inf$, $\lim$, $\max$, $\min$, that |
| 398 |
traditionally have subscripts% |
| 399 |
\index{subscripts and superscripts!placement} placed underneath when |
| 400 |
they occur in a displayed equation. |
| 401 |
|
| 402 |
\item[\opt{nonamelimits}] Opposite of \opt{namelimits}. |
| 403 |
|
| 404 |
\end{description} |
| 405 |
|
| 406 |
\goodbreak |
| 407 |
|
| 408 |
To use one of these package options, put the option name in the optional |
| 409 |
argument of the \cn{usepackage} command\mdash e.g., |
| 410 |
\verb"\usepackage[intlimits]{amsmath}". |
| 411 |
For AMS document classes and any other classes that preload \nipkg{amsmath} |
| 412 |
desired options must be specified with the \cn{documentclass}\mdash |
| 413 |
e.g.,\\ |
| 414 |
\verb+\documentclass[intlimits,tbtags,reqno]{amsart}+. |
| 415 |
|
| 416 |
The \nipkg{amsmath} package also recognizes the following options which |
| 417 |
are normally selected (implicitly or explicitly) through the |
| 418 |
\cn{documentclass} command, and thus need not be repeated in the option |
| 419 |
list of the \cn{usepackage}|{amsmath}| statement. |
| 420 |
\begin{description} |
| 421 |
|
| 422 |
\item[\opt{leqno}] Place equation numbers on the left.% |
| 423 |
\index{equationn@equation numbers!left or right placement} |
| 424 |
|
| 425 |
\item[\opt{reqno}] Place equation numbers on the right. |
| 426 |
|
| 427 |
\item[\opt{fleqn}] Position equations at a fixed indent from the left |
| 428 |
margin rather than centered in the text column.% |
| 429 |
\index{displayed equations!centering} |
| 430 |
|
| 431 |
\end{description} |
| 432 |
|
| 433 |
Three options have been added to control the space to the left of |
| 434 |
\env{aligned} and \env{gathered} environments. Prior to the 2017 release |
| 435 |
a thin space was added to the left but not the right of these constructs. |
| 436 |
This appears to have been an accidental feature of the implementation and |
| 437 |
was typically corrected by prefixing the environments with \altcnbang. |
| 438 |
|
| 439 |
The new default behavior is aimed to ensure that the environments do |
| 440 |
not have a thin space added in most cases, and that existing documents |
| 441 |
using |\!\begin{aligned}| continue to work as before. |
| 442 |
|
| 443 |
\begin{description} |
| 444 |
\item[\opt{alignedleftspaceyes}] Always add \cn{\,} to the left of \env{aligned} and \env{gathered}. |
| 445 |
\item[\opt{alignedleftspaceno}] Never add \cn{\,} to the left of \env{aligned} and \env{gathered}. |
| 446 |
\item[\opt{alignedleftspaceyesifneg}] Only add \cn{\,} if the environment is prefixed by negative space. (New default behavior.) |
| 447 |
\end{description} |
| 448 |
|
| 449 |
\index{options!amsmath@\texttt{amsmath} package options|)} |
| 450 |
|
| 451 |
|
| 452 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 453 |
|
| 454 |
\chapter{Displayed equations} |
| 455 |
|
| 456 |
\section{Introduction} |
| 457 |
The \nipkg{amsmath} package provides a number of additional displayed |
| 458 |
equation structures\index{displayed equations}% |
| 459 |
\index{equations|see{displayed equations}} beyond the ones |
| 460 |
provided in basic \latex/. The augmented set includes: |
| 461 |
\begin{verbatim} |
| 462 |
equation equation* align align* |
| 463 |
gather gather* alignat alignat* |
| 464 |
multline multline* flalign flalign* |
| 465 |
split |
| 466 |
\end{verbatim} |
| 467 |
(Although the standard \env{eqnarray} environment remains available, |
| 468 |
it is better to use \env{align} or \env{equation}+\env{split} instead. |
| 469 |
Within \env{eqnarray}, spacing\index{horizontal spacing} around signs |
| 470 |
of relation is not the preferred mathematical spacing, and is |
| 471 |
inconsistent with that spacing as it appears in other environments. |
| 472 |
Long lines in this environment may result in misplaced or overprinted |
| 473 |
equation numbers. This environment also does not support the use of |
| 474 |
\cn{qed} or \cn{qedhere} as provided by theorem packages.) |
| 475 |
|
| 476 |
Except for \env{split}, each environment has both starred and unstarred |
| 477 |
forms, where the unstarred forms have automatic numbering using |
| 478 |
\latex/'s \env{equation} counter. You can suppress the number on any |
| 479 |
particular line by putting \cn{notag} before the end of that line; |
| 480 |
\cn{notag} should not be used outside a display environment as it will |
| 481 |
mess up the numbering. You can also |
| 482 |
override\index{equationn@equation numbers!overriding} a number with a tag |
| 483 |
of your own using \cn{tag}|{|\<label>|}|, where \<label> means arbitrary |
| 484 |
text such as |$*$| or |ii| used to \qq{number} the equation. |
| 485 |
A tag can reference a different tagged display by use of |
| 486 |
|\tag{\ref{|\<label>|}|\<modifier>|}| where \<modifier> is optional. |
| 487 |
If you are using \pkg{hyperref}, use \cn{ref*}; |
| 488 |
use of the starred form of \cn{ref} prevents a reference to a modified |
| 489 |
tag containing a nested link from linking to the original display. |
| 490 |
|
| 491 |
There is also a |
| 492 |
\cn{tag*} command that causes the text you supply to be typeset |
| 493 |
literally, without adding parentheses around it. \cn{tag} and \cn{tag*} |
| 494 |
can also be used within the unnumbered versions of all the \nipkg{amsmath} |
| 495 |
alignment structures. Some examples of the use of \cn{tag} may be found |
| 496 |
in the sample files \fn{testmath.tex} and \fn{subeqn.tex} provided with |
| 497 |
the \nipkg{amsmath} package. |
| 498 |
|
| 499 |
The \env{split} environment is a special subordinate form that is used |
| 500 |
only \emph{inside} one of the others. It cannot be used inside |
| 501 |
\env{multline}, however. \env{split} supports only one alignment (|&|) |
| 502 |
column; if more are needed, \env{aligned} or \env{alignedat} should be |
| 503 |
used. The width of a \env{split} structure is the full line width. |
| 504 |
|
| 505 |
In the structures that do alignment (\env{split}, \env{align} and |
| 506 |
variants), relation symbols have an |&| before them but not |
| 507 |
after\mdash unlike \env{eqnarray}. Putting the |&| after the |
| 508 |
relation symbol will interfere with the normal spacing; it has to go |
| 509 |
before. |
| 510 |
|
| 511 |
In all multiline environments, lines are divided by \cn{\\}. The \cn{\\} |
| 512 |
should \emph{not} be used to end the last line. Using it there will |
| 513 |
result in unwanted extra vertical space following the display. |
| 514 |
|
| 515 |
In \emph{all} math environments (inline or display), blank lines |
| 516 |
(equivalent to \cn{par}) are not permitted, and will result in an error. |
| 517 |
|
| 518 |
\begin{table}[p] |
| 519 |
\caption[]{Comparison of displayed equation environments (vertical lines |
| 520 |
indicating nominal margins)}\label{displays} |
| 521 |
\renewcommand{\theequation}{\arabic{equation}} |
| 522 |
\begin{eqxample} |
| 523 |
\begin{verbatim} |
| 524 |
\begin{equation*} |
| 525 |
a=b |
| 526 |
\end{equation*} |
| 527 |
\end{verbatim} |
| 528 |
\producing |
| 529 |
\begin{equation*} |
| 530 |
a=b |
| 531 |
\end{equation*} |
| 532 |
\end{eqxample} |
| 533 |
|
| 534 |
\begin{eqxample} |
| 535 |
\begin{verbatim} |
| 536 |
\begin{equation} |
| 537 |
a=b |
| 538 |
\end{equation} |
| 539 |
\end{verbatim} |
| 540 |
\producing |
| 541 |
\begin{equation} |
| 542 |
a=b |
| 543 |
\end{equation} |
| 544 |
\end{eqxample} |
| 545 |
|
| 546 |
\begin{eqxample} |
| 547 |
\begin{verbatim} |
| 548 |
\begin{equation}\label{xx} |
| 549 |
\begin{split} |
| 550 |
a& =b+c-d\\ |
| 551 |
& \quad +e-f\\ |
| 552 |
& =g+h\\ |
| 553 |
& =i |
| 554 |
\end{split} |
| 555 |
\end{equation} |
| 556 |
\end{verbatim} |
| 557 |
\producing |
| 558 |
\begin{equation}\label{xx} |
| 559 |
\begin{split} |
| 560 |
a& =b+c-d\\ |
| 561 |
& \quad +e-f\\ |
| 562 |
& =g+h\\ |
| 563 |
& =i |
| 564 |
\end{split} |
| 565 |
\end{equation} |
| 566 |
\end{eqxample} |
| 567 |
|
| 568 |
\begin{eqxample} |
| 569 |
\begin{verbatim} |
| 570 |
\begin{multline} |
| 571 |
a+b+c+d+e+f\\ |
| 572 |
+i+j+k+l+m+n |
| 573 |
\end{multline} |
| 574 |
\end{verbatim} |
| 575 |
\producing |
| 576 |
\begin{multline} |
| 577 |
a+b+c+d+e+f\\ |
| 578 |
+i+j+k+l+m+n |
| 579 |
\end{multline} |
| 580 |
\end{eqxample} |
| 581 |
|
| 582 |
\begin{eqxample} |
| 583 |
\begin{verbatim} |
| 584 |
\begin{gather} |
| 585 |
a_1=b_1+c_1\\ |
| 586 |
a_2=b_2+c_2-d_2+e_2 |
| 587 |
\end{gather} |
| 588 |
\end{verbatim} |
| 589 |
\producing |
| 590 |
\begin{gather} |
| 591 |
a_1=b_1+c_1\\ |
| 592 |
a_2=b_2+c_2-d_2+e_2 |
| 593 |
\end{gather} |
| 594 |
\end{eqxample} |
| 595 |
|
| 596 |
\begin{eqxample} |
| 597 |
\begin{verbatim} |
| 598 |
\begin{align} |
| 599 |
a_1& =b_1+c_1\\ |
| 600 |
a_2& =b_2+c_2-d_2+e_2 |
| 601 |
\end{align} |
| 602 |
\end{verbatim} |
| 603 |
\producing |
| 604 |
\begin{align} |
| 605 |
a_1& =b_1+c_1\\ |
| 606 |
a_2& =b_2+c_2-d_2+e_2 |
| 607 |
\end{align} |
| 608 |
\end{eqxample} |
| 609 |
|
| 610 |
\begin{eqxample} |
| 611 |
\begin{verbatim} |
| 612 |
\begin{align} |
| 613 |
a_{11}& =b_{11}& |
| 614 |
a_{12}& =b_{12}\\ |
| 615 |
a_{21}& =b_{21}& |
| 616 |
a_{22}& =b_{22}+c_{22} |
| 617 |
\end{align} |
| 618 |
\end{verbatim} |
| 619 |
\producing |
| 620 |
\begin{align} |
| 621 |
a_{11}& =b_{11}& |
| 622 |
a_{12}& =b_{12}\\ |
| 623 |
a_{21}& =b_{21}& |
| 624 |
a_{22}& =b_{22}+c_{22} |
| 625 |
\end{align} |
| 626 |
\end{eqxample} |
| 627 |
|
| 628 |
\begin{eqxample} |
| 629 |
\begin{verbatim} |
| 630 |
\begin{flalign*} |
| 631 |
a_{11} + b_{11}& = c_{11}& |
| 632 |
a_{12}& =b_{12}\\ |
| 633 |
b_{21}& = c_{21}& |
| 634 |
a_{22}& =b_{22}+c_{22} |
| 635 |
\end{flalign*} |
| 636 |
\end{verbatim} |
| 637 |
\producing |
| 638 |
\begin{flalign*} |
| 639 |
a_{11} + b_{11}& = c_{11}& |
| 640 |
a_{12}& =b_{12}\\ |
| 641 |
b_{21}& = c_{21}& |
| 642 |
a_{22}& =b_{22}+c_{22} |
| 643 |
\end{flalign*} |
| 644 |
\end{eqxample} |
| 645 |
\end{table} |
| 646 |
|
| 647 |
%% ------------------------------------------------------------------ %% |
| 648 |
\enlargethispage{1\baselineskip} |
| 649 |
|
| 650 |
\section{Single equations} |
| 651 |
|
| 652 |
The \env{equation} environment is for a single equation with an |
| 653 |
automatically generated number. The \env{equation*} environment is the |
| 654 |
same except for omitting the number.% |
| 655 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 656 |
\footnote{Basic \latex/ doesn't provide an \env{equation*} environment, |
| 657 |
but rather a functionally equivalent environment named |
| 658 |
\env{displaymath}.} |
| 659 |
The wrapper \verb+\[ ... \]+ is equivalent to \env{equation*}.% |
| 660 |
\index{[@\verb+\[ ... \]+} |
| 661 |
|
| 662 |
%% ------------------------------------------------------------------ %% |
| 663 |
|
| 664 |
\section{Split equations without alignment} |
| 665 |
|
| 666 |
The \env{multline} environment is a variation of the \env{equation} |
| 667 |
environment used for equations that don't fit on a single line. The |
| 668 |
first line of a \env{multline} will be at the left margin and the last |
| 669 |
line at the right margin, except for an indention on both sides in the |
| 670 |
amount of \cn{multlinegap}. Any additional lines in between will be |
| 671 |
centered independently within the display width (unless the \opt{fleqn} |
| 672 |
option is in effect).% |
| 673 |
\index{options!behavior of particular options} |
| 674 |
|
| 675 |
Like \env{equation}, \env{multline} has only a single equation number |
| 676 |
(thus, none of the individual lines should be marked with \cn{notag}). |
| 677 |
The equation number is placed on the last line (\opt{reqno} option) or |
| 678 |
first line (\opt{leqno} option); vertical centering as for \env{split} |
| 679 |
is not supported by \env{multline}.% |
| 680 |
\index{options!behavior of particular options} |
| 681 |
|
| 682 |
It's possible to force one of the middle lines to the left or right with |
| 683 |
commands \cn{shoveleft}, \cn{shoveright}. These commands take the entire |
| 684 |
line as an argument, up to but not including the final \cn{\\}; for |
| 685 |
example |
| 686 |
\begin{multline} |
| 687 |
\framebox[.65\columnwidth]{A}\\ |
| 688 |
\framebox[.5\columnwidth]{B}\\ |
| 689 |
\shoveright{\framebox[.55\columnwidth]{C}}\\ |
| 690 |
\framebox[.65\columnwidth]{D} |
| 691 |
\end{multline} |
| 692 |
\begin{verbatim} |
| 693 |
\begin{multline} |
| 694 |
\framebox[.65\columnwidth]{A}\\ |
| 695 |
\framebox[.5\columnwidth]{B}\\ |
| 696 |
\shoveright{\framebox[.55\columnwidth]{C}}\\ |
| 697 |
\framebox[.65\columnwidth]{D} |
| 698 |
\end{multline} |
| 699 |
\end{verbatim} |
| 700 |
|
| 701 |
The value of \cn{multlinegap} can be changed with the usual \latex/ |
| 702 |
commands \cn{setlength} or \cn{addtolength}. |
| 703 |
|
| 704 |
%% ------------------------------------------------------------------ %% |
| 705 |
|
| 706 |
\section{Split equations with alignment} |
| 707 |
|
| 708 |
Like \env{multline}, the \env{split} environment is for \emph{single} |
| 709 |
equations that are too long to fit on one line and hence must be split |
| 710 |
into multiple lines. Unlike \env{multline}, however, the \env{split} |
| 711 |
environment provides for alignment among the split lines, using |&| to |
| 712 |
mark alignment points. Unlike the other \nipkg{amsmath} equation |
| 713 |
structures, the \env{split} environment provides no numbering, because |
| 714 |
it is intended to be used \emph{only inside some other displayed |
| 715 |
equation structure}, usually an \env{equation}, \env{align}, or |
| 716 |
\env{gather} environment, which provides the numbering. For example: |
| 717 |
\begin{equation}\label{e:barwq}\begin{split} |
| 718 |
H_c&=\frac{1}{2n} \sum^n_{l=0}(-1)^{l}(n-{l})^{p-2} |
| 719 |
\sum_{l _1+\dots+ l _p=l}\prod^p_{i=1} \binom{n_i}{l _i}\\ |
| 720 |
&\quad\cdot[(n-l )-(n_i-l _i)]^{n_i-l _i}\cdot |
| 721 |
\Bigl[(n-l )^2-\sum^p_{j=1}(n_i-l _i)^2\Bigr]. |
| 722 |
\kern-2em % adjust equation body to the right [mjd,13-Nov-1994] |
| 723 |
\end{split}\end{equation} |
| 724 |
|
| 725 |
\begin{verbatim} |
| 726 |
\begin{equation}\label{e:barwq}\begin{split} |
| 727 |
H_c&=\frac{1}{2n} \sum^n_{l=0}(-1)^{l}(n-{l})^{p-2} |
| 728 |
\sum_{l _1+\dots+ l _p=l}\prod^p_{i=1} \binom{n_i}{l _i}\\ |
| 729 |
&\quad\cdot[(n-l )-(n_i-l _i)]^{n_i-l _i}\cdot |
| 730 |
\Bigl[(n-l )^2-\sum^p_{j=1}(n_i-l _i)^2\Bigr]. |
| 731 |
\end{split}\end{equation} |
| 732 |
\end{verbatim} |
| 733 |
|
| 734 |
The \env{split} structure should constitute the entire body of the |
| 735 |
enclosing structure, apart from commands like \cn{label} that produce no |
| 736 |
visible material. |
| 737 |
|
| 738 |
%% ------------------------------------------------------------------ %% |
| 739 |
|
| 740 |
\section{Equation groups without alignment} |
| 741 |
|
| 742 |
The \env{gather} environment is used for a group of consecutive |
| 743 |
equations when there is no alignment desired among them; each one is |
| 744 |
centered separately within the text width (see Table~\ref{displays}). |
| 745 |
Equations inside \env{gather} are separated by a \cn{\\} command. |
| 746 |
Any equation in a \env{gather} may consist of a \verb'\begin{split}' |
| 747 |
\dots\ \verb'\end{split}' structure\mdash for example: |
| 748 |
\begin{verbatim} |
| 749 |
\begin{gather} |
| 750 |
first equation\\ |
| 751 |
\begin{split} |
| 752 |
second & equation\\ |
| 753 |
& on two lines |
| 754 |
\end{split} |
| 755 |
\\ |
| 756 |
third equation |
| 757 |
\end{gather} |
| 758 |
\end{verbatim} |
| 759 |
|
| 760 |
%% ------------------------------------------------------------------ %% |
| 761 |
|
| 762 |
\section{Equation groups with mutual alignment} |
| 763 |
|
| 764 |
The \env{align} environment is used for two or more equations when |
| 765 |
vertical alignment is desired; usually binary relations such as equal |
| 766 |
signs are aligned (see Table~\ref{displays}). |
| 767 |
|
| 768 |
To have several equation columns side-by-side, use extra ampersands |
| 769 |
to separate the columns: |
| 770 |
\begin{align} |
| 771 |
x&=y & X&=Y & a&=b+c\\ |
| 772 |
x'&=y' & X'&=Y' & a'&=b\\ |
| 773 |
x+x'&=y+y' & X+X'&=Y+Y' & a'b&=c'b |
| 774 |
\end{align} |
| 775 |
% |
| 776 |
\begin{verbatim} |
| 777 |
\begin{align} |
| 778 |
x&=y & X&=Y & a&=b+c\\ |
| 779 |
x'&=y' & X'&=Y' & a'&=b\\ |
| 780 |
x+x'&=y+y' & X+X'&=Y+Y' & a'b&=c'b |
| 781 |
\end{align} |
| 782 |
\end{verbatim} |
| 783 |
Line-by-line annotations on an equation can be done by judicious |
| 784 |
application of \cn{text} inside an \env{align} environment: |
| 785 |
\begin{align} |
| 786 |
x& = y_1-y_2+y_3-y_5+y_8-\dots |
| 787 |
&& \text{by \eqref{eq:C}}\\ |
| 788 |
& = y'\circ y^* && \text{by \eqref{eq:D}}\\ |
| 789 |
& = y(0) y' && \text {by Axiom 1.} |
| 790 |
\end{align} |
| 791 |
% |
| 792 |
\begin{verbatim} |
| 793 |
\begin{align} |
| 794 |
x& = y_1-y_2+y_3-y_5+y_8-\dots |
| 795 |
&& \text{by \eqref{eq:C}}\\ |
| 796 |
& = y'\circ y^* && \text{by \eqref{eq:D}}\\ |
| 797 |
& = y(0) y' && \text {by Axiom 1.} |
| 798 |
\end{align} |
| 799 |
\end{verbatim} |
| 800 |
A variant environment \env{alignat} allows the horizontal space between |
| 801 |
equations to be explicitly specified. This environment takes one argument, |
| 802 |
the number of \qq{equation columns} (the number of pairs of right-left |
| 803 |
aligned columns; the argument is the number of pairs): count the maximum |
| 804 |
number of \verb'&'s in any row, add~1 and divide by~2. |
| 805 |
\begin{alignat}{2} |
| 806 |
x& = y_1-y_2+y_3-y_5+y_8-\dots |
| 807 |
&\quad& \text{by \eqref{eq:C}}\\ |
| 808 |
& = y'\circ y^* && \text{by \eqref{eq:D}}\\ |
| 809 |
& = y(0) y' && \text {by Axiom 1.} |
| 810 |
\end{alignat} |
| 811 |
% |
| 812 |
\begin{verbatim} |
| 813 |
\begin{alignat}{2} |
| 814 |
x& = y_1-y_2+y_3-y_5+y_8-\dots |
| 815 |
&\quad& \text{by \eqref{eq:C}}\\ |
| 816 |
& = y'\circ y^* && \text{by \eqref{eq:D}}\\ |
| 817 |
& = y(0) y' && \text {by Axiom 1.} |
| 818 |
\end{alignat} |
| 819 |
\end{verbatim} |
| 820 |
The environment \env{flalign} (``full length alignment'') stretches the |
| 821 |
space between the equation columns to the maximum possible width, leaving |
| 822 |
only enough space at the margin for the equation number, if present. |
| 823 |
\begin{flalign} |
| 824 |
x&=y & X&=Y\\ |
| 825 |
x'&=y' & X'&=Y'\\ |
| 826 |
x+x'&=y+y' & X+X'&=Y+Y' |
| 827 |
\end{flalign} |
| 828 |
% |
| 829 |
\begin{verbatim} |
| 830 |
\begin{flalign} |
| 831 |
x&=y & X&=Y\\ |
| 832 |
x'&=y' & X'&=Y'\\ |
| 833 |
x+x'&=y+y' & X+X'&=Y+Y' |
| 834 |
\end{flalign} |
| 835 |
\end{verbatim} |
| 836 |
% |
| 837 |
\begin{flalign*} |
| 838 |
x&=y & X&=Y\\ |
| 839 |
x'&=y' & X'&=Y'\\ |
| 840 |
x+x'&=y+y' & X+X'&=Y+Y' |
| 841 |
\end{flalign*} |
| 842 |
% |
| 843 |
\begin{verbatim} |
| 844 |
\begin{flalign*} |
| 845 |
x&=y & X&=Y\\ |
| 846 |
x'&=y' & X'&=Y'\\ |
| 847 |
x+x'&=y+y' & X+X'&=Y+Y' |
| 848 |
\end{flalign*} |
| 849 |
\end{verbatim} |
| 850 |
|
| 851 |
%% ------------------------------------------------------------------ %% |
| 852 |
|
| 853 |
\section{Alignment building blocks} |
| 854 |
|
| 855 |
Like \env{equation}, the multi-equation environments \env{gather}, |
| 856 |
\env{align}, and \env{alignat} are designed to produce a structure |
| 857 |
whose width is the full line width. This means, for example, that one |
| 858 |
cannot readily add parentheses around the entire structure. But |
| 859 |
variants\index{ed env@\texttt{-ed} environments|(} |
| 860 |
\env{gathered}, \env{aligned}, and \env{alignedat} are provided whose |
| 861 |
total width is the actual width of the contents; thus they can be used |
| 862 |
as a component in a containing expression. E.g., |
| 863 |
\begin{equation*} |
| 864 |
\left.\begin{aligned} |
| 865 |
B'&=-\partial\times E,\\ |
| 866 |
E'&=\partial\times B - 4\pi j, |
| 867 |
\end{aligned} |
| 868 |
\right\} |
| 869 |
\qquad \text{Maxwell's equations} |
| 870 |
\end{equation*} |
| 871 |
\begin{verbatim} |
| 872 |
\begin{equation*} |
| 873 |
\left.\begin{aligned} |
| 874 |
B'&=-\partial\times E,\\ |
| 875 |
E'&=\partial\times B - 4\pi j, |
| 876 |
\end{aligned} |
| 877 |
\right\} |
| 878 |
\qquad \text{Maxwell's equations} |
| 879 |
\end{equation*} |
| 880 |
\end{verbatim} |
| 881 |
Like the \env{array} environment, these \texttt{-ed} variants also take |
| 882 |
an optional\index{options!positioning of \texttt{-ed} environments} |
| 883 |
|[t]|\index{t option@\texttt{t} (top) option}, |
| 884 |
|[b]|\index{b option@\texttt{b} (bottom) option} or the default |
| 885 |
|[c]|\index{c option@\texttt{c} (center) option} |
| 886 |
argument to specify vertical |
| 887 |
positioning. For maximum interoperability, do not insert a |
| 888 |
space\index{options!space before \texttt{[}} |
| 889 |
or line break\index{line break} before the option. See |
| 890 |
also the note on page~\pageref{breaknote} regarding page breaking |
| 891 |
within the \texttt{-ed} environments. |
| 892 |
|
| 893 |
\qq{Cases} constructions like the following are common in |
| 894 |
mathematics: |
| 895 |
\begin{equation}\label{eq:C} |
| 896 |
P_{r-j}= |
| 897 |
\begin{cases} |
| 898 |
0& \text{if $r-j$ is odd},\\ |
| 899 |
r!\,(-1)^{(r-j)/2}& \text{if $r-j$ is even}. |
| 900 |
\end{cases} |
| 901 |
\end{equation} |
| 902 |
and in the \nipkg{amsmath} package there is a \env{cases} environment to |
| 903 |
make them easy to write: |
| 904 |
\begin{verbatim} |
| 905 |
P_{r-j}=\begin{cases} |
| 906 |
0& \text{if $r-j$ is odd},\\ |
| 907 |
r!\,(-1)^{(r-j)/2}& \text{if $r-j$ is even}. |
| 908 |
\end{cases} |
| 909 |
\end{verbatim} |
| 910 |
Notice the use of \cn{text} (cf.~\secref{text}) and the nested math |
| 911 |
formulas. \env{cases} is set in \cn{textstyle}. If \cn{displaystyle} |
| 912 |
is wanted, it must be requested explicitly; \pkg{mathtools} provides |
| 913 |
a \env{dcases} environment for this purpose. |
| 914 |
|
| 915 |
The |-ed|\index{ed env@\texttt{-ed} environments|)} and \env{cases} |
| 916 |
environments must appear within an enclosing math environment, which can |
| 917 |
be either in text, between |$...$|, or in any of the display environments. |
| 918 |
|
| 919 |
%% ------------------------------------------------------------------ %% |
| 920 |
|
| 921 |
\section{Adjusting tag placement} |
| 922 |
|
| 923 |
Placing equation numbers can be a rather complex problem in multiline |
| 924 |
displays. The environments of the \nipkg{amsmath} package try hard to |
| 925 |
avoid overprinting an equation number on the equation contents, if |
| 926 |
necessary moving the number down or up to a separate line. Difficulties |
| 927 |
in accurately calculating the profile of an equation can occasionally |
| 928 |
result in number movement that doesn't look right. |
| 929 |
A \cn{raisetag} command is provided to adjust the vertical position of the |
| 930 |
current equation number, if it has been shifted away from its normal |
| 931 |
position. If it is in its normal position the command has no effect whatsoever. |
| 932 |
In particular, this means that one can't use it to shift the tag of an \env{equation} |
| 933 |
environment. |
| 934 |
|
| 935 |
To move a particular number up by six points, write |
| 936 |
|\raisetag{6pt}|. (At the end of a display, this also shifts up the |
| 937 |
text following the display.) |
| 938 |
This kind of adjustment is fine tuning like line |
| 939 |
breaks and page breaks, and should therefore be left undone until your |
| 940 |
document is nearly finalized, or you may end up redoing the fine tuning |
| 941 |
several times to keep up with changing document contents. |
| 942 |
|
| 943 |
%% ------------------------------------------------------------------ %% |
| 944 |
|
| 945 |
\section{Vertical spacing and page breaks in multiline displays} |
| 946 |
|
| 947 |
You can use the \cn{\\}|[|\<dimension>|]|% |
| 948 |
\index{options!extra vertical space after \cn{\\}} |
| 949 |
command to get extra vertical |
| 950 |
space between lines in all the \nipkg{amsmath} displayed equation |
| 951 |
environments, as is usual in \latex/. Do not type a space between the% |
| 952 |
\index{options!space before \texttt{[}} |
| 953 |
\cn{\\} and the following |[|; \emph{only} for display environments |
| 954 |
defined by \nipkg{amsmath} the space is interpreted to mean that the |
| 955 |
bracketed material is part of the document content. |
| 956 |
|
| 957 |
When the \nipkg{amsmath} package is |
| 958 |
in use \ii{page breaks} between equation lines are normally disallowed; |
| 959 |
the philosophy is that page breaks in such material should receive |
| 960 |
individual attention from the author. To get an individual page break |
| 961 |
inside a particular displayed equation, a \cn{displaybreak} command is |
| 962 |
provided. \cn{displaybreak} is best placed immediately before the |
| 963 |
\cn{\\} where it is to take effect. Like \latex/'s \cn{pagebreak}, |
| 964 |
\cn{displaybreak} takes an optional argument% |
| 965 |
\index{options!behavior of particular options} between 0 and 4 denoting |
| 966 |
the desirability of the pagebreak. |\displaybreak[0]| means \qq{it is |
| 967 |
permissible to break here} without encouraging a break; |
| 968 |
\cn{displaybreak} with no optional argument is the same as |
| 969 |
|\displaybreak[4]| and forces a break. |
| 970 |
|
| 971 |
If you prefer a strategy of letting page breaks fall where they may, |
| 972 |
even in the middle of a multiline equation, then you might put |
| 973 |
\cn{allowdisplaybreaks}\texttt{[1]} in the preamble of your document. An |
| 974 |
optional argument\index{options!behavior of particular options} |
| 975 |
1\ndash 4 can be used for finer control: |[1]| means |
| 976 |
allow page breaks, but avoid them as much as possible; values of 2,3,4 |
| 977 |
mean increasing permissiveness. When display breaks are enabled with |
| 978 |
\cn{allowdisplaybreaks}, the \cn{\\*} command can be used to prohibit a |
| 979 |
pagebreak after a given line, as usual. |
| 980 |
|
| 981 |
\begin{bfseries} |
| 982 |
Note:\label{breaknote} Certain equation environments wrap their contents |
| 983 |
in an unbreakable box, with the consequence that neither \cn{displaybreak} |
| 984 |
nor \cn{allowdisplaybreaks} will have any effect on them. These include |
| 985 |
\env{split}, \env{aligned}, \env{gathered}, and \env{alignedat}. |
| 986 |
\end{bfseries} |
| 987 |
|
| 988 |
%% ------------------------------------------------------------------ %% |
| 989 |
|
| 990 |
\section{Interrupting a display} |
| 991 |
|
| 992 |
The command \cn{intertext} is used for a short interjection of one or |
| 993 |
two lines of text\index{text fragments inside math} in the middle of a |
| 994 |
multiple-line display structure (see also the \cn{text} command in |
| 995 |
\secref{text}). Its salient feature is preservation of the alignment, |
| 996 |
which would not happen if you simply ended the display and then started |
| 997 |
it up again afterwards. \cn{intertext} may only appear right after a |
| 998 |
\cn{\\} or \cn{\\*} command. Notice the position of the word \qq{and} in |
| 999 |
this example. |
| 1000 |
\begin{align} |
| 1001 |
A_1&=N_0(\lambda;\Omega')-\phi(\lambda;\Omega'),\\ |
| 1002 |
A_2&=\phi(\lambda;\Omega')-\phi(\lambda;\Omega),\\ |
| 1003 |
\intertext{and} |
| 1004 |
A_3&=\mathcal{N}(\lambda;\omega). |
| 1005 |
\end{align} |
| 1006 |
\begin{verbatim} |
| 1007 |
\begin{align} |
| 1008 |
A_1&=N_0(\lambda;\Omega')-\phi(\lambda;\Omega'),\\ |
| 1009 |
A_2&=\phi(\lambda;\Omega')-\phi(\lambda;\Omega),\\ |
| 1010 |
\intertext{and} |
| 1011 |
A_3&=\mathcal{N}(\lambda;\omega). |
| 1012 |
\end{align} |
| 1013 |
\end{verbatim} |
| 1014 |
|
| 1015 |
The \pkg{mathtools} package provides a command \cn{shortintertext} that |
| 1016 |
is intended for use when the interjected text is only a few words; it uses |
| 1017 |
less vertical space than \cn{intertext}. This |
| 1018 |
is most effective when equation numbers are on the right.% |
| 1019 |
\index{equationn@equation numbers!left or right placement} |
| 1020 |
|
| 1021 |
%% ------------------------------------------------------------------ %% |
| 1022 |
|
| 1023 |
\section{Equation numbering} |
| 1024 |
|
| 1025 |
\subsection{Numbering hierarchy} |
| 1026 |
In \latex/ if you wanted to have equations numbered within |
| 1027 |
sections\mdash that is, have |
| 1028 |
equation numbers (1.1), (1.2), \dots, (2.1), (2.2), |
| 1029 |
\dots, in sections 1, 2, and so forth\mdash you could redefine |
| 1030 |
\cn{theequation} as suggested in the \latex/ manual \cite[\S6.3, \S |
| 1031 |
C.8.4]{lamport}: |
| 1032 |
\begin{verbatim} |
| 1033 |
\renewcommand{\theequation}{\thesection.\arabic{equation}} |
| 1034 |
\end{verbatim} |
| 1035 |
|
| 1036 |
This works pretty well, except that the equation counter won't be reset |
| 1037 |
to zero at the beginning of a new section or chapter, unless you do it |
| 1038 |
yourself using \cn{setcounter}. To make this a little more convenient, |
| 1039 |
the \nipkg{amsmath} package provides a |
| 1040 |
command\index{equationn@equation numbers!hierarchy} \cn{numberwithin}. |
| 1041 |
To have equation numbering tied to section numbering, with automatic |
| 1042 |
reset of the equation counter, write |
| 1043 |
\begin{verbatim} |
| 1044 |
\numberwithin{equation}{section} |
| 1045 |
\end{verbatim} |
| 1046 |
As its name implies, the \cn{numberwithin} command can be applied to |
| 1047 |
any counter, not just the \texttt{equation} counter. |
| 1048 |
|
| 1049 |
\subsection{Cross references to equation numbers} |
| 1050 |
|
| 1051 |
To make cross-references to equations easier, an \cn{eqref} |
| 1052 |
command\index{equationn@equation numbers!cross-references} is provided. This |
| 1053 |
automatically supplies the parentheses around the equation number. I.e., |
| 1054 |
if \verb'\ref{abc}' produces 3.2 then \verb'\eqref{abc}' produces |
| 1055 |
(3.2). The parentheses around an \cn{eqref} equation number will be |
| 1056 |
set in upright type regardless of type style of the context. |
| 1057 |
|
| 1058 |
\subsection{Subordinate numbering sequences} |
| 1059 |
|
| 1060 |
The \nipkg{amsmath} package provides also a wrapper environment, |
| 1061 |
\env{subequations}\index{equationn@equation numbers!subordinate numbering}, to make it |
| 1062 |
easy to number equations in a particular \cn{align} or similar group with |
| 1063 |
a subordinate numbering scheme. For example |
| 1064 |
\begin{verbatim} |
| 1065 |
\begin{subequations} |
| 1066 |
... |
| 1067 |
\end{subequations} |
| 1068 |
\end{verbatim} |
| 1069 |
causes all numbered equations within that part of the document to be |
| 1070 |
numbered (4.9a) (4.9b) (4.9c) \dots, if the preceding numbered |
| 1071 |
equation was (4.8). A \cn{label} command immediately after |
| 1072 |
\verb/\begin{subequations}/ will produce a \cn{ref} of the parent |
| 1073 |
number 4.9, not 4.9a. The counters used by the subequations |
| 1074 |
environment are \verb/parentequation/ and \verb/equation/ and |
| 1075 |
\cn{addtocounter}, \cn{setcounter}, \cn{value}, etc., can be applied |
| 1076 |
as usual to those counter names. To get anything other than lowercase |
| 1077 |
letters for the subordinate numbers, use standard \latex/ methods for |
| 1078 |
changing numbering style \cite[\S6.3, \S C.8.4]{lamport}. For example, |
| 1079 |
redefining \cn{theequation} as follows will produce roman numerals. |
| 1080 |
\begin{verbatim} |
| 1081 |
\begin{subequations} |
| 1082 |
\renewcommand{\theequation}{\theparentequation \roman{equation}} |
| 1083 |
... |
| 1084 |
\end{verbatim} |
| 1085 |
|
| 1086 |
\subsection{Numbering style} |
| 1087 |
|
| 1088 |
The default equation number is set in \cn{normalfont}. This means that |
| 1089 |
in bold section headings, bold is suppressed; a workaround for this is |
| 1090 |
to use \verb+(\ref{+\ldots\verb+})+ rather than \verb+\eqref{+\ldots\verb+}+. |
| 1091 |
|
| 1092 |
If smaller type is specified for a numbered display, the size of the |
| 1093 |
equation number will also be small. The default size can be ensured |
| 1094 |
throughout a document by applying this patch in the preamble: |
| 1095 |
\begin{verbatim} |
| 1096 |
\makeatletter |
| 1097 |
\renewcommand{\maketag@@@}[1]{\hbox{\m@th\normalsize\normalfont#1}}% |
| 1098 |
\makeatother |
| 1099 |
\end{verbatim} |
| 1100 |
(This modification may be included in a future version of |
| 1101 |
\nipkg{amsmath}.) |
| 1102 |
|
| 1103 |
|
| 1104 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1105 |
|
| 1106 |
\chapter{Miscellaneous mathematical features} |
| 1107 |
|
| 1108 |
\section{Matrices}\label{ss:matrix} |
| 1109 |
|
| 1110 |
The \nipkg{amsmath} package provides some environments for |
| 1111 |
matrices\index{matrices} beyond the basic \env{array} environment of |
| 1112 |
\latex/. The \env{pmatrix}, \env{bmatrix}, \env{Bmatrix}, \env{vmatrix} |
| 1113 |
and \env{Vmatrix} have (respectively) $(\,)$, $[\,]$, $\lbrace\,\rbrace$, |
| 1114 |
$\lvert\,\rvert$, and $\lVert\,\rVert$ delimiters\index{delimiters} |
| 1115 |
built in. For naming consistency there is a |
| 1116 |
\env{matrix} environment sans delimiters. This is not entirely redundant |
| 1117 |
with the \env{array} environment; the matrix environments all use more |
| 1118 |
economical horizontal spacing than the rather prodigal spacing of the |
| 1119 |
\env{array} environment. Also, unlike the \env{array} environment, you |
| 1120 |
don't have to give column specifications for any of the matrix |
| 1121 |
environments; by default you can have up to 10 centered columns.% |
| 1122 |
\footnote{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1123 |
More precisely: The maximum number of columns in a matrix is determined |
| 1124 |
by the counter |MaxMatrixCols| (normal value = 10), which you can change |
| 1125 |
if necessary using \latex/'s \cn{setcounter} or \cn{addtocounter} |
| 1126 |
commands.% |
| 1127 |
}\space%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1128 |
(If you need left or right alignment in a column or other special |
| 1129 |
formats you may use \env{array}, or the \pkg{mathtools} |
| 1130 |
package which provides \verb+*+ variants% |
| 1131 |
\index{matrix@\indexenvironmentfont{matrix} environment!\verb+*+ variants} |
| 1132 |
of these environments with |
| 1133 |
an optional argument to specify left or right alignment.) |
| 1134 |
|
| 1135 |
To produce a small matrix suitable for use in text, there is a |
| 1136 |
\env{smallmatrix} environment (e.g., |
| 1137 |
\begin{math} |
| 1138 |
\bigl( \begin{smallmatrix} |
| 1139 |
a&b\\ c&d |
| 1140 |
\end{smallmatrix} \bigr) |
| 1141 |
\end{math}) |
| 1142 |
that comes closer to fitting within a single text line than a normal |
| 1143 |
matrix. Delimiters\index{delimiters} must be provided. (The |
| 1144 |
\pkg{mathtools} package provides |p|,|b|,|B|,|v|,|V| versions of |
| 1145 |
\env{smallmatrix},% |
| 1146 |
\index{smallmatrix@\indexenvironmentfont{smallmatrix} environment!variant delimiters} |
| 1147 |
as well as |*| variants% |
| 1148 |
\index{smallmatrix@\indexenvironmentfont{smallmatrix} environment!\verb+*+ variants} |
| 1149 |
as described above.) |
| 1150 |
The above example was produced by |
| 1151 |
\begin{verbatim} |
| 1152 |
\bigl( \begin{smallmatrix} |
| 1153 |
a&b\\ c&d |
| 1154 |
\end{smallmatrix} \bigr) |
| 1155 |
\end{verbatim} |
| 1156 |
|
| 1157 |
\cn{hdotsfor}|{|\<number>|}| produces a row of dots in a |
| 1158 |
matrix\index{matrices!ellipsis dots}\index{ellipsis dots!in |
| 1159 |
matrices}\index{dots|see{ellipsis dots}} spanning the given number of |
| 1160 |
columns. For example, |
| 1161 |
\begin{center} |
| 1162 |
\begin{minipage}{.3\columnwidth} |
| 1163 |
\noindent$\begin{matrix} a&b&c&d\\ |
| 1164 |
e&\hdotsfor{3} \end{matrix}$ |
| 1165 |
\end{minipage}% |
| 1166 |
\qquad |
| 1167 |
\begin{minipage}{.45\columnwidth} |
| 1168 |
\begin{verbatim} |
| 1169 |
\begin{matrix} a&b&c&d\\ |
| 1170 |
e&\hdotsfor{3} \end{matrix} |
| 1171 |
\end{verbatim} |
| 1172 |
\end{minipage}% |
| 1173 |
\end{center} |
| 1174 |
|
| 1175 |
The spacing of the dots can be varied through use of a square-bracket |
| 1176 |
option,\index{options!behavior of particular options} |
| 1177 |
for example, |\hdotsfor[1.5]{3}|. The number in square brackets |
| 1178 |
will be used as a multiplier (i.e., the normal value is 1.0). |
| 1179 |
\begin{equation}\label{eq:D} |
| 1180 |
\begin{pmatrix} D_1t&-a_{12}t_2&\dots&-a_{1n}t_n\\ |
| 1181 |
-a_{21}t_1&D_2t&\dots&-a_{2n}t_n\\ |
| 1182 |
\hdotsfor[2]{4}\\ |
| 1183 |
-a_{n1}t_1&-a_{n2}t_2&\dots&D_nt\end{pmatrix}, |
| 1184 |
\end{equation} |
| 1185 |
\begin{verbatim} |
| 1186 |
\begin{pmatrix} D_1t&-a_{12}t_2&\dots&-a_{1n}t_n\\ |
| 1187 |
-a_{21}t_1&D_2t&\dots&-a_{2n}t_n\\ |
| 1188 |
\hdotsfor[2]{4}\\ |
| 1189 |
-a_{n1}t_1&-a_{n2}t_2&\dots&D_nt\end{pmatrix} |
| 1190 |
\end{verbatim} |
| 1191 |
|
| 1192 |
%% ------------------------------------------------------------------ %% |
| 1193 |
|
| 1194 |
\section{Math spacing commands} |
| 1195 |
|
| 1196 |
The \nipkg{amsmath} package slightly extends the set of math |
| 1197 |
spacing\index{horizontal spacing} commands, as shown below. |
| 1198 |
Both the spelled-out and abbreviated forms of these commands are robust, |
| 1199 |
and they can also be used outside of math. |
| 1200 |
\begin{ctab}{lll|lll} |
| 1201 |
Abbrev.& Spelled out& Example & Abbrev.& Spelled out& Example\\ |
| 1202 |
\hline |
| 1203 |
\vstrut{2.5ex} |
| 1204 |
& no space& \spx{}& & no space & \spx{}\\ |
| 1205 |
\cn{\,}& \cn{thinspace}& \spx{\,}& |
| 1206 |
\altcnbang& \cn{negthinspace}& \spx{\!}\\ |
| 1207 |
\cn{\:}& \cn{medspace}& \spx{\:}& |
| 1208 |
& \cn{negmedspace}& \spx{\negmedspace}\\ |
| 1209 |
\cn{\;}& \cn{thickspace}& \spx{\;}& |
| 1210 |
& \cn{negthickspace}& \spx{\negthickspace}\\ |
| 1211 |
& \cn{quad}& \spx{\quad}\\ |
| 1212 |
& \cn{qquad}& \spx{\qquad} |
| 1213 |
\end{ctab} |
| 1214 |
For the greatest possible control over math spacing, use \cn{mspace} |
| 1215 |
and `math units'. One math unit, or |mu|, is equal to 1/18 em. Thus to |
| 1216 |
get a negative \cn{quad} you could write |\mspace{-18.0mu}|. |
| 1217 |
|
| 1218 |
%% ------------------------------------------------------------------ %% |
| 1219 |
|
| 1220 |
\section{Dots} |
| 1221 |
|
| 1222 |
For preferred placement of ellipsis dots (raised or on-line) in various |
| 1223 |
contexts there is no general consensus. It may therefore be considered a |
| 1224 |
matter of taste. By using the semantically oriented commands |
| 1225 |
\begin{itemize} |
| 1226 |
\item \cn{dotsc} for \qq{dots with commas} |
| 1227 |
\item \cn{dotsb} for \qq{dots with binary operators/relations} |
| 1228 |
\item \cn{dotsm} for \qq{multiplication dots} |
| 1229 |
\item \cn{dotsi} for \qq{dots with integrals} |
| 1230 |
\item \cn{dotso} for \qq{other dots} (none of the above) |
| 1231 |
\end{itemize} |
| 1232 |
instead of \cn{ldots} and \cn{cdots}, you make it possible for your |
| 1233 |
document to be adapted to different conventions on the fly, in case (for |
| 1234 |
example) you have to submit it to a publisher who insists on following |
| 1235 |
house tradition in this respect. The default treatment for the various |
| 1236 |
kinds follows American Mathematical Society conventions: |
| 1237 |
\begin{center} |
| 1238 |
\begin{tabular}{@{}l@{}l@{}} |
| 1239 |
\begin{minipage}[t]{.54\textwidth} |
| 1240 |
\begin{verbatim} |
| 1241 |
Then we have the series $A_1, A_2, |
| 1242 |
\dotsc$, the regional sum $A_1 |
| 1243 |
+A_2 +\dotsb $, the orthogonal |
| 1244 |
product $A_1 A_2 \dotsm $, and |
| 1245 |
the infinite integral |
| 1246 |
\[\int_{A_1}\int_{A_2}\dotsi\]. |
| 1247 |
\end{verbatim} |
| 1248 |
\end{minipage} |
| 1249 |
& |
| 1250 |
\begin{minipage}[t]{.45\textwidth} |
| 1251 |
\noindent |
| 1252 |
Then we have the series $A_1,A_2,\dotsc$, |
| 1253 |
the regional sum $A_1+A_2+\dotsb$, |
| 1254 |
the orthogonal product $A_1A_2\dotsm$, |
| 1255 |
and the infinite integral |
| 1256 |
\[\int_{A_1}\int_{A_2}\dotsi.\] |
| 1257 |
\end{minipage} |
| 1258 |
\end{tabular} |
| 1259 |
\end{center} |
| 1260 |
For most situations, the undifferentiated \cn{dots} can be used, and |
| 1261 |
\nipkg{amsmath} will output the most suitable form based on the |
| 1262 |
immediate context; if an inappropriate form results, it can be corrected |
| 1263 |
after examining the output. |
| 1264 |
|
| 1265 |
%% ------------------------------------------------------------------ %% |
| 1266 |
|
| 1267 |
\section{Nonbreaking dashes} |
| 1268 |
|
| 1269 |
A command \cn{nobreakdash} is provided to suppress the possibility of a |
| 1270 |
line break\index{line break|(} after the following hyphen or dash. For |
| 1271 |
example, if you write `pages 1\ndash 9' as |pages 1\nobreakdash--9| |
| 1272 |
then a line break will never occur between the dash and the 9. You can |
| 1273 |
also use \cn{nobreakdash} to prevent undesirable hyphenations in |
| 1274 |
combinations like |$p$-adic|. For frequent use, it's advisable to make |
| 1275 |
abbreviations, e.g., |
| 1276 |
\begin{verbatim} |
| 1277 |
\newcommand{\p}{$p$\nobreakdash}% for "\p-adic" |
| 1278 |
\newcommand{\Ndash}{\nobreakdash--}% for "pages 1\Ndash 9" |
| 1279 |
% For "\n dimensional" ("n-dimensional"): |
| 1280 |
\newcommand{\n}[1]{$n$\nobreakdash-\hspace{0pt}} |
| 1281 |
\end{verbatim} |
| 1282 |
The last example shows how to prohibit a line break\index{line break|)} |
| 1283 |
after the hyphen but allow normal hyphenation in the following |
| 1284 |
word. (It suffices to add a zero-width space after the hyphen.) |
| 1285 |
|
| 1286 |
%% ------------------------------------------------------------------ %% |
| 1287 |
|
| 1288 |
\section{Accents in math} |
| 1289 |
|
| 1290 |
In ordinary \LaTeX{} the placement of the second accent in doubled math |
| 1291 |
accents is often poor. With the \nipkg{amsmath} package you |
| 1292 |
will get improved placement of the second accent: |
| 1293 |
$\hat{\hat{A}}$ (\cn{hat}|{\hat{A}}|). |
| 1294 |
|
| 1295 |
The commands \cn{dddot} and \cn{ddddot} are available to produce triple |
| 1296 |
and quadruple dot accents in addition to the \cn{dot} and \cn{ddot} |
| 1297 |
accents already available in \latex/. |
| 1298 |
|
| 1299 |
To get a superscripted hat or tilde character, load the \pkg{amsxtra} |
| 1300 |
package and use \cn{sphat} or \cn{sptilde}. Usage is \verb'A\sphat' |
| 1301 |
(note the absence of the \verb'^' character). |
| 1302 |
|
| 1303 |
|
| 1304 |
To place an arbitrary symbol in math accent position, or to get under |
| 1305 |
accents, see the \pkg{accents} package by Javier Bezos. (\nipkg{amsmath} |
| 1306 |
must be loaded before \pkg{accents}.) |
| 1307 |
|
| 1308 |
%% ------------------------------------------------------------------ %% |
| 1309 |
|
| 1310 |
\section{Roots} |
| 1311 |
|
| 1312 |
In ordinary \latex/ the placement of root indices is sometimes not so |
| 1313 |
good: $\sqrt[\beta]{k}$ (|\sqrt||[\beta]{k}|). In the |
| 1314 |
\nipkg{amsmath} package \cn{leftroot} and \cn{uproot} allow you to adjust |
| 1315 |
the position of the root:% |
| 1316 |
\index{options!adjust positioning} |
| 1317 |
\begin{verbatim} |
| 1318 |
\sqrt[\leftroot{-2}\uproot{2}\beta]{k} |
| 1319 |
\end{verbatim} |
| 1320 |
will move the beta up and to the right: |
| 1321 |
$\sqrt[\leftroot{-2}\uproot{2}\beta]{k}$. The negative argument used |
| 1322 |
with \cn{leftroot} moves the $\beta$ to the right. The units are a small |
| 1323 |
amount that is a useful size for such adjustments. |
| 1324 |
|
| 1325 |
%% ------------------------------------------------------------------ %% |
| 1326 |
|
| 1327 |
\section{Boxed formulas} |
| 1328 |
|
| 1329 |
The command \cn{boxed} puts a box around its |
| 1330 |
argument, like \cn{fbox} except that the contents are in math mode: |
| 1331 |
\begin{equation} |
| 1332 |
\boxed{\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))} |
| 1333 |
\end{equation} |
| 1334 |
\begin{verbatim} |
| 1335 |
\boxed{\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))} |
| 1336 |
\end{verbatim} |
| 1337 |
|
| 1338 |
%% ------------------------------------------------------------------ %% |
| 1339 |
|
| 1340 |
\section{Over and under arrows} |
| 1341 |
|
| 1342 |
Basic \latex/ provides \cn{overrightarrow} and \cn{overleftarrow} |
| 1343 |
commands. Some additional over and under arrow commands are provided |
| 1344 |
by the \nipkg{amsmath} package to extend the set: |
| 1345 |
|
| 1346 |
\begin{tabbing} |
| 1347 |
\qquad\=\ncn{overleftrightarrow}\qquad\=\kill |
| 1348 |
\> \cn{overleftarrow} \> \cn{underleftarrow} \+\\ |
| 1349 |
\cn{overrightarrow} \> \cn{underrightarrow} \\ |
| 1350 |
\cn{overleftrightarrow}\> \cn{underleftrightarrow} |
| 1351 |
\end{tabbing} |
| 1352 |
|
| 1353 |
%% ------------------------------------------------------------------ %% |
| 1354 |
|
| 1355 |
\section{Extensible arrows} |
| 1356 |
|
| 1357 |
\cn{xleftarrow} and \cn{xrightarrow} produce |
| 1358 |
arrows\index{arrows!extensible} that extend automatically to accommodate |
| 1359 |
unusually wide subscripts or superscripts. These commands take one |
| 1360 |
optional argument\index{options!behavior of particular options} |
| 1361 |
(the subscript) and one mandatory argument (the |
| 1362 |
superscript, possibly empty): |
| 1363 |
\begin{equation} |
| 1364 |
A\xleftarrow{n+\mu-1}B \xrightarrow[T]{n\pm i-1}C |
| 1365 |
\end{equation} |
| 1366 |
\begin{verbatim} |
| 1367 |
\xleftarrow{n+\mu-1}\quad \xrightarrow[T]{n\pm i-1} |
| 1368 |
\end{verbatim} |
| 1369 |
|
| 1370 |
%% ------------------------------------------------------------------ %% |
| 1371 |
|
| 1372 |
\section{Affixing symbols to other symbols} |
| 1373 |
|
| 1374 |
\latex/ provides \cn{stackrel} for placing a |
| 1375 |
superscript\index{subscripts and superscripts} above a binary relation. |
| 1376 |
In the \nipkg{amsmath} package there are somewhat more general commands, |
| 1377 |
\cn{overset} and \cn{underset}, that can be used to place one symbol |
| 1378 |
above or below another symbol, whether it's a relation or something |
| 1379 |
else. The input |\overset{*}{X}| will place a superscript-size {\small$*$} above |
| 1380 |
the {\small$X$}: {\small$\smash{\overset{*}{X}}$}; |
| 1381 |
\cn{underset} is the analog for adding a |
| 1382 |
symbol underneath. The command \cn{overunderset} is a combination of |
| 1383 |
these, taking three arguments to place superscript sized expressions |
| 1384 |
above and below the same base. |
| 1385 |
|
| 1386 |
See also the description of \cn{sideset} in \secref{sideset}. |
| 1387 |
|
| 1388 |
%% ------------------------------------------------------------------ %% |
| 1389 |
|
| 1390 |
\section{Fractions and related constructions} |
| 1391 |
|
| 1392 |
\subsection{The \cn{frac}, \cn{dfrac}, and \cn{tfrac} commands} |
| 1393 |
|
| 1394 |
The \cn{frac} command, which is in the basic command set of |
| 1395 |
\latex/,\index{fractions|(} takes two arguments\mdash numerator and |
| 1396 |
denominator\mdash and typesets them in normal fraction form. The |
| 1397 |
\nipkg{amsmath} package provides also \cn{dfrac} and \cn{tfrac} as |
| 1398 |
convenient abbreviations for |{\displaystyle\frac| |...| |}| |
| 1399 |
and\indexcs{textstyle}\relax |
| 1400 |
\indexcs{displaystyle} |{\textstyle\frac| |...| |}|. |
| 1401 |
\begin{equation} |
| 1402 |
\frac{1}{k}\log_2 c(f)\quad\tfrac{1}{k}\log_2 c(f)\quad |
| 1403 |
\sqrt{\frac{1}{k}\log_2 c(f)}\quad\sqrt{\dfrac{1}{k}\log_2 c(f)} |
| 1404 |
\end{equation} |
| 1405 |
\begin{verbatim} |
| 1406 |
\begin{equation} |
| 1407 |
\frac{1}{k}\log_2 c(f)\;\tfrac{1}{k}\log_2 c(f)\; |
| 1408 |
\sqrt{\frac{1}{k}\log_2 c(f)}\;\sqrt{\dfrac{1}{k}\log_2 c(f)} |
| 1409 |
\end{equation} |
| 1410 |
\end{verbatim} |
| 1411 |
|
| 1412 |
\subsection{The \cn{binom}, \cn{dbinom}, and \cn{tbinom} commands} |
| 1413 |
|
| 1414 |
For binomial expressions\index{binomials} such as $\binom{n}{k}$ |
| 1415 |
\nipkg{amsmath} has \cn{binom}, \cn{dbinom} and \cn{tbinom}: |
| 1416 |
\begin{equation} |
| 1417 |
2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2} |
| 1418 |
\end{equation} |
| 1419 |
\begin{verbatim} |
| 1420 |
2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2} |
| 1421 |
\end{verbatim} |
| 1422 |
|
| 1423 |
\subsection{The \cn{genfrac} command} |
| 1424 |
|
| 1425 |
The capabilities of \cn{frac}, \cn{binom}, and their variants are |
| 1426 |
subsumed by a generalized fraction command \cn{genfrac} with six |
| 1427 |
arguments. The last two correspond to \cn{frac}'s numerator and |
| 1428 |
denominator; the first two are optional delimiters\index{delimiters} (as |
| 1429 |
seen in \cn{binom}); the third is a line thickness override (\cn{binom} |
| 1430 |
uses this to set the fraction line thickness to 0\mdash i.e., invisible); |
| 1431 |
and the fourth argument is a mathstyle override: integer values 0\ndash 3 |
| 1432 |
select respectively \cn{displaystyle}, \cn{textstyle}, \cn{scriptstyle}, |
| 1433 |
and \cn{scriptscriptstyle}. If the third argument is left empty, the line |
| 1434 |
thickness defaults to `normal'. |
| 1435 |
|
| 1436 |
\begin{center}\begin{minipage}{.85\columnwidth} |
| 1437 |
\raggedright \normalfont\ttfamily \exhyphenpenalty10000 |
| 1438 |
\newcommand{\ma}[1]{% |
| 1439 |
\string{{\normalfont\itshape#1}\string}\penalty9999 \ignorespaces} |
| 1440 |
\string\genfrac \ma{left-delim} \ma{right-delim} \ma{thickness} |
| 1441 |
\ma{mathstyle} \ma{numerator} \ma{denominator} |
| 1442 |
\end{minipage}\end{center} |
| 1443 |
To illustrate, here is how \cn{frac}, \cn{tfrac}, and |
| 1444 |
\cn{binom} might be defined. |
| 1445 |
\begin{verbatim} |
| 1446 |
\newcommand{\frac}[2]{\genfrac{}{}{}{}{#1}{#2}} |
| 1447 |
\newcommand{\tfrac}[2]{\genfrac{}{}{}{1}{#1}{#2}} |
| 1448 |
\newcommand{\binom}[2]{\genfrac{(}{)}{0pt}{}{#1}{#2}} |
| 1449 |
\end{verbatim} |
| 1450 |
If you find yourself repeatedly using \cn{genfrac} throughout a document |
| 1451 |
for a particular notation, you will do yourself a favor (and your |
| 1452 |
publisher) if you define a meaningfully-named abbreviation for that |
| 1453 |
notation, along the lines of \cn{frac} and \cn{binom}. |
| 1454 |
|
| 1455 |
The primitive generalized fraction commands \cs{over}, \cs{overwithdelims}, |
| 1456 |
\cs{atop}, \cs{atopwithdelims}, \cs{above}, \cs{abovewithdelims} produce |
| 1457 |
warning messages if used with the \nipkg{amsmath} package, for reasons |
| 1458 |
discussed in \fn{technote.tex}. |
| 1459 |
|
| 1460 |
%% ------------------------------------------------------------------ %% |
| 1461 |
|
| 1462 |
\section{Continued fractions} |
| 1463 |
|
| 1464 |
The continued fraction\index{continued fractions} |
| 1465 |
\begin{equation} |
| 1466 |
\cfrac{1}{\sqrt{2}+ |
| 1467 |
\cfrac{1}{\sqrt{2}+ |
| 1468 |
\cfrac{1}{\sqrt{2}+\cdots |
| 1469 |
}}} |
| 1470 |
\end{equation} |
| 1471 |
can be obtained by typing |
| 1472 |
{\samepage |
| 1473 |
\begin{verbatim} |
| 1474 |
\cfrac{1}{\sqrt{2}+ |
| 1475 |
\cfrac{1}{\sqrt{2}+ |
| 1476 |
\cfrac{1}{\sqrt{2}+\dotsb |
| 1477 |
}}} |
| 1478 |
\end{verbatim} |
| 1479 |
}% End of \samepage |
| 1480 |
This produces better-looking results than straightforward use of |
| 1481 |
\cn{frac}. Left or right placement of any of the numerators is |
| 1482 |
accomplished by using \cn{cfrac}|[l]| or \cn{cfrac}|[r]| instead of |
| 1483 |
\cn{cfrac}.\index{options!adjust positioning}% |
| 1484 |
\index{fractions|)} |
| 1485 |
|
| 1486 |
%% ------------------------------------------------------------------ %% |
| 1487 |
|
| 1488 |
\section{Smash options} |
| 1489 |
|
| 1490 |
The command \cn{smash} is used to typeset a subformula with an |
| 1491 |
effective height and depth of zero, which is sometimes |
| 1492 |
useful in adjusting the subformula's position with respect to adjacent |
| 1493 |
symbols. With the \nipkg{amsmath} package \cn{smash} has optional |
| 1494 |
arguments\index{options!behavior of particular options} |
| 1495 |
|[t]|\index{t option@\texttt{t} (top) option} and |
| 1496 |
|[b]|\index{b option@\texttt{b} (bottom) option} because occasionally it is |
| 1497 |
advantageous to be able to \qq{smash} only the top or only the bottom |
| 1498 |
of something while retaining the natural depth or height. For example, |
| 1499 |
when adjacent radical symbols are unevenly sized or positioned because |
| 1500 |
of differences in the height and depth of their contents, \cn{smash} |
| 1501 |
can be employed to make them more consistent. Compare |
| 1502 |
$\sqrt{x}+\sqrt{y}+\sqrt{z}$ and $\sqrt{x}+\sqrt{\smash[b]{y}}+\sqrt{z}$, |
| 1503 |
where the latter was produced by |
| 1504 |
\verb"$\sqrt{x}" \verb"+" |
| 1505 |
\verb"\sqrt{"\5\verb"\smash[b]{y}}" \verb"+" \verb"\sqrt{z}$". |
| 1506 |
|
| 1507 |
%% ------------------------------------------------------------------ %% |
| 1508 |
|
| 1509 |
\section{Delimiters} |
| 1510 |
|
| 1511 |
\index{delimiters|(} |
| 1512 |
|
| 1513 |
\subsection{Delimiter sizes}\label{bigdel} |
| 1514 |
|
| 1515 |
The automatic delimiter sizing done by \cn{left} and \cn{right} has two |
| 1516 |
limitations: First, it is applied mechanically to produce delimiters |
| 1517 |
large enough to encompass the largest contained item, and second, the |
| 1518 |
range of sizes is not even approximately continuous but has fairly large |
| 1519 |
quantum jumps. This means that a math fragment that is infinitesimally |
| 1520 |
too large for a given delimiter size will get the next larger size, a |
| 1521 |
jump of 3pt or so in normal-sized text. There are two or three |
| 1522 |
situations where the delimiter size is commonly adjusted, using a set of |
| 1523 |
commands that have `big' in their names.% |
| 1524 |
\index{delimiters!fixed size|(} |
| 1525 |
\begin{ctab}{l|llllll} |
| 1526 |
Delimiter& |
| 1527 |
text& \ncn{left}& \ncn{bigl}& \ncn{Bigl}& \ncn{biggl}& \ncn{Biggl}\\ |
| 1528 |
size& |
| 1529 |
size& \ncn{right}& \ncn{bigr}& \ncn{Bigr}& \ncn{biggr}& \ncn{Biggr}\\ |
| 1530 |
\hline |
| 1531 |
Result\vstrut{5ex}& |
| 1532 |
$\displaystyle(b)(\frac{c}{d})$& |
| 1533 |
$\displaystyle\left(b\right)\left(\frac{c}{d}\right)$& |
| 1534 |
$\displaystyle\bigl(b\bigr)\bigl(\frac{c}{d}\bigr)$& |
| 1535 |
$\displaystyle\Bigl(b\Bigr)\Bigl(\frac{c}{d}\Bigr)$& |
| 1536 |
$\displaystyle\biggl(b\biggr)\biggl(\frac{c}{d}\biggr)$& |
| 1537 |
$\displaystyle\Biggl(b\Biggr)\Biggl(\frac{c}{d}\Biggr)$ |
| 1538 |
\end{ctab} |
| 1539 |
The first kind of situation is a cumulative operator with limits above |
| 1540 |
and below. With \cn{left} and \cn{right} the delimiters usually turn out |
| 1541 |
larger than necessary, and using the |Big| or |bigg| |
| 1542 |
sizes\index{big@\cn{big}, \cn{Big}, \cn{bigg}, \dots\ delimiters} |
| 1543 |
instead gives better results: |
| 1544 |
\begin{equation*} |
| 1545 |
\left[\sum_i a_i\left\lvert\sum_j x_{ij}\right\rvert^p\right]^{1/p} |
| 1546 |
\quad\text{versus}\quad |
| 1547 |
\biggl[\sum_i a_i\Bigl\lvert\sum_j x_{ij}\Bigr\rvert^p\biggr]^{1/p} |
| 1548 |
\end{equation*} |
| 1549 |
\begin{verbatim} |
| 1550 |
\biggl[\sum_i a_i\Bigl\lvert\sum_j x_{ij}\Bigr\rvert^p\biggr]^{1/p} |
| 1551 |
\end{verbatim} |
| 1552 |
The second kind of situation is clustered pairs of delimiters where |
| 1553 |
\cn{left} and \cn{right} make them all the same size (because that is |
| 1554 |
adequate to cover the encompassed material) but what you really want |
| 1555 |
is to make some of the delimiters slightly larger to make the nesting |
| 1556 |
easier to see. |
| 1557 |
\begin{equation*} |
| 1558 |
\left((a_1 b_1) - (a_2 b_2)\right) |
| 1559 |
\left((a_2 b_1) + (a_1 b_2)\right) |
| 1560 |
\quad\text{versus}\quad |
| 1561 |
\bigl((a_1 b_1) - (a_2 b_2)\bigr) |
| 1562 |
\bigl((a_2 b_1) + (a_1 b_2)\bigr) |
| 1563 |
\end{equation*} |
| 1564 |
\begin{verbatim} |
| 1565 |
\left((a_1 b_1) - (a_2 b_2)\right) |
| 1566 |
\left((a_2 b_1) + (a_1 b_2)\right) |
| 1567 |
\quad\text{versus}\quad |
| 1568 |
\bigl((a_1 b_1) - (a_2 b_2)\bigr) |
| 1569 |
\bigl((a_2 b_1) + (a_1 b_2)\bigr) |
| 1570 |
\end{verbatim} |
| 1571 |
The third kind of situation is a slightly oversize object in running |
| 1572 |
text, such as $\left\lvert\frac{b'}{d'}\right\rvert$ where the |
| 1573 |
delimiters produced by \cn{left} and \cn{right} cause too much line |
| 1574 |
spreading. In that case \ncn{bigl} and \ncn{bigr}\index{big@\cn{big}, |
| 1575 |
\cn{Big}, \cn{bigg}, \dots\ delimiters} can be used to produce |
| 1576 |
delimiters that are slightly larger than the base size but still able to |
| 1577 |
fit within the normal line spacing: |
| 1578 |
$\bigl\lvert\frac{b'}{d'}\bigr\rvert$. |
| 1579 |
|
| 1580 |
In ordinary \latex/ \ncn{big}, \ncn{bigg}, \ncn{Big}, and \ncn{Bigg} |
| 1581 |
delimiters aren't scaled properly over the full range of \latex/ font |
| 1582 |
sizes. With the \nipkg{amsmath} package they are.% |
| 1583 |
\index{delimiters!fixed size|)} |
| 1584 |
|
| 1585 |
\subsection{Vertical bar notations} |
| 1586 |
|
| 1587 |
The \nipkg{amsmath} package provides commands \cn{lvert}, \cn{rvert}, |
| 1588 |
\cn{lVert}, \cn{rVert} (compare \cn{langle}, \cn{rangle}) to address the |
| 1589 |
%problem of overloading for the vert bar character \qc{\|}. This |
| 1590 |
problem of overloading for the vert bar character \qcvert. This |
| 1591 |
character is currently used in \latex/ documents to represent a wide |
| 1592 |
variety of mathematical objects: the `divides' relation in a |
| 1593 |
number-theory expression like $p\vert q$, or the absolute-value |
| 1594 |
operation $\lvert z\rvert$, or the `such that' condition in set |
| 1595 |
notation, or the `evaluated at' notation $f_\zeta(t)\bigr\rvert_{t=0}$. |
| 1596 |
The multiplicity of uses in itself is not so bad; what is bad, however, |
| 1597 |
is that fact that not all of the uses take the same typographical |
| 1598 |
treatment, and that the complex discriminatory powers of a knowledgeable |
| 1599 |
reader cannot be replicated in computer processing of mathematical |
| 1600 |
documents. It is recommended therefore that there should be a one-to-one |
| 1601 |
correspondence in any given document between the vert bar character |
| 1602 |
%\qc{\|} and a selected mathematical notation, and similarly for the |
| 1603 |
\qcvert\ and a selected mathematical notation, and similarly for the |
| 1604 |
%double-bar command \ncn{\|}\index{"|@\verb"*+"\"|+}. This immediately |
| 1605 |
double-bar command \cnvert. This immediately |
| 1606 |
rules out the use of \qc{|} |
| 1607 |
%and \ncn{\|}\index{"|@\verb"*+"\"|+} for delimiters, because left and right |
| 1608 |
and \cnvert\ for delimiters, because left and right |
| 1609 |
delimiters are distinct usages that do not relate in the same way to |
| 1610 |
adjacent symbols; recommended practice is therefore to define suitable |
| 1611 |
commands in the document preamble for any paired-delimiter use of vert |
| 1612 |
bar symbols: |
| 1613 |
\begin{verbatim} |
| 1614 |
\providecommand{\abs}[1]{\lvert#1\rvert} |
| 1615 |
\providecommand{\norm}[1]{\lVert#1\rVert} |
| 1616 |
\end{verbatim} |
| 1617 |
whereupon the document would contain |\abs{z}| to produce $\lvert |
| 1618 |
z\rvert$ and |\norm{v}| to produce $\lVert v\rVert$. |
| 1619 |
The \pkg{mathtools} provides the command \cn{DeclarePairedDelimiter} |
| 1620 |
for defining |\abs|-like macros with scaling delimiters. |
| 1621 |
\index{delimiters|)} |
| 1622 |
|
| 1623 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1624 |
|
| 1625 |
\chapter{Operator names} |
| 1626 |
|
| 1627 |
\section{Defining new operator names}\label{s:opname} |
| 1628 |
|
| 1629 |
Math functions\index{operator names}\relax \index{function |
| 1630 |
names|see{operator names}} such as $\log$, $\sin$, and $\lim$ are |
| 1631 |
traditionally typeset in roman type to make them visually more distinct |
| 1632 |
from one-letter math variables, which are set in math italic. The more |
| 1633 |
common ones have predefined names, \cn{log}, \cn{sin}, \cn{lim}, and so |
| 1634 |
forth, but new ones come up all the time in mathematical papers, so the |
| 1635 |
\nipkg{amsmath} package provides a general mechanism for defining new |
| 1636 |
`operator names'. To define a math function \ncn{xxx} to work like |
| 1637 |
\cn{sin}, you write |
| 1638 |
\begin{verbatim} |
| 1639 |
\DeclareMathOperator{\xxx}{xxx} |
| 1640 |
\end{verbatim} |
| 1641 |
whereupon ensuing uses of \ncn{xxx} will produce {\upshape xxx} in the |
| 1642 |
proper font and automatically add proper spacing\index{horizontal |
| 1643 |
spacing!around operator names} on either side when necessary, so that you |
| 1644 |
get $A\xxx B$ instead of $A\mathrm{xxx}B$. In the second argument of |
| 1645 |
\cn{DeclareMathOperator} (the name text), a pseudo-text mode prevails: |
| 1646 |
the hyphen character \qc{\-} will print as a text hyphen rather than a |
| 1647 |
minus sign and an asterisk \qc{\*} will print as a raised text asterisk |
| 1648 |
instead of a centered math star. (Compare |
| 1649 |
\textit{a}-\textit{b}*\textit{c} and $a-b*c$.) But otherwise the name |
| 1650 |
text is printed in math mode, so that you can use, e.g., subscripts and |
| 1651 |
superscripts there. |
| 1652 |
|
| 1653 |
%%%%xxx%%%\enlargethispage{1\baselineskip} |
| 1654 |
If the new operator should have subscripts and superscripts placed in |
| 1655 |
`limits' position above and below as with $\lim$, $\sup$, or $\max$, use |
| 1656 |
the \qc{\*} form of the \cn{DeclareMathOperator} command: |
| 1657 |
\begin{verbatim} |
| 1658 |
\DeclareMathOperator*{\Lim}{Lim} |
| 1659 |
\end{verbatim} |
| 1660 |
See also the discussion of subscript placement in |
| 1661 |
Section~\ref{subplace}. |
| 1662 |
|
| 1663 |
\goodbreak |
| 1664 |
|
| 1665 |
The following operator names are predefined: |
| 1666 |
|
| 1667 |
\vspace{-1\baselineskip} |
| 1668 |
\begin{ctab}{@{}rlrlrlrl} |
| 1669 |
\cn{arccos}& $\arccos$ &\cn{deg}& $\deg$ & \cn{lg}& $\lg$ & \cn{projlim}& $\projlim$\\ |
| 1670 |
\cn{arcsin}& $\arcsin$ &\cn{det}& $\det$ & \cn{lim}& $\lim$ & \cn{sec}& $\sec$\\ |
| 1671 |
\cn{arctan}& $\arctan$ &\cn{dim}& $\dim$ & \cn{liminf}& $\liminf$ &\cn{sin}& $\sin$\\ |
| 1672 |
\cn{arg}& $\arg$ & \cn{exp}& $\exp$ & \cn{limsup}& $\limsup$ &\cn{sinh}& $\sinh$\\ |
| 1673 |
\cn{cos}& $\cos$ & \cn{gcd}& $\gcd$ & \cn{ln}& $\ln$ & \cn{sup}& $\sup$\\ |
| 1674 |
\cn{cosh}& $\cosh$ & \cn{hom}& $\hom$ & \cn{log}& $\log$ & \cn{tan}& $\tan$\\ |
| 1675 |
\cn{cot}& $\cot$ & \cn{inf}& $\inf$ & \cn{max}& $\max$ & \cn{tanh}& $\tanh$\\ |
| 1676 |
\cn{coth}& $\coth$ & \cn{injlim}& $\injlim$ &\cn{min}& $\min$\\ |
| 1677 |
\cn{csc}& $\csc$ & \cn{ker}& $\ker$ & \cn{Pr}& $\Pr$ |
| 1678 |
\end{ctab} |
| 1679 |
\par\nobreak |
| 1680 |
\vspace{-1.2\baselineskip} |
| 1681 |
\begin{ctab}{rlrl} |
| 1682 |
\cn{varinjlim}& $\displaystyle\varinjlim$& |
| 1683 |
\cn{varliminf}& $\displaystyle\varliminf$\\ |
| 1684 |
\cn{varprojlim}& $\displaystyle\varprojlim$& |
| 1685 |
\cn{varlimsup}& $\displaystyle\varlimsup$ |
| 1686 |
\end{ctab} |
| 1687 |
|
| 1688 |
There is also a command \cn{operatorname} such that using |
| 1689 |
\begin{verbatim} |
| 1690 |
\operatorname{abc} |
| 1691 |
\end{verbatim} |
| 1692 |
in a math formula is equivalent to a use of \ncn{abc} defined by |
| 1693 |
\cn{DeclareMathOperator}. This may be occasionally useful for |
| 1694 |
constructing more complex notation or other purposes. (Use the variant |
| 1695 |
\cn{operatorname*} to get limits.) |
| 1696 |
|
| 1697 |
%% ------------------------------------------------------------------ %% |
| 1698 |
|
| 1699 |
\section{\cn{mod} and its relatives} |
| 1700 |
|
| 1701 |
Commands \cn{mod}, \cn{bmod}, \cn{pmod}, \cn{pod} are provided to deal |
| 1702 |
with the special spacing conventions of \qq{mod} notation. \cn{bmod} and |
| 1703 |
\cn{pmod} are available in \latex/, but with the \nipkg{amsmath} package |
| 1704 |
the spacing of \cn{pmod} will adjust to a smaller value if it's used in |
| 1705 |
a non-display-mode formula. \cn{mod} and \cn{pod} are variants of |
| 1706 |
\cn{pmod} preferred by some authors; \cn{mod} omits the parentheses, |
| 1707 |
whereas \cn{pod} omits the \qq{mod} and retains the parentheses. |
| 1708 |
\begin{equation} |
| 1709 |
\gcd(n,m\bmod n);\quad x\equiv y\pmod b; |
| 1710 |
\quad x\equiv y\mod c;\quad x\equiv y\pod d |
| 1711 |
\end{equation} |
| 1712 |
\begin{verbatim} |
| 1713 |
\gcd(n,m\bmod n);\quad x\equiv y\pmod b; |
| 1714 |
\quad x\equiv y\mod c;\quad x\equiv y\pod d |
| 1715 |
\end{verbatim} |
| 1716 |
|
| 1717 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1718 |
\enlargethispage{1\baselineskip} |
| 1719 |
|
| 1720 |
\chapter{The \cn{text} command}\label{text} |
| 1721 |
|
| 1722 |
The main use of the command \cn{text} is for words or |
| 1723 |
phrases\index{text fragments inside math} in a display. It is very |
| 1724 |
similar to the \latex/ command \cn{mbox} in its effects, but has a |
| 1725 |
couple of advantages. If you want a word or phrase of text in a |
| 1726 |
subscript, you can type |..._{\textrm{word or phrase}}|, which is slightly |
| 1727 |
easier than the \cn{mbox} equivalent: |..._{\mbox{\rmfamily\scriptsize| |word| |
| 1728 |
|or| |phrase}}|. Note that the standard \cn{textrm} command will use the |
| 1729 |
\nipkg{amsmath} \cn{text} definition, but ensure the \verb+\rmfamily+ |
| 1730 |
font is used. |
| 1731 |
\begin{equation} |
| 1732 |
f_{[x_{i-1},x_i]} \text{ is monotonic,} |
| 1733 |
\quad i = 1,\dots,c+1 |
| 1734 |
\end{equation} |
| 1735 |
\begin{verbatim} |
| 1736 |
f_{[x_{i-1},x_i]} \text{ is monotonic,} |
| 1737 |
\quad i = 1,\dots,c+1 |
| 1738 |
\end{verbatim} |
| 1739 |
|
| 1740 |
The font used for \cn{text} is the same as that of the surrounding |
| 1741 |
environment; i.e., within a theorem, the contents of \cn{text} will |
| 1742 |
be set in italic. |
| 1743 |
|
| 1744 |
If a math expression is included in a \cn{text} string, it must be |
| 1745 |
explicitly marked as math (|$...$|). |
| 1746 |
\[ |
| 1747 |
\partial_s f(x) = \frac{\partial}{\partial x_0} f(x)\quad |
| 1748 |
\text{for $x= x_0 + I x_1$.} |
| 1749 |
\] |
| 1750 |
\begin{verbatim} |
| 1751 |
\partial_s f(x) = \frac{\partial}{\partial x_0} f(x)\quad |
| 1752 |
\text{for $x= x_0 + I x_1$.} |
| 1753 |
\end{verbatim} |
| 1754 |
|
| 1755 |
Function names should \emph{not} be entered as \cn{text}. Instead, |
| 1756 |
use \cn{mathrm} or \cn{DeclareMathOperator} as appropriate. These are |
| 1757 |
fixed entities that should not change depending on outside content |
| 1758 |
(such as appearing within a theorem that is set in italic), and in the |
| 1759 |
case of declared operators, proper spacing\index{horizontal |
| 1760 |
spacing!around operator names} is applied automatically. |
| 1761 |
|
| 1762 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1763 |
|
| 1764 |
\chapter{Integrals and sums} |
| 1765 |
|
| 1766 |
\section{Multiline subscripts and superscripts} |
| 1767 |
|
| 1768 |
The \cn{substack} command can be used to produce a multiline subscript |
| 1769 |
or superscript:\index{subscripts and superscripts!multiline}\relax |
| 1770 |
\index{superscripts|see{subscripts and superscripts}} for example |
| 1771 |
\begin{ctab}{ll} |
| 1772 |
\begin{minipage}[t]{.6\columnwidth} |
| 1773 |
\begin{verbatim} |
| 1774 |
\sum_{\substack{ |
| 1775 |
0\le i\le m\\ |
| 1776 |
0<j<n}} |
| 1777 |
P(i,j) |
| 1778 |
\end{verbatim} |
| 1779 |
\end{minipage} |
| 1780 |
& |
| 1781 |
$\displaystyle |
| 1782 |
\sum_{\substack{0\le i\le m\\ 0<j<n}} P(i,j)$ |
| 1783 |
\end{ctab} |
| 1784 |
A slightly more generalized form is the \env{subarray} environment which |
| 1785 |
allows you to specify that each line should be left-aligned instead of |
| 1786 |
centered, as here: |
| 1787 |
\begin{ctab}{ll} |
| 1788 |
\begin{minipage}[t]{.6\columnwidth} |
| 1789 |
\begin{verbatim} |
| 1790 |
\sum_{\begin{subarray}{l} |
| 1791 |
i\in\Lambda\\ 0<j<n |
| 1792 |
\end{subarray}} |
| 1793 |
P(i,j) |
| 1794 |
\end{verbatim} |
| 1795 |
\end{minipage} |
| 1796 |
& |
| 1797 |
$\displaystyle |
| 1798 |
\sum_{\begin{subarray}{l} |
| 1799 |
i\in \Lambda\\ 0<j<n |
| 1800 |
\end{subarray}} |
| 1801 |
P(i,j)$ |
| 1802 |
\end{ctab} |
| 1803 |
|
| 1804 |
%% ------------------------------------------------------------------ %% |
| 1805 |
|
| 1806 |
\section{The \cn{sideset} command}\label{sideset} |
| 1807 |
|
| 1808 |
There's also a command called \cn{sideset}, for a rather special |
| 1809 |
purpose: putting symbols at the subscript and |
| 1810 |
superscript\index{subscripts and superscripts!on sums} corners of a |
| 1811 |
large operator symbol such as $\sum$ or $\prod$. \emph{Note: this |
| 1812 |
command is not designed to be applied to anything other than sum-class |
| 1813 |
symbols.} The prime |
| 1814 |
example is the case when you want to put a prime on a sum symbol. If |
| 1815 |
there are no limits above or below the sum, you could just use |
| 1816 |
\cn{nolimits}: here's |
| 1817 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1818 |
|\sum\nolimits' E_n| in display mode: |
| 1819 |
\begin{equation} |
| 1820 |
\sum\nolimits' E_n |
| 1821 |
\end{equation} |
| 1822 |
If, however, you want not only the prime but also something below or |
| 1823 |
above the sum symbol, it's not so easy\mdash indeed, without |
| 1824 |
\cn{sideset}, it would be downright difficult. With \cn{sideset}, you |
| 1825 |
can write |
| 1826 |
\begin{ctab}{ll} |
| 1827 |
\begin{minipage}[t]{.6\columnwidth} |
| 1828 |
\begin{verbatim} |
| 1829 |
\sideset{}{'} |
| 1830 |
\sum_{n<k,\;\text{$n$ odd}} nE_n |
| 1831 |
\end{verbatim} |
| 1832 |
\end{minipage} |
| 1833 |
&$\displaystyle |
| 1834 |
\sideset{}{'}\sum_{n<k,\;\text{$n$ odd}} nE_n |
| 1835 |
$ |
| 1836 |
\end{ctab} |
| 1837 |
The extra pair of empty braces is explained by the fact that |
| 1838 |
\cn{sideset} has the capability of putting an extra symbol or symbols at |
| 1839 |
each corner of a large operator; to put an asterisk at each corner of a |
| 1840 |
product symbol, you would type |
| 1841 |
\begin{ctab}{ll} |
| 1842 |
\begin{minipage}[t]{.6\columnwidth} |
| 1843 |
\begin{verbatim} |
| 1844 |
\sideset{_*^*}{_*^*}\prod |
| 1845 |
\end{verbatim} |
| 1846 |
\end{minipage} |
| 1847 |
&$\displaystyle |
| 1848 |
\sideset{_*^*}{_*^*}\prod |
| 1849 |
$ |
| 1850 |
\end{ctab} |
| 1851 |
|
| 1852 |
%% ------------------------------------------------------------------ %% |
| 1853 |
|
| 1854 |
\section{Placement of subscripts and limits}\label{subplace} |
| 1855 |
|
| 1856 |
The default positioning for subscripts depends on the |
| 1857 |
base symbol involved. The default for sum-class symbols is |
| 1858 |
`displaylimits' positioning: When a sum-class symbol appears |
| 1859 |
in a displayed formula, subscript and superscript are placed in `limits' |
| 1860 |
position above and below, but in an inline formula, they are placed to |
| 1861 |
the side, to avoid unsightly and wasteful spreading of the |
| 1862 |
surrounding text lines. |
| 1863 |
The default for integral-class symbols is to have sub- and |
| 1864 |
superscripts always to the side, even in displayed formulas. |
| 1865 |
(See the discussion of the \opt{intlimits} and related |
| 1866 |
options\index{options!behavior of particular options} in |
| 1867 |
Section~\ref{options}.) |
| 1868 |
|
| 1869 |
Operator names such as $\sin$ or $\lim$ may have either `displaylimits' |
| 1870 |
or `limits' positioning depending on how they were defined. The standard |
| 1871 |
operator names are defined according to normal mathematical usage. |
| 1872 |
|
| 1873 |
The commands \cn{limits} and \cn{nolimits} can be used to override the |
| 1874 |
normal behavior of a base symbol: |
| 1875 |
\begin{equation*} |
| 1876 |
\sum\nolimits_X,\qquad \iint\limits_{A}, |
| 1877 |
\qquad\varliminf\nolimits_{n\to \infty} |
| 1878 |
\end{equation*} |
| 1879 |
To define a command whose subscripts follow the |
| 1880 |
same `displaylimits' behavior as \cn{sum}, put |
| 1881 |
\cn{displaylimits} at the tail end of the definition. When multiple |
| 1882 |
instances of \cn{limits}, \cn{nolimits}, or \cn{displaylimits} occur |
| 1883 |
consecutively, the last one takes precedence. |
| 1884 |
|
| 1885 |
%% ------------------------------------------------------------------ %% |
| 1886 |
|
| 1887 |
\section{Multiple integral signs} |
| 1888 |
|
| 1889 |
\cn{iint}, \cn{iiint}, and \cn{iiiint} give multiple integral |
| 1890 |
signs\index{integrals!multiple} with the spacing between them nicely |
| 1891 |
adjusted, in both text and display style. \cn{idotsint} is an extension |
| 1892 |
of the same idea that gives two integral signs with dots between them. |
| 1893 |
\begin{gather} |
| 1894 |
\iint\limits_A f(x,y)\,dx\,dy\qquad\iiint\limits_A |
| 1895 |
f(x,y,z)\,dx\,dy\,dz\\ |
| 1896 |
\iiiint\limits_A |
| 1897 |
f(w,x,y,z)\,dw\,dx\,dy\,dz\qquad\idotsint\limits_A f(x_1,\dots,x_k) |
| 1898 |
\end{gather} |
| 1899 |
|
| 1900 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1901 |
|
| 1902 |
\chapter{Commutative diagrams}\label{s:commdiag} |
| 1903 |
\index{commutative diagrams} |
| 1904 |
|
| 1905 |
Some commutative diagram commands like the ones in \amstex/ are |
| 1906 |
available as a separate package, \pkg{amscd}. For complex commutative |
| 1907 |
diagrams authors will need to turn to more comprehensive packages like |
| 1908 |
\tikz/\index{TikZ@\tikz/ package} (in particular, \pkg{tikz-cd}) |
| 1909 |
or \xypic/\index{XY-pic@\xypic/ package}, |
| 1910 |
but for simple diagrams without diagonal |
| 1911 |
arrows\index{arrows!in commutative diagrams} the \pkg{amscd} commands |
| 1912 |
may be more convenient. Here is one example. |
| 1913 |
\begin{equation*} |
| 1914 |
\begin{CD} |
| 1915 |
S^{\mathcal{W}_\Lambda}\otimes T @>j>> T\\ |
| 1916 |
@VVV @VV{\End P}V\\ |
| 1917 |
(S\otimes T)/I @= (Z\otimes T)/J |
| 1918 |
\end{CD} |
| 1919 |
\end{equation*} |
| 1920 |
\begin{verbatim} |
| 1921 |
\begin{CD} |
| 1922 |
S^{\mathcal{W}_\Lambda}\otimes T @>j>> T\\ |
| 1923 |
@VVV @VV{\End P}V\\ |
| 1924 |
(S\otimes T)/I @= (Z\otimes T)/J |
| 1925 |
\end{CD} |
| 1926 |
\end{verbatim} |
| 1927 |
In the \env{CD} environment the commands |@>>>|, |
| 1928 |
|@<<<|, |@VVV|, and |@AAA| give respectively right, left, down, and up |
| 1929 |
arrows. For the horizontal arrows, material between the first and second |
| 1930 |
|>| or |<| symbols will be typeset as a superscript, and material |
| 1931 |
between the second and third will be typeset as a subscript. Similarly, |
| 1932 |
material between the first and second or second and third |A|s or |V|s |
| 1933 |
of vertical arrows will be typeset as left or right \qq{sidescripts}. |
| 1934 |
The commands |@=| and \verb'@|' give horizontal and vertical double lines. |
| 1935 |
A \qq{null arrow} command |@.| can be used instead of a visible arrow |
| 1936 |
to fill out an array where needed. |
| 1937 |
|
| 1938 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1939 |
|
| 1940 |
\chapter{Using math fonts} |
| 1941 |
|
| 1942 |
\section{Introduction} |
| 1943 |
|
| 1944 |
For more comprehensive information on font use in \latex/, see the |
| 1945 |
\latex/ font guide (\fn{fntguide.tex}) or \booktitle{The \latex/ |
| 1946 |
Companion} \cite{tlc2}. The basic set of math font commands\index{math |
| 1947 |
fonts}\relax \index{math symbols|see{math fonts}} in \latex/ includes |
| 1948 |
\cn{mathbf}, \cn{mathrm}, \cn{mathcal}, \cn{mathsf}, \cn{mathtt}, |
| 1949 |
\cn{mathit}. Additional math alphabet commands such as |
| 1950 |
\cn{mathbb} for blackboard bold, \cn{mathfrak} for Fraktur, and |
| 1951 |
\cn{mathscr} for Euler script are available through the packages |
| 1952 |
\pkg{amsfonts} and \pkg{euscript} (distributed separately). |
| 1953 |
|
| 1954 |
%% ------------------------------------------------------------------ %% |
| 1955 |
\enlargethispage{1\baselineskip} |
| 1956 |
|
| 1957 |
\section{Recommended use of math font commands} |
| 1958 |
|
| 1959 |
If you find yourself employing math font commands frequently in your |
| 1960 |
document, you might wish that they had shorter names, such as \ncn{mb} |
| 1961 |
instead of \cn{mathbf}. Of course, there is nothing to keep you from |
| 1962 |
providing such abbreviations for yourself by suitable \cn{newcommand} |
| 1963 |
statements. But for \latex/ to provide shorter names would actually be a |
| 1964 |
disservice to authors, as that would obscure a much better alternative: |
| 1965 |
defining custom command names derived from the names of the underlying |
| 1966 |
mathematical objects, rather than from the names of the fonts used to |
| 1967 |
distinguish the objects. For example, if you are using bold to indicate |
| 1968 |
vectors, then you will be better served in the long run if you define a |
| 1969 |
`vector' command instead of a `math-bold' command: |
| 1970 |
\begin{verbatim} |
| 1971 |
\newcommand{\vect}[1]{\mathbf{#1}} |
| 1972 |
\end{verbatim} |
| 1973 |
you can write |\vect{a} + \vect{b}| to produce $\vect{a} + |
| 1974 |
\vect{b}$. |
| 1975 |
If you decide several months down the road that you want to use the bold |
| 1976 |
font for some other purpose, and mark vectors by a small over-arrow |
| 1977 |
instead, then you can put the change into effect merely by changing the |
| 1978 |
definition of \ncn{vect}; otherwise you would have to replace all |
| 1979 |
occurrences of \cn{mathbf} throughout your document, perhaps even |
| 1980 |
needing to inspect each one to see whether it is indeed |
| 1981 |
an instance of a vector. |
| 1982 |
|
| 1983 |
It can also be useful to assign distinct |
| 1984 |
command names for different letters of a particular font: |
| 1985 |
\begin{verbatim} |
| 1986 |
\DeclareSymbolFont{AMSb}{U}{msb}{m}{n}% or use amsfonts package |
| 1987 |
\DeclareMathSymbol{\C}{\mathalpha}{AMSb}{"43} |
| 1988 |
\DeclareMathSymbol{\R}{\mathalpha}{AMSb}{"52} |
| 1989 |
\end{verbatim} |
| 1990 |
These statements would define the commands \cn{C} and \cn{R} to produce |
| 1991 |
blackboard-bold letters from the `AMSb' math symbols font. If you refer |
| 1992 |
often to the\break complex numbers or real numbers in your document, you |
| 1993 |
might find this method more convenient than (let's say) defining a |
| 1994 |
\ncn{field} command and writing\break |\field{C}|, |\field{R}|. But for |
| 1995 |
maximum flexibility and control, define such a \ncn{field} command and |
| 1996 |
then define \ncn{C} and \ncn{R} in terms of that |
| 1997 |
command:\indexcs{mathbb} |
| 1998 |
\begin{verbatim} |
| 1999 |
\usepackage{amsfonts}% to get the \mathbb alphabet |
| 2000 |
\newcommand{\field}[1]{\mathbb{#1}} |
| 2001 |
\newcommand{\C}{\field{C}} |
| 2002 |
\newcommand{\R}{\field{R}} |
| 2003 |
\end{verbatim} |
| 2004 |
|
| 2005 |
%% ------------------------------------------------------------------ %% |
| 2006 |
\enlargethispage{3\baselineskip} |
| 2007 |
|
| 2008 |
\section{Bold math symbols} |
| 2009 |
|
| 2010 |
The \cn{mathbf} command is commonly used to obtain bold Latin letters in |
| 2011 |
math, but for most other kinds of math symbols it has no effect, or its |
| 2012 |
effects depend unreliably on the set of math fonts that are in use. For |
| 2013 |
example, writing |
| 2014 |
\begin{verbatim} |
| 2015 |
\Delta \mathbf{\Delta}\mathbf{+}\delta \mathbf{\delta} |
| 2016 |
\end{verbatim} |
| 2017 |
produces $\Delta \mathbf{\Delta}\mathbf{+}\delta |
| 2018 |
\mathbf{\delta}$; the \cn{mathbf} has no effect on the plus |
| 2019 |
sign or the small delta. |
| 2020 |
% should be paragraph break; avoid overfull box on next line |
| 2021 |
The \nipkg{amsmath} package therefore provides two additional commands, |
| 2022 |
\cn{boldsymbol} and \cn{pmb}, that can be applied to other kinds of math |
| 2023 |
symbols. \cn{boldsymbol} can be used for a math symbol that remains |
| 2024 |
unaffected by \cn{mathbf} if (and only if) your current math font set |
| 2025 |
includes a bold version of that symbol. \cn{pmb} can be used as a last |
| 2026 |
resort for any math symbols that do not have a true bold version |
| 2027 |
provided by your set of math fonts; \qq{pmb} stands for \qq{poor man's |
| 2028 |
bold} and the command works by typesetting multiple copies of the symbol |
| 2029 |
with slight offsets. The quality of the output is inferior, especially |
| 2030 |
for symbols that contain any hairline strokes. When the standard default set of |
| 2031 |
\latex/ math fonts are in use (Computer Modern), the only symbols that |
| 2032 |
are likely to require \cn{pmb} are large operator symbols like \cn{sum}, |
| 2033 |
extended delimiter\index{delimiters} symbols, or the extra math symbols |
| 2034 |
provided by the \pkg{amssymb} package \cite{amsfonts}. |
| 2035 |
|
| 2036 |
The following formula shows some of the results that are possible: |
| 2037 |
\begin{verbatim} |
| 2038 |
A_\infty + \pi A_0 |
| 2039 |
\sim \mathbf{A}_{\boldsymbol{\infty}} \boldsymbol{+} |
| 2040 |
\boldsymbol{\pi} \mathbf{A}_{\boldsymbol{0}} |
| 2041 |
\sim\pmb{A}_{\pmb{\infty}} \pmb{+}\pmb{\pi} \pmb{A}_{\pmb{0}} |
| 2042 |
\end{verbatim} |
| 2043 |
\begin{equation*} |
| 2044 |
A_\infty + \pi A_0 |
| 2045 |
\sim \mathbf{A}_{\boldsymbol{\infty}} \boldsymbol{+} |
| 2046 |
\boldsymbol{\pi} \mathbf{A}_{\boldsymbol{0}} |
| 2047 |
\sim\pmb{A}_{\pmb{\infty}} \pmb{+}\pmb{\pi} \pmb{A}_{\pmb{0}} |
| 2048 |
\end{equation*} |
| 2049 |
If you want to use only the \cn{boldsymbol} command without loading the |
| 2050 |
whole \nipkg{amsmath} package, the \pkg{bm} package is recommended (this |
| 2051 |
is a standard \latex/ package, not an AMS package; you probably have it |
| 2052 |
already if you have a 1997 or newer version of \latex/). |
| 2053 |
|
| 2054 |
%% ------------------------------------------------------------------ %% |
| 2055 |
|
| 2056 |
\section{Italic Greek letters} |
| 2057 |
|
| 2058 |
For italic versions of the capital Greek letters, the following commands |
| 2059 |
are provided: |
| 2060 |
\begin{ctab}{rlrl} |
| 2061 |
\cn{varGamma}& $\varGamma$& \cn{varSigma}& $\varSigma$\\ |
| 2062 |
\cn{varDelta}& $\varDelta$& \cn{varUpsilon}& $\varUpsilon$\\ |
| 2063 |
\cn{varTheta}& $\varTheta$& \cn{varPhi}& $\varPhi$\\ |
| 2064 |
\cn{varLambda}& $\varLambda$& \cn{varPsi}& $\varPsi$\\ |
| 2065 |
\cn{varXi}& $\varXi$& \cn{varOmega}& $\varOmega$\\ |
| 2066 |
\cn{varPi}& $\varPi$ |
| 2067 |
\end{ctab} |
| 2068 |
|
| 2069 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2070 |
|
| 2071 |
\chapter{Error messages and output problems} |
| 2072 |
|
| 2073 |
\section{General remarks} |
| 2074 |
|
| 2075 |
This is a supplement to Chapter~8 of the \latex/ manual \cite{lamport} |
| 2076 |
(first edition: Chapter~6). Appendix~B of the |
| 2077 |
\textit{Companion}~\cite{tlc2} lists all \latex/ errors including those |
| 2078 |
for \nipkg{amsmath} with likely causes for each. For the reader's |
| 2079 |
convenience, the set of error messages discussed here overlaps |
| 2080 |
somewhat with the set in those references, |
| 2081 |
but please be aware that we don't provide exhaustive coverage here. |
| 2082 |
The error messages are arranged in alphabetical order, disregarding |
| 2083 |
unimportant text such as |! LaTeX Error:| at the beginning, and |
| 2084 |
nonalphabetical characters such as \qc{\\}. Where examples are given, we |
| 2085 |
show also the help messages that appear on screen when you respond to an |
| 2086 |
error message prompt by entering |h|. |
| 2087 |
|
| 2088 |
Remember that the important error message is the first for a given line. |
| 2089 |
When running in nonstop mode, errors accumulate, and the first error |
| 2090 |
may create a further error condition from which it is impossible to |
| 2091 |
recover. In such a situation processing will stop after 100~errors, |
| 2092 |
so the reporting of genuine errors may not be complete, and it may be |
| 2093 |
impossible to determine which reported errors are genuine and which |
| 2094 |
are not. |
| 2095 |
|
| 2096 |
A final section discusses some output errors, i.e., instances where |
| 2097 |
the printed document has something wrong but there was no \latex/ |
| 2098 |
error during typesetting. |
| 2099 |
|
| 2100 |
%% ------------------------------------------------------------------ %% |
| 2101 |
%% ********** |
| 2102 |
\enlargethispage{-2\baselineskip} |
| 2103 |
|
| 2104 |
\section{Error messages} |
| 2105 |
|
| 2106 |
\begin{error}{\begin{split} won't work here.} |
| 2107 |
\errexa |
| 2108 |
\begin{verbatim} |
| 2109 |
! Package amsmath Error: \begin{split} won't work here. |
| 2110 |
... |
| 2111 |
|
| 2112 |
l.8 \begin{split} |
| 2113 |
|
| 2114 |
? h |
| 2115 |
\Did you forget a preceding \begin{equation}? |
| 2116 |
If not, perhaps the `aligned' environment is what you want. |
| 2117 |
? |
| 2118 |
\end{verbatim} |
| 2119 |
\errexpl |
| 2120 |
The \env{split} environment does not construct a stand-alone displayed |
| 2121 |
equation; it needs to be used within some other environment such as |
| 2122 |
\env{equation} or \env{gather}. |
| 2123 |
|
| 2124 |
\end{error} |
| 2125 |
|
| 2126 |
\begin{error}{Erroneous nesting of equation structures} |
| 2127 |
\errexa |
| 2128 |
\begin{verbatim} |
| 2129 |
! Package amsmath Error: Erroneous nesting of equation structures; |
| 2130 |
(amsmath) trying to recover with `aligned'. |
| 2131 |
|
| 2132 |
See the amsmath package documentation for explanation. |
| 2133 |
Type H <return> for immediate help. |
| 2134 |
... |
| 2135 |
|
| 2136 |
l.260 \end{alignat*} |
| 2137 |
\end{equation*} |
| 2138 |
\end{verbatim} |
| 2139 |
\errexpl |
| 2140 |
The structures \env{align}, \env{alignat}, etc., are designed |
| 2141 |
for top-level use and for the most part cannot be nested inside some |
| 2142 |
other displayed equation structure. The chief exception is that |
| 2143 |
\env{align} and most of its variants can be used inside the |
| 2144 |
\env{gather} environment. |
| 2145 |
\end{error} |
| 2146 |
|
| 2147 |
\begin{error}{Extra & on this line} |
| 2148 |
\errexa |
| 2149 |
\begin{verbatim} |
| 2150 |
! Package amsmath Error: Extra & on this line. |
| 2151 |
|
| 2152 |
See the amsmath package documentation for explanation. |
| 2153 |
Type H <return> for immediate help. |
| 2154 |
... |
| 2155 |
|
| 2156 |
l.9 \end{alignat} |
| 2157 |
|
| 2158 |
? h |
| 2159 |
\An extra & here is so disastrous that you should probably exit |
| 2160 |
and fix things up. |
| 2161 |
? |
| 2162 |
\end{verbatim} |
| 2163 |
\errexpl |
| 2164 |
In an \env{alignat} structure the number of alignment points per line |
| 2165 |
is dictated by the numeric argument given after |\begin{alignat}|. |
| 2166 |
If you use more alignment points in a line it is assumed that you |
| 2167 |
accidentally left out a newline command \cn{\\} and the above error is |
| 2168 |
issued. |
| 2169 |
\end{error} |
| 2170 |
|
| 2171 |
%% ********** |
| 2172 |
\enlargethispage{1.5\baselineskip} |
| 2173 |
|
| 2174 |
\begin{error}{Font OMX/cmex/m/n/7=cmex7 not loadable ...} |
| 2175 |
\errexa |
| 2176 |
\begin{verbatim} |
| 2177 |
! Font OMX/cmex/m/n/7=cmex7 not loadable: Metric (TFM) file not found. |
| 2178 |
<to be read again> |
| 2179 |
relax |
| 2180 |
l.8 $a |
| 2181 |
b+b^2$ |
| 2182 |
? h |
| 2183 |
I wasn't able to read the size data for this font, |
| 2184 |
so I will ignore the font specification. |
| 2185 |
[Wizards can fix TFM files using TFtoPL/PLtoTF.] |
| 2186 |
You might try inserting a different font spec; |
| 2187 |
e.g., type `I\font<same font id>=<substitute font name>'. |
| 2188 |
? |
| 2189 |
\end{verbatim} |
| 2190 |
\errexpl |
| 2191 |
Certain extra sizes of some Computer Modern fonts that were formerly |
| 2192 |
available mainly through the AMSFonts\index{amsfont@AMSFonts collection} |
| 2193 |
distribution are considered part of standard \latex/ (as of June 1994): |
| 2194 |
\fn{cmex7}\ndash \texttt{9}, \fn{cmmib5}\ndash \texttt{9}, and |
| 2195 |
\fn{cmbsy5}\ndash \texttt{9}. If these extra sizes are missing on your |
| 2196 |
system, you should try first to get them from the source where you |
| 2197 |
obtained \latex/. If that fails, you could try getting the fonts from |
| 2198 |
CTAN (e.g., in the form of Metafont\index{Metafont source files} source |
| 2199 |
files, directory \nfn{/tex-archive/fonts/latex/mf}, or in PostScript |
| 2200 |
Type 1 format, directory |
| 2201 |
\nfn{/tex-archive/fonts/cm/ps-type1/bakoma}\index{BaKoMa fonts}\relax |
| 2202 |
\index{PostScript fonts}). |
| 2203 |
|
| 2204 |
If the font name begins with \fn{cmex}, there is a special option% |
| 2205 |
\index{options!behavior of particular options} |
| 2206 |
\opt{cmex10} for the \nipkg{amsmath} package that provides a temporary |
| 2207 |
workaround. I.e., change the \cn{usepackage} to |
| 2208 |
\begin{verbatim} |
| 2209 |
\usepackage[cmex10]{amsmath} |
| 2210 |
\end{verbatim} |
| 2211 |
This will force the use of the 10-point size of the \fn{cmex} font in |
| 2212 |
all cases. Depending on the contents of your document this may be |
| 2213 |
adequate. |
| 2214 |
\end{error} |
| 2215 |
|
| 2216 |
\enlargethispage{1\baselineskip} |
| 2217 |
\begin{error}{Improper argument for math accent} |
| 2218 |
\errexa |
| 2219 |
\begin{verbatim} |
| 2220 |
! Package amsmath Error: Improper argument for math accent: |
| 2221 |
(amsmath) Extra braces must be added to |
| 2222 |
(amsmath) prevent wrong output. |
| 2223 |
|
| 2224 |
See the amsmath package documentation for explanation. |
| 2225 |
Type H <return> for immediate help. |
| 2226 |
... |
| 2227 |
|
| 2228 |
l.415 \tilde k_{\lambda_j} = P_{\tilde \mathcal |
| 2229 |
{M}} |
| 2230 |
? |
| 2231 |
\end{verbatim} |
| 2232 |
\errexpl |
| 2233 |
Non-simple arguments for any \LaTeX{} command should be enclosed in |
| 2234 |
braces. In this example extra braces are needed as follows: |
| 2235 |
\begin{verbatim} |
| 2236 |
... P_{\tilde{\mathcal{M}}} |
| 2237 |
\end{verbatim} |
| 2238 |
\end{error} |
| 2239 |
|
| 2240 |
\begin{error}{Math formula deleted: Insufficient extension fonts} |
| 2241 |
\errexa |
| 2242 |
\begin{verbatim} |
| 2243 |
! Math formula deleted: Insufficient extension fonts. |
| 2244 |
l.8 $ab+b^2$ |
| 2245 |
|
| 2246 |
? |
| 2247 |
\end{verbatim} |
| 2248 |
\errexpl |
| 2249 |
This usually follows a previous error |Font ... not loadable|; see the |
| 2250 |
discussion of that error (above) for solutions. |
| 2251 |
\end{error} |
| 2252 |
|
| 2253 |
\enlargethispage{1\baselineskip} |
| 2254 |
\begin{error}{Missing number, treated as zero} |
| 2255 |
\errexa |
| 2256 |
\begin{verbatim} |
| 2257 |
! Missing number, treated as zero. |
| 2258 |
<to be read again> |
| 2259 |
a |
| 2260 |
l.100 \end{alignat} |
| 2261 |
|
| 2262 |
? h |
| 2263 |
A number should have been here; I inserted `0'. |
| 2264 |
(If you can't figure out why I needed to see a number, |
| 2265 |
look up `weird error' in the index to The TeXbook.) |
| 2266 |
|
| 2267 |
? |
| 2268 |
\end{verbatim} |
| 2269 |
\errexpl |
| 2270 |
There are many possibilities that can lead to this error. However, one |
| 2271 |
possibility that is relevant for the \nipkg{amsmath} package is that you |
| 2272 |
forgot to give the number argument of an \env{alignat} environment, as |
| 2273 |
in: |
| 2274 |
\begin{verbatim} |
| 2275 |
\begin{alignat} |
| 2276 |
a& =b& c& =d\\ |
| 2277 |
a'& =b'& c'& =d' |
| 2278 |
\end{alignat} |
| 2279 |
\end{verbatim} |
| 2280 |
where the first line should read instead |
| 2281 |
\begin{verbatim} |
| 2282 |
\begin{alignat}{2} |
| 2283 |
\end{verbatim} |
| 2284 |
|
| 2285 |
Another possibility is that you have a left bracket character |[| |
| 2286 |
following a line break\index{line break} command \cn{\\} in a multiline |
| 2287 |
construction such as \env{array}, \env{tabular}, or \env{eqnarray}. |
| 2288 |
This will be interpreted by \latex/ as the beginning of an `additional |
| 2289 |
vertical space request \cite[\S C.1.6]{lamport}, even if it occurs on the |
| 2290 |
following line and is intended to be part of the contents. For example, |
| 2291 |
\begin{verbatim} |
| 2292 |
\begin{array}{c} |
| 2293 |
a+b\\ |
| 2294 |
[f,g]\\ |
| 2295 |
m+n |
| 2296 |
\end{array} |
| 2297 |
\end{verbatim} |
| 2298 |
To prevent the error message in such a case, you can |
| 2299 |
add braces as discussed in the \latex/ manual \cite[\S C.1.1]{lamport}: |
| 2300 |
\begin{verbatim} |
| 2301 |
\begin{array}{c} |
| 2302 |
a+b\\ |
| 2303 |
{[f,g]}\\ |
| 2304 |
m+n |
| 2305 |
\end{array} |
| 2306 |
\end{verbatim} |
| 2307 |
or precede the bracketed expression by \cn{relax}. |
| 2308 |
\end{error} |
| 2309 |
|
| 2310 |
\goodbreak |
| 2311 |
|
| 2312 |
\begin{error}{Missing \right. inserted} |
| 2313 |
\errexa |
| 2314 |
\begin{verbatim} |
| 2315 |
! Missing \right. inserted. |
| 2316 |
<inserted text> |
| 2317 |
\right . |
| 2318 |
l.10 \end{multline} |
| 2319 |
|
| 2320 |
? h |
| 2321 |
I've inserted something that you may have forgotten. |
| 2322 |
(See the <inserted text> above.) |
| 2323 |
With luck, this will get me unwedged. But if you |
| 2324 |
really didn't forget anything, try typing `2' now; then |
| 2325 |
my insertion and my current dilemma will both disappear. |
| 2326 |
\end{verbatim} |
| 2327 |
\errexpl |
| 2328 |
This error typically arises when you try to insert a |
| 2329 |
line break\index{line break} or |&|\cnamp\ between a |
| 2330 |
\cn{left}-\cn{right} pair of delimiters\index{delimiters} in any |
| 2331 |
multiline environment, including \env{split}. |
| 2332 |
\begin{verbatim} |
| 2333 |
\begin{multline} |
| 2334 |
AAA\left(BBB\\ |
| 2335 |
CCC\right) |
| 2336 |
\end{multline} |
| 2337 |
\end{verbatim} |
| 2338 |
There are two possible solutions: (1)~instead of using \cn{left} and |
| 2339 |
\cn{right}, use `big' delimiters\index{delimiters!fixed size} of fixed |
| 2340 |
size (\cn{bigl} \cn{bigr} \cn{biggl} \cn{biggr} \dots; see |
| 2341 |
\secref{bigdel}); or (2)~use null delimiters\index{delimiters!null} to |
| 2342 |
break up the \cn{left}-\cn{right} pair into parts for each line (or cell): |
| 2343 |
\begin{verbatim} |
| 2344 |
AAA\left(BBB\right.\\ |
| 2345 |
\left.CCC\right) |
| 2346 |
\end{verbatim} |
| 2347 |
The latter solution may result in mismatched |
| 2348 |
delimiter\index{delimiters!mismatched sizes} sizes; |
| 2349 |
ensuring that they match requires using \cn{vphantom} in the segment |
| 2350 |
that has the smaller delimiter (or possibly \cn{smash} in the segment |
| 2351 |
that has the larger delimiter). In the argument of \cn{vphantom} put a |
| 2352 |
copy of the tallest element that occurs in the other segment, e.g., |
| 2353 |
\begin{verbatim} |
| 2354 |
xxx \left(\int_t yyy\right.\\ |
| 2355 |
\left.\vphantom{\int_t} zzz ... \right) |
| 2356 |
\end{verbatim} |
| 2357 |
\end{error} |
| 2358 |
|
| 2359 |
\goodbreak |
| 2360 |
|
| 2361 |
\begingroup |
| 2362 |
\lccode`M=`M |
| 2363 |
\lccode`@=`\} |
| 2364 |
\lowercase{\endgroup |
| 2365 |
\begin{error}{Missing @ inserted}} |
| 2366 |
|
| 2367 |
\errexa |
| 2368 |
\begin{verbatim} |
| 2369 |
! Missing } inserted. |
| 2370 |
<inserted text> |
| 2371 |
\right . |
| 2372 |
l.10 \end{multline} |
| 2373 |
|
| 2374 |
? h |
| 2375 |
I've inserted something that you may have forgotten. |
| 2376 |
(See the <inserted text> above.) |
| 2377 |
With luck, this will get me unwedged. But if you |
| 2378 |
really didn't forget anything, try typing `2' now; then |
| 2379 |
my insertion and my current dilemma will both disappear. |
| 2380 |
\end{verbatim} |
| 2381 |
\errexpl |
| 2382 |
This error is often the result of using \verb+$+ within a multiline |
| 2383 |
display environment. Remove such \verb+$+ signs (except when they |
| 2384 |
appear within \verb+\text{...}+). |
| 2385 |
\end{error} |
| 2386 |
|
| 2387 |
\begin{error}{Old form `\pmatrix' should be \begin{pmatrix}.} |
| 2388 |
\errexa |
| 2389 |
\begin{verbatim} |
| 2390 |
! Package amsmath Error: Old form `\pmatrix' should be |
| 2391 |
\begin{pmatrix}. |
| 2392 |
|
| 2393 |
See the amsmath package documentation for explanation. |
| 2394 |
Type H <return> for immediate help. |
| 2395 |
... |
| 2396 |
|
| 2397 |
\pmatrix ->\left (\matrix@check \pmatrix |
| 2398 |
\env@matrix |
| 2399 |
l.16 \pmatrix |
| 2400 |
{a&b\cr c&d\cr} |
| 2401 |
? h |
| 2402 |
`\pmatrix{...}' is old Plain-TeX syntax whose use is |
| 2403 |
ill-advised in LaTeX. |
| 2404 |
? |
| 2405 |
\end{verbatim} |
| 2406 |
\errexpl |
| 2407 |
When the \nipkg{amsmath} package is used, the old forms of \cn{pmatrix}, |
| 2408 |
\cn{matrix}, and \cn{cases} cannot be used any longer because of naming |
| 2409 |
conflicts. Their syntax did not conform with standard \LaTeX{} syntax |
| 2410 |
in any case. |
| 2411 |
\end{error} |
| 2412 |
|
| 2413 |
\enlargethispage{2\baselineskip} |
| 2414 |
\begin{error}{Paragraph ended before \xxx was complete} |
| 2415 |
\errexa |
| 2416 |
\begin{verbatim} |
| 2417 |
Runaway argument? |
| 2418 |
|
| 2419 |
! Paragraph ended before \multline was complete. |
| 2420 |
<to be read again> |
| 2421 |
\par |
| 2422 |
l.100 |
| 2423 |
|
| 2424 |
? h |
| 2425 |
I suspect you've forgotten a `}', causing me to apply this |
| 2426 |
control sequence to too much text. How can we recover? |
| 2427 |
My plan is to forget the whole thing and hope for the best. |
| 2428 |
? |
| 2429 |
\end{verbatim} |
| 2430 |
\errexpl |
| 2431 |
This might be produced by a blank line between the |\begin| and |\end|. |
| 2432 |
Another possibility is a misspelling in the |\end{multline}| command, |
| 2433 |
e.g., |
| 2434 |
\begin{verbatim} |
| 2435 |
\begin{multline} |
| 2436 |
... |
| 2437 |
\end{multiline} |
| 2438 |
\end{verbatim} |
| 2439 |
or by using abbreviations for certain environments, such as |\bal| and |
| 2440 |
|\eal| for |\begin{align}| and |\end{align}|: |
| 2441 |
\begin{verbatim} |
| 2442 |
\bal |
| 2443 |
... |
| 2444 |
\eal |
| 2445 |
\end{verbatim} |
| 2446 |
For technical reasons that kind of abbreviation does not work with |
| 2447 |
the more complex displayed equation environments of the \nipkg{amsmath} package |
| 2448 |
(\env{gather}, \env{align}, \env{split}, etc.; cf.\ \fn{technote.tex}). |
| 2449 |
\end{error} |
| 2450 |
|
| 2451 |
\begin{error}{Runaway argument?} |
| 2452 |
See the discussion for the error message |
| 2453 |
\texttt{Paragraph ended before \ncn{xxx} was complete}. |
| 2454 |
\end{error} |
| 2455 |
|
| 2456 |
\begin{error}{Unknown option `xxx' for package `yyy'} |
| 2457 |
\errexa |
| 2458 |
\begin{verbatim} |
| 2459 |
! LaTeX Error: Unknown option `intlim' for package `amsmath'. |
| 2460 |
... |
| 2461 |
? h |
| 2462 |
The option `intlim' was not declared in package `amsmath', perhaps you |
| 2463 |
misspelled its name. Try typing <return> to proceed. |
| 2464 |
? |
| 2465 |
\end{verbatim} |
| 2466 |
\errexpl |
| 2467 |
This means that you misspelled the option\index{options!unknown} |
| 2468 |
name, or the package simply does not have an option that you expected |
| 2469 |
it to have. Consult the documentation for the given package. |
| 2470 |
\end{error} |
| 2471 |
|
| 2472 |
%% ------------------------------------------------------------------ %% |
| 2473 |
|
| 2474 |
\section{Warning messages} |
| 2475 |
|
| 2476 |
\begin{error}{Cannot use `split' here} |
| 2477 |
\errexa |
| 2478 |
\begin{verbatim} |
| 2479 |
Package amsmath Warning: Cannot use `split' here; |
| 2480 |
(amsmath) trying to recover with `aligned' |
| 2481 |
\end{verbatim} |
| 2482 |
\errexpl The \env{split} environment is designed to serve as the entire |
| 2483 |
body of an equation, or an entire line of an \env{align} or \env{gather} |
| 2484 |
environment. There cannot be any printed material before or |
| 2485 |
after it within the same enclosing structure: |
| 2486 |
\begin{verbatim} |
| 2487 |
\begin{equation} |
| 2488 |
\left\{ % <-- Not allowed |
| 2489 |
\begin{split} |
| 2490 |
... |
| 2491 |
\end{split} |
| 2492 |
\right. % <-- Not allowed |
| 2493 |
\end{equation} |
| 2494 |
\end{verbatim} |
| 2495 |
\end{error} |
| 2496 |
|
| 2497 |
\begin{error}{Foreign command \over [or \atop or \above]} |
| 2498 |
\errexa |
| 2499 |
\begin{verbatim} |
| 2500 |
Package amsmath Warning: Foreign command \over; \frac or \genfrac |
| 2501 |
(amsmath) should be used instead. |
| 2502 |
\end{verbatim} |
| 2503 |
\errexpl The primitive generalized fraction commands of \tex/\mdash |
| 2504 |
\cs{over}, \cs{atop}, \cs{above}\mdash are deprecated when the |
| 2505 |
\nipkg{amsmath} package is used because their syntax is foreign to \latex/ |
| 2506 |
and \nipkg{amsmath} provides native \latex/ equivalents. See |
| 2507 |
\fn{technote.tex} for further information. |
| 2508 |
\end{error} |
| 2509 |
|
| 2510 |
%% ------------------------------------------------------------------ %% |
| 2511 |
|
| 2512 |
\section{Wrong output} |
| 2513 |
|
| 2514 |
\begin{erroro}{Section numbers 0.1, 5.1, 8.1 instead of 1, 2, 3} |
| 2515 |
% |
| 2516 |
This most likely means that you have the arguments for \cn{numberwithin} |
| 2517 |
in reverse order: |
| 2518 |
\begin{verbatim} |
| 2519 |
\numberwithin{section}{equation} |
| 2520 |
\end{verbatim} |
| 2521 |
That means `print the section number as \textit{equation |
| 2522 |
number}.\textit{section number} and reset to 1 every time an equation |
| 2523 |
occurs' when what you probably wanted was the inverse |
| 2524 |
\begin{verbatim} |
| 2525 |
\numberwithin{equation}{section} |
| 2526 |
\end{verbatim} |
| 2527 |
\end{erroro} |
| 2528 |
|
| 2529 |
\begin{erroro}{The \cn{numberwithin} command had no effect on equation |
| 2530 |
numbers} |
| 2531 |
% |
| 2532 |
Are you looking at the first section in your document? Check the section |
| 2533 |
numbers elsewhere to see if the problem is the one described in the |
| 2534 |
previous item. |
| 2535 |
\end{erroro} |
| 2536 |
|
| 2537 |
\begin{erroro}{Bracketed material disappears at the beginning of |
| 2538 |
\env{aligned} or \env{gathered}} |
| 2539 |
% |
| 2540 |
For most multiline equation environments, \nipkg{amsmath} disables the |
| 2541 |
\latex/ convention to recognize a [bracketed] expression as an option% |
| 2542 |
\index{ed env@\texttt{-ed} environments}% |
| 2543 |
\index{options!positioning of \texttt{-ed} environments}% |
| 2544 |
\index{options!space before \texttt{[}} |
| 2545 |
when it occurs at the beginning of an environment or immediately |
| 2546 |
following \cn{\\}, provided a space intervenes. This fails at the |
| 2547 |
beginning of \env{aligned} and \env{gathered}, and is a bug. Insert |
| 2548 |
\cn{relax} before the opening brace to restore the desired result. |
| 2549 |
\end{erroro} |
| 2550 |
|
| 2551 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2552 |
|
| 2553 |
\chapter{Additional information} |
| 2554 |
|
| 2555 |
\section{Compatibility with other packages} |
| 2556 |
|
| 2557 |
Several packages have already been mentioned as providing facilities |
| 2558 |
lacking in \nipkg{amsmath}. |
| 2559 |
|
| 2560 |
\begin{itemize} |
| 2561 |
\item \pkg{bm} is recommended for specifying bold math symbols. |
| 2562 |
\item \pkg{mathtools} provides enhancements to some \nipkg{amsmath} |
| 2563 |
environments as well as additional compatible features, such as |
| 2564 |
\env{rcases} (similar to \env{cases} but with the brace on the |
| 2565 |
right-hand side), \env{multlined} (a subsidiary environment |
| 2566 |
comparable to \env{multline}), and \cn{shortintertext} (more |
| 2567 |
compact spacing than \cn{intertext}). If \pkg{mathtools} is used, |
| 2568 |
\nipkg{amsmath} is loaded automatically, so it is not necessary |
| 2569 |
to load it separately. |
| 2570 |
\item \pkg{unicode-math} provides commands for (most?)\ math symbols |
| 2571 |
in Unicode. |
| 2572 |
%\item \pkg{empheq} |
| 2573 |
\end{itemize} |
| 2574 |
|
| 2575 |
These packages have known problems when used with \nipkg{amsmath}. |
| 2576 |
\begin{itemize} |
| 2577 |
\item \pkg{lineno} may omit numbers before display environments. |
| 2578 |
\item \pkg{breqn} redefines a number of commands from other packages, |
| 2579 |
so is best loaded after \nipkg{amsmath} and other packages with math |
| 2580 |
facilities.\\ \pkg{breqn} is not yet totally stable, and a number of |
| 2581 |
bugs have been reported via \texttt{tex.stackexchange} \cite{tex-sx}. |
| 2582 |
\item \pkg{wasysym}, \pkg{mathabx} and perhaps other font packages also |
| 2583 |
define multiple integrals\index{integrals!multiple} using the same |
| 2584 |
names as \nipkg{amsmath}. |
| 2585 |
\end{itemize} |
| 2586 |
|
| 2587 |
%% ------------------------------------------------------------------ %% |
| 2588 |
|
| 2589 |
\section{Converting existing documents} |
| 2590 |
|
| 2591 |
\subsection{Converting from plain \LaTeX{}} |
| 2592 |
|
| 2593 |
A \LaTeX{} document will typically continue to work the same in most |
| 2594 |
respects if \verb'\usepackage{amsmath}' is added in the document |
| 2595 |
preamble. By default, however, the \nipkg{amsmath} package suppresses page |
| 2596 |
breaks inside multiple-line displayed equation structures such as |
| 2597 |
\env{eqnarray}, \env{align}, and \env{gather}. To continue allowing page |
| 2598 |
breaks inside \env{eqnarray} after switching to \nipkg{amsmath}, you will |
| 2599 |
need to add the following line in your document preamble: |
| 2600 |
\begin{verbatim} |
| 2601 |
\allowdisplaybreaks[1] |
| 2602 |
\end{verbatim} |
| 2603 |
To ensure normal spacing around relation symbols, you might also want to |
| 2604 |
change \env{eqnarray} to \env{align}, \env{multline}, or |
| 2605 |
\env{equation}\slash\env{split} as appropriate. |
| 2606 |
|
| 2607 |
Most of the other differences in \nipkg{amsmath} usage can be considered |
| 2608 |
optional refinements, e.g., using |
| 2609 |
\begin{verbatim} |
| 2610 |
\DeclareMathOperator{\Hom}{Hom} |
| 2611 |
\end{verbatim} |
| 2612 |
instead of \verb'\newcommand{\Hom}{\mbox{Hom}}'. |
| 2613 |
|
| 2614 |
\subsection{Converting from \texorpdfstring{\amslatex/}{amslatex} 1.1} |
| 2615 |
See \fn{diffs-m.txt}. |
| 2616 |
|
| 2617 |
%% ------------------------------------------------------------------ %% |
| 2618 |
|
| 2619 |
\section{Technical notes} |
| 2620 |
The file \fn{technote.tex} contains some remarks on miscellaneous |
| 2621 |
technical questions that are less likely to be of general interest. |
| 2622 |
|
| 2623 |
%% ------------------------------------------------------------------ %% |
| 2624 |
|
| 2625 |
\section{Getting help} |
| 2626 |
|
| 2627 |
The \nipkg{amsmath} collection of packages is maintained by the \latex/ |
| 2628 |
team \cite{ltx-team}. Bugs should be reported using the instructions |
| 2629 |
at \url{https://www.latex-project.org/bugs/}. |
| 2630 |
Please be careful not to confuse \nipkg{amsmath} with the AMS document |
| 2631 |
classes (\cls{amsart}, \cls{amsbook}, and \cls{amsproc}), which |
| 2632 |
automatically incorporate \nipkg{amsmath}; bugs in the classes should |
| 2633 |
be reported directly to AMS, by email to \mail{[email protected]}. |
| 2634 |
|
| 2635 |
%Questions or comments regarding \nipkg{amsmath} and related packages |
| 2636 |
%should be sent to: |
| 2637 |
%\begin{infoaddress} |
| 2638 |
%American Mathematical Society\\ |
| 2639 |
%Technical Support\\ |
| 2640 |
%Electronic Products and Services\\ |
| 2641 |
%P. O. Box 6248\\ |
| 2642 |
%Providence, RI 02940\\[3pt] |
| 2643 |
%Phone: 800-321-4AMS (321-4267) \quad or \quad 401-455-4080\\ |
| 2644 |
%Internet: \mail{[email protected]} |
| 2645 |
%\end{infoaddress} |
| 2646 |
%If you are reporting a problem you should include |
| 2647 |
%the following information to make proper investigation possible: |
| 2648 |
%\begin{enumerate} |
| 2649 |
%\item The source file where the problem occurred, preferably reduced |
| 2650 |
% to minimum size by removing any material that can be removed without |
| 2651 |
% affecting the observed problem. |
| 2652 |
%\item A \latex/ log file showing the error message (if applicable) and |
| 2653 |
% the version numbers of the document class and option files being used. |
| 2654 |
%\end{enumerate} |
| 2655 |
|
| 2656 |
The online forum\index{online Q\,\&\,A forum} \texttt{tex.stackexchange} |
| 2657 |
\cite{tex-sx} is a good source of answers to common questions on usage. |
| 2658 |
Look first in the archive to see if your question has already been asked |
| 2659 |
and answered; if it has not, post your own question. |
| 2660 |
|
| 2661 |
There is an online discussion group called \fn{comp.text.tex} \cite{ctt} |
| 2662 |
that is a fairly good source of information about \latex/ and \tex/ in |
| 2663 |
general. This group, formerly a Unix newsgroup, predates |
| 2664 |
\texttt{tex.stackexchange} by decades, and the archives can be a useful |
| 2665 |
resource for historical investigation. |
| 2666 |
|
| 2667 |
%% ------------------------------------------------------------------ %% |
| 2668 |
|
| 2669 |
\section{Of possible interest}\label{a:possible-interest} |
| 2670 |
Information about obtaining AMSFonts or other \tex/-related |
| 2671 |
software from the AMS web server at \fn{www.ams.org} |
| 2672 |
can be obtained by sending an email request to |
| 2673 |
\mail{[email protected]}. This software is also posted on |
| 2674 |
CTAN\index{CTAN (Comprehensive \TeX\ Archive Network)} and included |
| 2675 |
in distributions based on \TeX\,Live\index{TEX Live@\TeX\,Live}. |
| 2676 |
|
| 2677 |
The \tex/ Users Group\index{TeX Users@\tex/ Users Group} is a nonprofit |
| 2678 |
organization that publishes a journal |
| 2679 |
(\journalname{TUGboat}\index{TUGboat@\journalname{TUGboat}}), holds |
| 2680 |
meetings, and serves as a clearinghouse for general information about |
| 2681 |
\tex/ and \tex/-related software. |
| 2682 |
\begin{infoaddress} |
| 2683 |
\tex/ Users Group\\ |
| 2684 |
PO Box 2311\\ |
| 2685 |
Portland, OR 97208-2311\\ |
| 2686 |
USA\\[3pt] |
| 2687 |
Phone: +1-503-223-9994\\ |
| 2688 |
Email: \mail{[email protected]} |
| 2689 |
\end{infoaddress} |
| 2690 |
Membership in the \tex/ Users Group is a good way to support continued |
| 2691 |
development of free \tex/-related software. There are also many local |
| 2692 |
\tex/ user groups in other countries; information about contacting a |
| 2693 |
local user group can be gotten from the \tex/ Users Group. |
| 2694 |
|
| 2695 |
\index{amsmath@\texttt{amsmath} package|)} |
| 2696 |
|
| 2697 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2698 |
\newpage |
| 2699 |
|
| 2700 |
\begin{thebibliography}{10} |
| 2701 |
\addcontentsline{toc}{chapter}{\bibname} |
| 2702 |
|
| 2703 |
\raggedright |
| 2704 |
|
| 2705 |
\bibsubhead{References in print} |
| 2706 |
|
| 2707 |
\bibitem{mil} George Gr\"atzer, \booktitle{More Math into \latex/}, fifth ed., |
| 2708 |
Springer, New York, 2016. |
| 2709 |
% Deal with a line breaking problem |
| 2710 |
%\begin{raggedright} |
| 2711 |
%\bibitem{mil} G. Gr\"{a}tzer, |
| 2712 |
%\emph{Math into \LaTeX{}: An Introduction to \LaTeX{} and AMS-\LaTeX{}} |
| 2713 |
% \url{https://www.ams.org/cgi-bin/bookstore/bookpromo?fn=91&arg1=bookvideo&itmc=MLTEX}, |
| 2714 |
%Birkh\"{a}user, Boston, 1995.\par |
| 2715 |
%\end{raggedright} |
| 2716 |
|
| 2717 |
\bibitem{kn} Donald E. Knuth, \booktitle{The \tex/book}, |
| 2718 |
Addison-Wesley, Reading, MA, 1984. |
| 2719 |
|
| 2720 |
\bibitem{lamport} Leslie Lamport, \booktitle{\latex/: A document preparation |
| 2721 |
system}, 2nd revised ed., Addison-Wesley, Reading, MA, 1994. |
| 2722 |
|
| 2723 |
\bibitem{tlc2} Frank Mittelbach, Michel Goossens, et al., |
| 2724 |
\booktitle{The \latex/ companion}, second ed., Addison-Wesley, Reading, |
| 2725 |
MA, 2004. This is now also available as an ebook, in both English and |
| 2726 |
German; see \url{https://www.latex-project.org/help/books/}. |
| 2727 |
The front matter, including the full Table of Contents, can be viewed |
| 2728 |
online, from a link on the same page. |
| 2729 |
%Michel Goossens, Frank Mittelbach, and Alexander Samarin, |
| 2730 |
%\booktitle{The \latex/ companion}, Addison-Wesley, Reading, MA, 1994. |
| 2731 |
% [\emph{Note: The 1994 edition is not a reliable guide for the |
| 2732 |
% \nipkg{amsmath} package unless you refer to the errata for Chapter |
| 2733 |
% 8\mdash file \fn{compan.err}, distributed with \LaTeX{}.}] |
| 2734 |
|
| 2735 |
\bibitem{msf} Frank Mittelbach and Rainer Sch\"opf, |
| 2736 |
\textit{The new font family selection\mdash user |
| 2737 |
interface to standard \latex/}, \journalname{TUGboat} \textbf{11}, |
| 2738 |
no.~2 (June 1990), pp.~297\ndash 305. |
| 2739 |
|
| 2740 |
\bibitem{jt} Michael Spivak, \booktitle{The joy of \tex/}, 2nd revised ed., |
| 2741 |
Amer. Math. Soc., Providence, RI, 1990. |
| 2742 |
|
| 2743 |
\bibsubhead{Package documentation} |
| 2744 |
|
| 2745 |
\bibitem{amshandbk}\booktitle{AMS author handbook}, separate versions |
| 2746 |
for journal articles, monographs and proceedings articles, Amer. Math. |
| 2747 |
Soc., Providence, RI, 2017; |
| 2748 |
\url{https://www.ams.org/publications/authors/tex/author-handbook}. |
| 2749 |
|
| 2750 |
\bibitem{amsfonts}\booktitle{AMSFonts version \textup{2.2d}\mdash user's guide}, |
| 2751 |
Amer. Math. Soc., Providence, RI, 2002; distributed |
| 2752 |
with the AMSFonts package |
| 2753 |
\url{http://mirror.ctan.org/tex-archive/fonts/amsfonts/doc/amsfndoc.pdf}. |
| 2754 |
|
| 2755 |
\bibitem{amsthdoc}\booktitle{Using the \pkg{amsthm} Package}, version 2.20.3, |
| 2756 |
Amer. Math. Soc., Providence, RI, 2017; |
| 2757 |
\url{http://mirror.ctan.org/tex-archive/macros/latex/required/amscls/doc/amsthdoc.pdf}. |
| 2758 |
|
| 2759 |
\bibitem{mt} Morten H{\o}gholm, Lars Madsen, \booktitle{The \pkg{mathtools} |
| 2760 |
package}, 2018; |
| 2761 |
\url{http://mirror.ctan.org/tex-archive/macros/latex/contrib/mathtools/mathtools.pdf}. |
| 2762 |
|
| 2763 |
\bibsubhead{Online resources} |
| 2764 |
|
| 2765 |
\bibitem{ltx-team} The \latex/ Project, \url{https://www.latex-project.org}. |
| 2766 |
|
| 2767 |
\bibitem{ctt} Online discussion group \texttt{comp.text.tex}, |
| 2768 |
\url{https://groups.google.com/forum/\#!forum/comp.text.tex}. |
| 2769 |
|
| 2770 |
\bibitem{tex-sx} Online question and answer forum \texttt{tex.stackexchange}, |
| 2771 |
\url{https://tex.stackexchange.com}. |
| 2772 |
|
| 2773 |
\end{thebibliography} |
| 2774 |
|
| 2775 |
\printindex |
| 2776 |
|
| 2777 |
\end{document} |