diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-15 03:00:57 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-15 03:00:57 +0000 |
commit | fed27f633aadbacbd3d1221da7993fed8d4efffe (patch) | |
tree | 3cae3cde89de26b178894a2e88d9ef5ba89dafcc /macros/latex-dev/required/amsmath | |
parent | 0eea86bf18826522b3686f54fc3afb8ddc31e62a (diff) |
CTAN sync 201909150300
Diffstat (limited to 'macros/latex-dev/required/amsmath')
36 files changed, 17761 insertions, 0 deletions
diff --git a/macros/latex-dev/required/amsmath/README.md b/macros/latex-dev/required/amsmath/README.md new file mode 100644 index 0000000000..66a27edf03 --- /dev/null +++ b/macros/latex-dev/required/amsmath/README.md @@ -0,0 +1,81 @@ +The amsmath bundle for LaTeX +============================ + +Release 2019-10-01 pre-release 3 + +Overview +-------- + +The `amsmath` package is an extension package for LaTeX that provides +additional features to facilitate mathematical typesetting. It has been +developed by the American Mathematical Society (AMS) and released for general +use as a service to the mathematical community. A number of smaller +auxiliary packages are also distributed with the `amsmath` package. + +Effective in 2016, maintenance of `amsmath was transferred from AMS to +the LaTeX Project; as `amsmath` is considered a "required" package, this +centralizes control over the core LaTeX components. + +Installation +------------ + +We no longer distribute installation instructions for the various TeX +implementations. All modern TeX systems include `amsmath` as-standard, and end +users should in general use the release versions supplied in this way. + +Release distribution is carried out only through the CTAN archives. + +Documentation +------------- + +The primary documentation for `amsmath` is in provided as `amsldoc.pdf`. + +Additional documentation files include: + + - `diffs-m.txt` + - `subeqn.pdf` + - `technote.pdf` + - `testmath.pdf` + +which are included in the collection. All of these can be accessed +easily with most distributions by entering `texdoc` *filename* at the +command line, or via [TeXdoc Online](http://texdoc.net). + +Change logs +----------- + +The file `changes.txt` lists recent changes in reverse chronological order. + +The file `diffs-m.txt` contains information on development and changes +prior to 2000. + +Reporting Bugs +-------------- + +If you wish to report a problem or bug in the `amsmath` bundle +please use the [Issue Tracker for LaTeX2e on +GitHub](https://github.com/latex3/latex2e/issues) +and follow the guidelines that pop up if you press the "New issue" button. + +In particular, to check that you are really seeing a bug, please write +a short, self-contained document that shows the problem. This should +include the `latexbug` package, which will warn if your test file is +not suitable for one or the other reason. See the [CONTRIBUTING +guide](https://github.com/latex3/latex2e/blob/master/CONTRIBUTING.md) +for further details, or if you need to obtain the `latexbug` package. + +If the bug turns out to be with third-party software then please +contact the developer, and not us! + +License +------- + +The contents of this bundle are distributed under the [LaTeX Project +Public License](https://www.latex-project.org/lppl/lppl-1-3c/), +version 1.3c or later. + +----- + +<p>Copyright (C) 2001-2004, 2007, 2008, 2010, 2011, 2013 American Mathematical Society. <br /> +<p>Copyright (C) 2016-2019 The LaTeX Project and American Mathematical Society. <br /> + diff --git a/macros/latex-dev/required/amsmath/ams-external.txt b/macros/latex-dev/required/amsmath/ams-external.txt new file mode 100644 index 0000000000..fa2dbea556 --- /dev/null +++ b/macros/latex-dev/required/amsmath/ams-external.txt @@ -0,0 +1,547 @@ +%%% list of external commands used by amsmath (not totally correct) + +\! +\" +\( +\* +\, +\- +\. +\/ +\: +\; +\= +\Acute +\AmS +\AmSfont +\And +\AtBeginDocument +\Bar +\Big +\Bigg +\Biggr +\Bigr +\Breve +\Check +\DOTS +\DOTSB +\DOTSI +\DOTSX +\Ddot +\DeclareFontEncoding +\DeclareFontShape +\DeclareMathAccent +\DeclareMathDelimiter +\DeclareMathOperator +\DeclareMathSymbol +\DeclareOption +\DeclareRobustCommand +\Dot +\ExecuteOptions +\GenericError +\GenericInfo +\GenericWarning +\Grave +\Hat +\Leftarrow +\Longleftarrow +\Longleftrightarrow +\Longrightarrow +\MessageBreak +\MultiIntegral +\PackageError +\PackageWarning +\PackageWarningNoLine +\PassOptionsToPackage +\Pr +\ProcessOptions +\Relbar +\RequirePackage +\Rightarrow +\Tilde +\Umathaccent +\Umathcar +\Umathchar +\Umathcharnumdef +\Umathcode +\Umathcodenum +\Umathfractiondelsize +\Vec +\Vert +\XeTeXcharclass +\[ +\] +\above +\abovedisplayskip +\abovewithdelims +\accentedsymbol +\acute +\addtocounter +\advance +\aftergroup +\allowbreak +\allowdisplaybreaks +\alph +\arabic +\arccos +\arcsin +\arctan +\arg +\array +\arraycolsep +\arraystretch +\atop +\atopwithdelims +\badness< +\bar +\baselineskip +\baselineskip6 +\begin +\begingroup +\belowdisplayskip +\bgroup +\big +\bigcap +\bigcup +\bigg +\biggr +\bigodot +\bigoplus +\bigotimes +\bigr +\bigsqcup +\biguplus +\bigvee +\bigwedge +\binom +\bmod +\boldsymbol +\box +\boxed +\breve +\cases +\cdotp +\cdots +\cfrac +\char +\chardef +\check +\cleaders +\colon +\columnwidth +\coprod +\copy +\cos +\cosh +\cot +\coth +\cr +\crcr +\csc +\csname +\csnamen +\csnamethe +\dbinom +\ddddot +\dddot +\ddot +\def +\deg +\delimiter +\delimiterfactor +\delimitershortfall +\det +\dfrac +\dim +\displaybreak +\displayindent +\displaylimits +\displaystyle +\displaywidth +\divide +\do +\dot +\doteq +\dots +\dotsb +\dotsc +\dotsi +\dotsm +\dotso +\dp +\edef +\egroup +\else +\end +\endalign +\endaligned +\endarray +\endcsname +\endgather +\endgroup +\endmathdisplay +\endmatrix +\endmultline +\endsplit +\endsubarray +\eqno +\eqref +\everycr +\everydisplay +\everymath +\exp +\expandafter +\fbox +\fi +\fontchardp +\fontcharht +\fontdimen +\fontencoding +\fontfamily +\frac +\fracwithdelims +\futurelet +\gcd +\gdef +\genfrac +\global +\grave +\halign +\halignto +\hat +\hbox +\hdots +\hdotsfor +\hfil +\hfill +\hfilneg +\hfuzz +\hom +\hookleftarrow +\hookrightarrow +\hrule +\hskip +\ht +\ialign +\idotsint +\if +\ifDOTS +\ifcase +\ifdim +\iff +\iffalse +\iffalse%initialvalue +\ifhbox +\ifinner +\ifm +\ifmacrostarts +\ifmmode +\ifnum +\ifnum` +\ifodd +\iftrue +\ifvmode +\ifx +\ignorespaces +\ignorespacesafterend +\iiiint +\iiint +\iint +\impliedby +\implies +\inf +\injlim +\int +\interdisplaylinepenalty +\intertext +\intop +\joinrel +\jot +\ker +\kern +\l% +\lVert +\label +\lastbox +\lastkern +\lastskip +\lbrace +\ldots +\leavevmode +\left +\leftarrow +\leftmargini +\leftmarginiminus +\leftroot +\leqno +\let +\lg +\lhook +\lim +\liminf +\limits +\lineskip +\lineskiplimit +\linewidth +\llap +\ln +\log +\long +\longleftarrow +\longleftrightarrow +\longmapsto +\longrightarrow +\loop +\lq +\lvert +\mapsto +\mapstochar +\mathaccent +\mathaccentV +\mathalpha +\mathbin +\mathchar +\mathchardef +\mathchoice +\mathclose +\mathcode +\mathdisplay +\mathellipsis +\mathgroup +\mathhexbox +\mathinner +\mathop +\mathopen +\mathord +\mathpalette +\mathpunct +\mathrel +\mathring +\mathsurround +\mathxxx +\mathxxxtest +\mathxxxx +\matrix +\max +\maxdimen +\mbox +\meaning +\medmuskip +\medspace +\min +\minalignsep +\mintagsep +\mkern +\mod +\moveleft +\mskip +\mspace +\multicolumn +\multiply +\multlinegap +\multlinegap10pt +\multlinetaggap +\multlinetaggap10pt +\negmedspace +\negthickspace +\negthinspace +\newbox +\newcommand +\newcount +\newcounter +\newdimen +\newenvironment +\newhelp +\newif +\newmuskip +\newskip +\newtoks +\noalign +\nobreak +\nobreakdash +\nobreakspace +\noexpand +\noindent +\nointerlineskip +\nolimits +\nonscript +\nonumber +\normalbaselines +\normalcolor +\normalfont +\normallineskiplimit +\not +\notag +\nottest +\null +\nulldelimiterspace +\number +\numberwithin +\of +\oint +\ointop +\omit +\openup +\operatorfont +\operatorname +\operatornamewithlimits +\or +\over +\overleftarrow +\overleftrightarrow +\overline +\overrightarrow +\overset +\overwithdelims +\par +\parshape +\penalty +\pmatrix +\pmod +\pod +\postdisplaypenalty +\predisplaypenalty +\prevdepth +\primfrac +\prod +\projlim +\protect +\providecommand +\qopname +\quad +\rVert +\raise +\raisetag +\rangle +\rbrace +\rbrack +\rceil +\ref +\refstepcounter +\relax +\relaxo +\relbar +\renewcommand +\renewenvironment +\repeat +\rfloor +\rgroup +\rhook +\right +\rightarrow +\rlap +\rmoustache +\romannumeral +\root +\rootbox +\rq +\rvert +\scriptfont +\scriptscriptfont +\scriptscriptstyle +\scriptstyle +\sec +\selectfont +\setbox +\setcounter +\shoveleft +\shoveright +\sideset +\sim +\sin +\sinh +\skewchar +\smash +\space +\spaceor +\span +\spbreve +\spcheck +\spdddot +\spddot +\spdot +\sphat +\split +\sptilde +\sqrtsign +\stepcounter +\string +\strut +\strutbox +\subarray +\substack +\sum +\sup +\symoperators +\tabskip +\tag +\taghere +\tan +\tanh +\tbinom +\text +\textellipsis +\textfont +\textstyle +\textup +\tfrac +\the +\theequation +\theparentequation +\thetag +\thickmuskip +\thickmuskip0mu +\thickspace +\thinmuskip +\thinspace +\tilde +\tmspace +\toks +\typeout +\u +\underleftarrow +\underleftrightarrow +\underrightarrow +\underset +\unhbox +\unhcopy +\unpenalty +\unskip +\unvbox +\unvcopy +\uppercase +\uproot +\usefont +\value +\varDelta +\varGamma +\varLambda +\varOmega +\varPhi +\varPi +\varPsi +\varSigma +\varTheta +\varUpsilon +\varXi +\varinjlim +\varliminf +\varlimsup +\varprojlim +\vbox +\vcenter +\vec +\vee +\veqno +\vert +\vrule +\vskip +\vss +\vtop +\wd +\widehat +\widetilde +\xdef +\xleaders +\xleftarrow +\xrightarrow diff --git a/macros/latex-dev/required/amsmath/ams-internal.txt b/macros/latex-dev/required/amsmath/ams-internal.txt new file mode 100644 index 0000000000..06a0c97f09 --- /dev/null +++ b/macros/latex-dev/required/amsmath/ams-internal.txt @@ -0,0 +1,482 @@ +%%%% list of internal commands used by amsmath (not totally correct) + +\@@above +\@@abovewithdelims +\@@atop +\@@atopwithdelims +\@@eqno +\@@italiccorr +\@@leqno +\@@over +\@@overline +\@@overwithdelims +\@@sqrt +\@@undefined +\@@underline +\@M +\@addtoreset +\@amsmath@err +\@arrayboxrestore +\@arrayparboxrestore +\@backslashchar +\@badmath +\@car +\@cdots +\@centering +\@checkend +\@currentlabel +\@currenvir +\@declmathop +\@depth +\@display@init +\@displaytrue +\@eha +\@ehc +\@ehd +\@elt +\@empty +\@emptytoks +\@envbody +\@eqnnum +\@eqnswfalse +\@eqnswtrue +\@eqpen +\@fleqntrue +\@for +\@genfrac +\@getpen +\@gobble +\@gobblefour +\@gobblethree +\@gobbletwo +\@gtempa +\@height +\@iden +\@ifdefinable +\@ifnextchar +\@ifnotempty +\@ifpackageloaded +\@ifpackagewith +\@ifstar +\@ifundefined +\@ignoretrue +\@ldots +\@let@token +\@lign +\@m +\@mathmargin +\@mathmeasure +\@mathstyle +\@namedef +\@ne +\@nil +\@nocnterr +\@nocounterr +\@nx +\@onlypreamble +\@saveprimitive +\@sptoken +\@stpelt +\@tempa +\@tempb +\@tempc +\@tempcnta +\@tempcntb +\@tempd +\@tempdima +\@tempdimb +\@tempdimc +\@temptokena +\@testopt +\@totalleftmargin +\@undefined +\@width +\@xp +\@xp#1 +\DN@ +\DOTS@ +\DOTSCASE@ +\FN@ +\Invalid@@ +\Leftarrowfill@ +\Leftrightarrowfill@ +\Let@ +\Mathstrut@ +\Mathstrutbox@ +\RIfM@ +\Rightarrowfill@ +\SK@@label +\SK@equationtrue +\SK@tagform@ +\Umathch@ +\acc@check +\acc@error +\accentclass@ +\add@amp +\add@amps +\addto@envbody +\addto@hook +\align@ +\align@preamble +\align@recover +\aligned@a +\alignedat@a +\alignedspace@left +\alignsafe@testopt +\alignsep@ +\alignsep@- +\alignsep@< +\alt@tag +\ams@DeclareRobustCommand +\ams@def +\ams@newcommand +\ams@renewcommand +\andhelp@ +\arrowfill@ +\bBigg@ +\begin@stack +\big@size +\bigcap@ +\bigcup@ +\bigodot@ +\bigoplus@ +\bigotimes@ +\bigsqcup@ +\biguplus@ +\bigvee@ +\bigwedge@ +\binrel@ +\binrel@@ +\black@ +\bold@false +\bold@true +\boldsymboldots@ +\boxz@ +\c@MaxMatrixCols +\c@MaxMatrixColsc +\calc@shift@align +\calc@shift@gather +\check@mathfonts +\checkat@false +\checkat@true +\cl@@ckpt +\classnum@ +\cmex@opt +\collect@@body +\collect@body +\column@ +\column@plus +\coprod@ +\count@ +\csname@@ +\csnamec@ +\csnamecl@ +\csnameemdf@ +\csnamem@gobble +\csnamemb@ +\ctagsplit@false +\ctagsplit@true +\default@tag +\delayed@ +\df@label +\df@tag +\dft@tag +\dimen@ +\displ@y +\displ@y@ +\displaywidth@ +\dotsb@ +\dotso@ +\dotsspace@ +\dspbrk@ +\dspbrk@context +\dspbrk@lvl +\dt@pfalse +\dt@ptrue +\emdf@L +\emdf@La +\emdf@R +\emdf@Ra +\emdf@U +\emdf@Ua +\endmathdisplay@a +\endmathdisplay@fleqn +\endmultline@math +\env@cases +\env@matrix +\eqnshift@ +\every@math@size +\ex@ +\ext@arrow +\extra@ +\extrap@ +\f@series +\f@size +\field@lengths +\fieldlengths@ +\finsm@sh +\firstchoice@false +\firstchoice@true +\fracwithdelims@ +\frozen@everymath +\gather@ +\gather@split +\gdisplaywidth@ +\genfrac@choice +\genfrac@rule +\getdsp@pen +\getmathch@ +\getmathcode@ +\gmeasure@ +\gobble@tag +\gtest@false +\gtest@true +\hdots@for +\hexnumber@ +\if@display +\if@eqnsw +\if@fleqn +\ifbold@ +\ifcheckat@ +\ifctagsplit@ +\ifdt@p +\iffirstchoice@ +\ifgtest@ +\ifinalign@ +\ifingather@ +\ifmeasuring@ +\ifshifttag@ +\ifst@rred +\iftag@ +\iftagsleft@ +\iftagsleft@L +\ifxxat@ +\ilimits@ +\inalign@false +\inalign@true +\incr@eqnum +\inf@bad +\ingather@false +\ingather@true +\insplit@ +\intdots@ +\intertext@ +\intkern@ +\ints@a +\ints@b +\ints@c +\invalid@tag +\keybin@ +\keybin@test +\label@in@display +\leavevmode@ifvmode +\leftarrowfill@ +\leftrightarrowfill@ +\leftroot@ +\leftroot@mu +\lendmultline@ +\lendsplit@ +\lineht@ +\ltx@label +\m@gobble +\m@ne +\m@th +\m@th$ +\macc@a +\macc@adjust +\macc@code +\macc@depth +\macc@group +\macc@kerna +\macc@kernb +\macc@nested +\macc@nested@a +\macc@nucleus +\macc@palette +\macc@set@skewchar +\macc@skewchar +\macc@style +\macc@test +\macc@tmp +\macro@ +\macro@@ +\make@df@tag +\make@df@tag@@ +\make@df@tag@@@ +\make@display@tag +\makesm@sh +\maketag@@ +\maketag@@@ +\math@ +\math@bgroup +\math@cr +\math@cr@ +\math@cr@@ +\math@cr@@@ +\math@cr@@@align +\math@cr@@@align@measure +\math@cr@@@aligned +\math@cr@@@alignedat +\math@cr@@@gather +\math@cr@@[ +\math@egroup +\mathbin@ +\mathch@ +\mathdisplay@@pop +\mathdisplay@@push +\mathdisplay@pop +\mathdisplay@push +\mathdisplay@stack +\mathrel@ +\mathsm@sh +\matrix@check +\matrix@error +\maxcol@width +\maxcolumn@widths +\maxfields@ +\mb@b +\mb@t +\mb@tb +\mdots@ +\mdots@@ +\meaning@ +\meaning@@ +\measure@ +\measuring@false +\measuring@true +\mmeasure@ +\multline@ +\multline@indent +\new@ifnextchar +\newmcodes@ +\newmcodes@m +\newmcodes@o +\next@ +\nextii@ +\nextiii@ +\nextiv@ +\nextix@ +\nextv@ +\nextvi@ +\nextvii@ +\nextviii@ +\nfss@text +\nmlimits@ +\noaccents@ +\nogood@displaybreak +\nolimits@ +\nomath@env +\nonmatherr@ +\not@ +\operator@font +\operator@fontlim$ +\operator@fontmod +\overarrow@ +\p@ +\p@equation +\place@tag +\place@tag@gather +\plainroot@ +\print@eqnum +\process@envbody +\prod@ +\protected@edef +\push@begins +\r@@t +\raise@tag +\relaxnext@ +\rendmultline@ +\rendsplit@ +\reset@equation +\reset@strutbox@ +\resetMathstrut@ +\restore@hfuzz +\restore@math@cr +\restorealignstate@ +\restorecolumn@ +\restorecounters@ +\rightarrowfill@ +\rightdelim@ +\row@ +\savealignstate@ +\savecolumn@ +\savecounters@ +\savefieldlength@ +\saveshift@ +\savetaglength@ +\select@group +\set@field +\set@gather@field +\set@mathaccent +\setboxz@h +\sf@size +\shdots@for +\shift@tag +\shifttag@false +\shifttag@true +\sixt@@n +\skip@ +\slimits@ +\split@ +\split@al@a +\split@al@tagcheck +\split@aligned +\split@err +\split@tag +\split@warning +\spread@equation +\ssf@size +\st@rredfalse +\st@rredtrue +\start@align +\start@aligned +\start@gather +\start@multline +\std@equal +\std@minus +\striplong@ +\strut@ +\strut@$ +\strutbox@ +\sum@ +\tag@false +\tag@help +\tag@in@align +\tag@in@display +\tag@in@display@a +\tag@lengths +\tag@shifts +\tag@true +\tag@width +\tagform@ +\tagshift@ +\tagsleft@false +\tagsleft@true +\tagwidth@ +\tdots@ +\text@ +\textdef@ +\thecharacter@ +\thedots@ +\thr@@ +\toks@ +\too@wide +\totwidth@ +\try@load@fontshape +\tw@ +\underarrow@ +\uproot@ +\use@mathgroup +\varlim@ +\varliminf@ +\varlimsup@ +\wdz@ +\x@calc@shift@lc +\x@calc@shift@lf +\x@calc@shift@rc +\x@calc@shift@rf +\x@lcalc@width +\x@rcalc@width +\xatlevel@ +\xxat@true +\z@ diff --git a/macros/latex-dev/required/amsmath/amsbsy.dtx b/macros/latex-dev/required/amsmath/amsbsy.dtx new file mode 100644 index 0000000000..890fbd0d82 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsbsy.dtx @@ -0,0 +1,238 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +%\iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\usepackage{amsbsy} +\GetFileInfo{amsbsy.sty} +\begin{document} +\title{The \pkg{amsbsy} package} +\author{Frank Mittelbach\and Rainer Sch\"opf\and Michael Downes} +\date{Version \fileversion, \filedate} +\DocInput{amsbsy.dtx} +\end{document} +%</driver> +%\fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% +% The package \texttt{amsbsy}, first written in 1989, implements a +% few commands for producing \textbf{bold} characters in the `normal' +% \emph{math version}. +% \begin{quote}\em +% Note: It is recommended nowadays to use the \pkg{bm} package, which +% became available in 1997. +% \end{quote} +% +% If we have bold fonts which contain the character in question then +% we will use these fonts to produce the wanted character. But +% sometimes math fonts are only available in a certain weight +% (e.g.\ the AMS symbol fonts). +% \DescribeMacro\pmb +% For these cases we provide a command which is called \verb+\pmb+ (an +% acronym for \textbf{p}oor \textbf{m}an's \textbf{b}old) with one argument. +% The bolder weight is achieved by copying the argument three times in +% slightly different positions which is better than nothing but no +% match for a real bold font. +% +% \DescribeMacro\boldsymbol +% There also exists the \verb+\boldsymbol+ command which is better in +% all cases where bold fonts exists. This command will internally +% switch to the corresponding `bold' \emph{math version} typeset its +% argument in this version. +% +% Both commands will preserve the nature of their arguments, i.e.\ if +% they get a relational atom their result will again be a relation as +% far as \tex/'s mathspacing is concerned. +% +% Since it is good policy to make at least a small test we try to +% typeset the infinity sign ($\infty$) first with \verb+\pmb+ and then +% with \verb+\boldsymbol+. +% \[ +% \pmb{\infty} = \boldsymbol{\infty} \quad ? +% \] +% \StopEventually{} +% +% Standard package info. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesPackage{amsbsy}[1999/11/29 v1.2d Bold Symbols] +% \end{macrocode} +% +% \section{The implementation} +% +% We need some functions from the \pkg{amsgen} package. +% \begin{macrocode} +\RequirePackage{amsgen} +% \end{macrocode} +% +%\begin{macro}{\boldsymbol} +% In implementing boldsymbol, we must take into account \tex/'s +% limitation of only 16 mathgroups (math families, in Knuth's +% terminology). If we wanted to maintain mathgroups for both the bold +% and non-bold version of each math font, it would not take long to +% run out of mathgroups. Therefore what we do instead for a bold +% symbol is embed it in an \verb|\hbox|; inside that \verb|\hbox|, +% when we start another math formula, we can change all the +% mathgroups to their bold equivalents. +% +% However, to get the correct math style inside the hbox (display, +% text, script or scriptscript) we have to use \verb|\mathchoice|. +% Since \verb|\mathversion{bold}| has a lot of overhead, and +% \verb|\mathchoice| typesets the argument text four times, we would +% rather not put the \verb|\mathversion| command inside each +% \verb|\hbox| in the \verb|\mathchoice|; on the other hand, +% \verb|\mathversion| gives an error message if it's used in math +% mode. Therefore if we want to execute \verb|\mathversion{bold}| +% before starting the \verb|\mathchoice| we have to temporarily +% disable the \verb|\@nomath| error. (The error message is intended +% to keep people from accidentally emboldening a preceding part of a +% math formula, since only the mathgroups defined at the end of a +% math formula will determine the fonts used in that formula; but we +% are going to typeset our bold symbol not in the current formula but +% in an embedded formula, so that this danger doesn't apply here.) +% \begin{macrocode} +\DeclareRobustCommand{\boldsymbol}[1]{% +% \end{macrocode} +% Start a group to localize the change of \verb|\@nomath|: +% \begin{macrocode} + \begingroup +% \end{macrocode} +% Disable \verb|\@nomath| so that we don't have to leave math +% mode before executing \verb|\mathversion|: +% \begin{macrocode} + \let\@nomath\@gobble \mathversion{bold}% +% \end{macrocode} +% \cs{math@atom} is a test macro which looks at its argument and +% produces a math atom of the proper class. +% \begin{macrocode} + \math@atom{#1}{% +% \end{macrocode} +% Although it is tempting to use \verb|\text| here, to save some +% main memory, that caused a bug in the past due to some internal +% interactions with \verb|\mathversion|. +% \begin{macrocode} + \mathchoice% + {\hbox{$\m@th\displaystyle#1$}}% + {\hbox{$\m@th\textstyle#1$}}% + {\hbox{$\m@th\scriptstyle#1$}}% + {\hbox{$\m@th\scriptscriptstyle#1$}}}% +% \end{macrocode} +% End the group we started earlier. +% \begin{macrocode} + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@atom} +% The macro \verb+\math@atom+ looks at its argument and produce a +% correct math atom, i.e.\ a primitive like \verb+\mathopen+. +% Until the day we have a real implementation for all cases we use +% the \verb+\binrel@+ command from \amstex/ which can distinguish +% between binary, relation and ord atoms. +% \begin{macrocode} +\def\math@atom#1#2{% + \binrel@{#1}\binrel@@{#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pmb} +% Poor man's bold command, works by typesetting multiple copies of +% the given argument with small offsets. +% \begin{macrocode} +\DeclareRobustCommand{\pmb}{% + \ifmmode\else \expandafter\pmb@@\fi\mathpalette\pmb@} +% \end{macrocode} +% +% \cs{pmb@@} is called by \cn{pmb} in the non-math-mode case. +% Discard the first two arguments which are for the math-mode case. +% \begin{macrocode} +\def\pmb@@#1#2#3{\leavevmode\setboxz@h{#3}% + \dimen@-\wdz@ + \kern-.5\ex@\copy\z@ + \kern\dimen@\kern.25\ex@\raise.4\ex@\copy\z@ + \kern\dimen@\kern.25\ex@\box\z@ +} +% \end{macrocode} +% +% \begin{macrocode} +\newdimen\pmbraise@ +% \end{macrocode} +% Note: because of the use of \cs{mathpalette}, if \cs{pmb@} is applied to a +% single math italic character (or a single character from some other +% slanted math font), the italic correction will be added. This will +% cause subscripts to fall too far away from the character in some +% cases, e.g., $\pmb{T}_1$ or $\pmb{\mathcal{T}}_1$. +% \begin{macrocode} +\def\pmb@#1#2{\setbox8\hbox{$\m@th#1{#2}$}% + \setboxz@h{$\m@th#1\mkern.5mu$}\pmbraise@\wdz@ + \binrel@{#2}% + \dimen@-\wd8 % + \binrel@@{% + \mkern-.8mu\copy8 % + \kern\dimen@\mkern.4mu\raise\pmbraise@\copy8 % + \kern\dimen@\mkern.4mu\box8 }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\binrel@#1{\begingroup + \setboxz@h{\thinmuskip0mu + \medmuskip\m@ne mu\thickmuskip\@ne mu + \setbox\tw@\hbox{$#1\m@th$}\kern-\wd\tw@ + ${}#1{}\m@th$}% +% \end{macrocode} +% The \cn{noexpand} here should be unnecessary, but just in case +% \ldots +% \begin{macrocode} + \edef\@tempa{\endgroup\let\noexpand\binrel@@ + \ifdim\wdz@<\z@ \mathbin + \else\ifdim\wdz@>\z@ \mathrel + \else \relax\fi\fi}% + \@tempa +} +% \end{macrocode} +% For completeness, assign a default value for \cs{binrel@@}. +% \begin{macrocode} +\let\binrel@@\relax +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \CheckSum{131} +% \Finale diff --git a/macros/latex-dev/required/amsmath/amsbsy.ins b/macros/latex-dev/required/amsmath/amsbsy.ins new file mode 100644 index 0000000000..fe1cd5413d --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsbsy.ins @@ -0,0 +1,50 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amsbsy.sty}{\from{amsbsy.dtx}{}} +} + +\endbatchfile diff --git a/macros/latex-dev/required/amsmath/amsbsy.pdf b/macros/latex-dev/required/amsmath/amsbsy.pdf Binary files differnew file mode 100644 index 0000000000..9a2dabfc88 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsbsy.pdf diff --git a/macros/latex-dev/required/amsmath/amscd.dtx b/macros/latex-dev/required/amsmath/amscd.dtx new file mode 100644 index 0000000000..2d0a35d685 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amscd.dtx @@ -0,0 +1,322 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +%\iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\usepackage{amscd} +\GetFileInfo{amscd.sty} +% Dummy citation to avoid error in an example. +\bibcite{fre:cichon}{C} +\begin{document} +\title{The \pkg{amscd} package} +\author{Frank Mittelbach\and Rainer Sch\"opf\and Michael Downes} +\date{Version \fileversion, \filedate} +\DocInput{amscd.dtx} +\end{document} +%</driver> +%\fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% \newcommand{\operatorname}[1]{\mathop{\mathrm{#1}}} +% \newcommand{\per}{\operatorname{per}} +% \newcommand{\cov}{\operatorname{cov}} +% \newcommand{\non}{\operatorname{non}} +% \newcommand{\cf}{\operatorname{cf}} +% \newcommand{\add}{\operatorname{add}} +% \newcommand{\End}{\operatorname{End}} +% +% \section{Introduction} +% +% The \pkg{amscd} package provides a \env{CD} environment that +% emulates the commutative diagram capabilities of \amstex/ version +% 2.x. This means that only simple rectangular diagrams are +% supported, with no diagonal arrows or more exotic features. Many +% users will be better served by one of the more powerful diagram +% packages such as \pkg{diagram}, \pkg{xypic}, or \pkg{kuvio}. +% +% Example: +% \begin{equation}\begin{CD} +% S^{{\mathcal{W}}_\Lambda}\otimes T @>j>> T\\ +% @VVV @VV{\End P}V\\ +% (S\otimes T)/I @= (Z\otimes T)/J +% \end{CD}\end{equation} +% \begin{verbatim} +% \begin{equation}\begin{CD} +% S^{{\mathcal{W}}_\Lambda}\otimes T @>j>> T\\ +% @VVV @VV{\End P}V\\ +% (S\otimes T)/I @= (Z\otimes T)/J +% \end{CD}\end{equation} +% \end{verbatim} +% (assuming \cn{End} is defined as an `operator name'. +% +% Another example: +% +% We will make liberal use of Cichon's Diagram \cite{fre:cichon}: +% \begin{equation} +% \begin{CD} +% \cov(\mathcal{L}) @>>> \non(\mathcal{K}) @>>> \cf(\mathcal{K}) @>>> +% \cf(\mathcal{L})\\ +% @VVV @AAA @AAA @VVV\\ +% \add(\mathcal{L}) @>>> \add(\mathcal{K}) @>>> \cov(\mathcal{K}) @>>> +% \non(\mathcal{L}) +% \end{CD}\end{equation} +% \begin{verbatim} +% \begin{equation}\begin{CD} +% \cov(\mathcal{L}) @>>> \non(\mathcal{K}) @>>> \cf(\mathcal{K}) @>>> +% \cf(\mathcal{L})\\ +% @VVV @AAA @AAA @VVV\\ +% \add(\mathcal{L}) @>>> \add(\mathcal{K}) @>>> \cov(\mathcal{K}) @>>> +% \non(\mathcal{L}) +% \end{CD}\end{equation} +% \end{verbatim} +% +% \StopEventually{} +% +% Standard package info. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesPackage{amscd}[2017/04/14 v2.1 AMS Commutative Diagrams] +% \end{macrocode} +% \begin{macrocode} +\RequirePackage{amsgen} +% \end{macrocode} +% Better not to redefine \verb|\math@cr| if it is already defined, +% because for CD use only we want to omit the part of the code +% related to \verb|\dspbrk@lvl| (see \fn{amsmath.sty}). +% +% [mjd,1999/11/04] These definitions have gone somewhat obsolete; but +% we had probably better leave them as they are for backward +% compatibility. +% \begin{macrocode} +\@ifundefined{math@cr}{% + \def\math@cr{{\ifnum0=`}\fi + \@ifstar{\global\@eqpen\@M\math@cr@}% + {\global\@eqpen\interdisplaylinepenalty \math@cr@}} +% \end{macrocode} +% The following section merely duplicates some code from the +% \pkg{amsmath} package, in case the \pkg{amscd} package is used by +% itself. For documentation of the code refer to \fn{amsmath.dtx}. +% \begin{macrocode} + \def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}} + \def\math@cr@@[#1]{\ifnum0=`{\fi}\math@cr@@@ + \noalign{\vskip#1\relax}} + \def\restore@math@cr{\def\math@cr@@@{\cr}} +}{} +\restore@math@cr +% \end{macrocode} +% [mjd,1999/11/04] These definitions too are somewhat obsolete; +% but we had probably better leave them as they are for backward +% compatibility. +% \begin{macrocode} +\@ifundefined{rightarrowfill@}{ + \def\rightarrowfill@#1{\m@th\setboxz@h{$#1-$}\ht\z@\z@ + $#1\copy\z@\mkern-6mu\cleaders + \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill + \mkern-6mu\mathord\rightarrow$} + \def\leftarrowfill@#1{\m@th\setboxz@h{$#1-$}\ht\z@\z@ + $#1\mathord\leftarrow\mkern-6mu\cleaders + \hbox{$#1\mkern-2mu\copy\z@\mkern-2mu$}\hfill + \mkern-6mu\box\z@$} + \def\leftrightarrowfill@#1{\m@th\setboxz@h{$#1-$}\ht\z@\z@ + $#1\mathord\leftarrow\mkern-6mu\cleaders + \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill + \mkern-6mu\mathord\rightarrow$} +}{} +% \end{macrocode} +% +% \begin{macrocode} +\def\atdef@#1{\expandafter\def\csname\space @\string#1\endcsname} +\@ifundefined{Iat}{% + \DeclareRobustCommand{\Iat}{\FN@\at@} +}{} +\begingroup \catcode`\@=\active +% \end{macrocode} +% Define math \qc{\@} to replicate its mathcode-dictated behavior. +% This is in case \qc{\@} occurs outside of \env{CD}. +% \begin{macrocode} +\csname if\string @compatibility\endcsname +\else \fam=\mathcode`\@ + \xdef @{\mathchar\number\fam\space } +\fi +\gdef\CDat{\let @=\Iat} +\endgroup +\mathcode`\@="8000 % make @ pseudo-active in math +\def\at@{\let\next@\at@@ + \ifcat\noexpand\next a\else + \ifcat\noexpand\next0\else + \ifcat\noexpand\next\relax\else + \let\next@\at@@@\fi\fi\fi\next@} +\def\at@@#1{\expandafter + \ifx\csname\space @\string#1\endcsname\relax + \DN@{\at@@@#1}% + \else + \DN@{\csname\space @\string#1\endcsname}% + \fi\next@}% +% \end{macrocode} +% The following items should be defined only if they are not +% already defined, either to leave the package name untouched (in +% the case of \cs{PackageError}) or to avoid redundant allocation +% of token or dimen registers. +% \begin{macrocode} +\@ifundefined{default@tag}{% + \def\default@tag{% + \def\tag{\PackageError{amscd}{\protect\tag\space not allowed + here}\@eha}}% +}{}% +\@ifundefined{at@@@}{% + \def\at@@@{\PackageError{amscd}{\Invalid@@ @}{\the\athelp@}\char64\relax} +}{} +\@ifundefined{athelp@}{\csname newhelp\endcsname\athelp@ +{Only certain combinations beginning with @ make sense to me.^^J% +I'll assume you wanted @@ for a printed @.}}{} +\@ifundefined{minaw@}{\newdimen\minaw@}{} +\@ifundefined{bigaw@}{\newdimen\bigaw@}{} +% \end{macrocode} +% +% Assignment of a couple of dimensions, and initialization of +% \verb=\ampersand@=. We check to see if we need to define +% \verb=\minaw@= and \verb=\bigaw@=. +% \begin{macrocode} +\minaw@11.111pt +\newdimen\minCDarrowwidth +\minCDarrowwidth2.5pc +\newif\ifCD@ +\let\ampersand@\relax +% \end{macrocode} +% +% Added \verb|\restore@math@cr\default@tag| to fix line numbering +% problems, 7-JUN-1991. Suggested by I.~Zakharevich. +% \begin{macrocode} +\newenvironment{CD}{% + \CDat + \bgroup\relax\iffalse{\fi\let\ampersand@&\iffalse}\fi + \CD@true\vcenter\bgroup\let\\\math@cr\restore@math@cr\default@tag + \tabskip\z@skip\baselineskip20\ex@ + \lineskip3\ex@\lineskiplimit3\ex@\halign\bgroup + &\hfill$\m@th##$\hfill\crcr +}{% + \crcr\egroup\egroup\egroup +} +% \end{macrocode} +% +% \begin{macro}{\CD@check} +% This check is used by all macros that must not appear outside the +% \env{CD} environment. The first argument is the symbol to be used +% after \verb+@+, the second one the action to be performed. +% +% Once again we use the trick of defining a temporary control +% sequence \verb+\next@+ and calling it after the final \verb+\fi+. +% This is not absolutely necessary, but it ensures that the +% conditional text is processed in one and the same column +% of the enclosing alignment. +% \begin{macrocode} +\def\CD@check#1#2{\ifCD@\DN@{#2}\else + \DN@{\PackageError{amscd}{@\protect#1 not + allowed outside of the CD environment}\@eha}% + \fi\next@} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\atdef@>#1>#2>{\ampersand@ + \ifCD@ \global\bigaw@\minCDarrowwidth \else \global\bigaw@\minaw@ \fi + \setboxz@h{$\m@th\scriptstyle\;{#1}\;\;$}% + \ifdim\wdz@>\bigaw@\global\bigaw@\wdz@\fi +% \end{macrocode} +% If \verb|#2| is empty we can save some work. +% \begin{macrocode} + \@ifnotempty{#2}{\setbox\@ne\hbox{$\m@th\scriptstyle\;{#2}\;\;$}% + \ifdim\wd\@ne>\bigaw@\global\bigaw@\wd\@ne\fi}% + \ifCD@\enskip\fi + \mathrel{\mathop{\hbox to\bigaw@{\rightarrowfill@\displaystyle}}% + \limits^{#1}\@ifnotempty{#2}{_{#2}}}% + \ifCD@\enskip\fi \ampersand@} +% +\atdef@<#1<#2<{\ampersand@ + \ifCD@ \global\bigaw@\minCDarrowwidth \else \global\bigaw@\minaw@ \fi + \setboxz@h{$\m@th\scriptstyle\;\;{#1}\;$}% + \ifdim\wdz@>\bigaw@ \global\bigaw@\wdz@ \fi + \@ifnotempty{#2}{\setbox\@ne\hbox{$\m@th\scriptstyle\;\;{#2}\;$}% + \ifdim\wd\@ne>\bigaw@ \global\bigaw@\wd\@ne \fi}% + \ifCD@\enskip\fi + \mathrel{\mathop{\hbox to\bigaw@{\leftarrowfill@\displaystyle}}% + \limits^{#1}\@ifnotempty{#2}{_{#2}}}% + \ifCD@\enskip\fi \ampersand@} +% \end{macrocode} +% +% Variants of the above two arrows, using \verb|(| and \verb|)| +% characters instead of \verb|<| and \verb|>| characters, are +% provided for those whose keyboards don't have the latter. +% \begin{macrocode} +\begingroup \catcode`\~=\active \lccode`\~=`\@ +\lowercase{% + \global\atdef@)#1)#2){~>#1>#2>} + \global\atdef@(#1(#2({~<#1<#2<} +}% end lowercase +\endgroup +% \end{macrocode} +% +% \begin{macrocode} +\atdef@ A#1A#2A{\CD@check{A..A..A}{\llap{$\m@th\vcenter{\hbox + {$\scriptstyle#1$}}$}\Big\uparrow + \rlap{$\m@th\vcenter{\hbox{$\scriptstyle#2$}}$}&&}} +% +\atdef@ V#1V#2V{\CD@check{V..V..V}{\llap{$\m@th\vcenter{\hbox + {$\scriptstyle#1$}}$}\Big\downarrow + \rlap{$\m@th\vcenter{\hbox{$\scriptstyle#2$}}$}&&}} +% +\atdef@={\CD@check={&\enskip\mathrel + {\vbox{\hrule\@width\minCDarrowwidth\vskip2\ex@\hrule\@width + \minCDarrowwidth}}\enskip&}} +% +\atdef@|{\CD@check|{\Big\Vert&&}} +% +\atdef@\vert{\CD@check\vert{\Big\Vert&&}} +% +\atdef@.{\CD@check.{&&}} +% \end{macrocode} +% +% The \cn{pretend} command has weird syntax that doesn't fit well +% with standard \latex/ syntax so we leave it undone, at least for +% now. [mjd,1994/10/27] +% \begin{macrocode} +%\def\pretend#1\haswidth#2{\setboxz@h{$\m@th\scriptstyle{#2}$}\hbox +% to\wdz@{\hfill$\m@th\scriptstyle{#1}$\hfill}} +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \CheckSum{459} +% \Finale diff --git a/macros/latex-dev/required/amsmath/amscd.ins b/macros/latex-dev/required/amsmath/amscd.ins new file mode 100644 index 0000000000..148c4cb32e --- /dev/null +++ b/macros/latex-dev/required/amsmath/amscd.ins @@ -0,0 +1,50 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amscd.sty}{\from{amscd.dtx}{}} +} + +\endbatchfile diff --git a/macros/latex-dev/required/amsmath/amscd.pdf b/macros/latex-dev/required/amsmath/amscd.pdf Binary files differnew file mode 100644 index 0000000000..860352c44a --- /dev/null +++ b/macros/latex-dev/required/amsmath/amscd.pdf diff --git a/macros/latex-dev/required/amsmath/amsgen.dtx b/macros/latex-dev/required/amsmath/amsgen.dtx new file mode 100644 index 0000000000..5edc26b9cc --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsgen.dtx @@ -0,0 +1,386 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +% \iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\usepackage{amsgen} +\GetFileInfo{amsgen.sty} +\begin{document} +\title{The \pkg{amsgen} package} +\author{American Mathematical Society\\Michael Downes} +\date{Version \fileversion, \filedate} +\DocInput{amsgen.dtx} +\end{document} +%</driver> +% \fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% This is an internal package for storing common functions +% that are shared by more than one package in the \amslatex/ +% distribution. Some of these might eventually make it into the \latex/ +% kernel. +% +% \StopEventually{} +% +% Standard package info. +% Using \cs{ProvidesFile} rather than \cs{ProvidesPackage} because +% the latter, when input by, e.g, \cls{amsbook}, results in +% \texttt{LaTeX warning: You have requested document class `amsbook', +% but the document class provides `amsgen'.} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesFile{amsgen.sty}[1999/11/30 v2.0 generic functions] +% \end{macrocode} +% +% \section{Implementation} +% Some general macros shared by \fn{amsart.dtx}, \fn{amsmath.dtx}, +% \fn{amsfonts.dtx}, \dots +% +% \begin{macro}{\@saveprimitive} +% The \pkg{amsmath} package redefines a number of \tex/ primitives. +% In case some preceding package also decided to redefine one of +% those same primitives, we had better do some checking to make +% sure that we are able to save the primitive meaning for internal +% use. This is handled by the \cs{@saveprimitive} function. We +% follow the example of \cs{@@input} where the primitive meaning is +% stored in an internal control sequence with a |@@| prefix. +% Primitive control sequences can be distinguished by the fact that +% \cs{string} and \cs{meaning} return the same information. +% \begin{macrocode} +\providecommand{\@saveprimitive}[2]{\begingroup\escapechar`\\\relax + \edef\@tempa{\string#1}\edef\@tempb{\meaning#1}% + \ifx\@tempa\@tempb \global\let#2#1% + \else +% \end{macrocode} +% Check to see if \arg{2} was already given the desired primitive +% meaning somewhere else. +% \begin{macrocode} + \edef\@tempb{\meaning#2}% + \ifx\@tempa\@tempb + \else + \@latex@error{Unable to properly define \string#2; primitive + \noexpand#1no longer primitive}\@eha + \fi + \fi + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xp} +% \begin{macro}{\@nx} +% Shorthands for long command names. +% \begin{macrocode} +\let\@xp=\expandafter +\let\@nx=\noexpand +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@emptytoks} +% A token register companion for \cs{@empty}. Saves a little main mem and +% probably makes initializations such as |\toks@{}| run faster too. +% \begin{macrocode} +\newtoks\@emptytoks +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@oparg} +% Use of \cs{@oparg} simplifies some constructions where a macro +% takes an optional argument in square brackets. We can't use +% \cn{newcommand} here because this function might be previously +% defined by the \pkg{amsmath} package in a loading sequence such as +% \begin{verbatim} +% \usepackage{amsmath,amsthm} +% \end{verbatim} +% \begin{macrocode} +\def\@oparg#1[#2]{\@ifnextchar[{#1}{#1[#2]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@ifempty} +% \begin{macro}{\@ifnotempty} +% |\@ifnotempty| and |\@ifempty| use category 11 |@| characters to +% test whether the argument is empty or not, since these are highly +% unlikely to occur in the argument. As with \cn{@oparg}, there is a +% possibility that these commands were defined previously in +% \fn{amsmath.sty}. +% \begin{macrocode} +\long\def\@ifempty#1{\@xifempty#1@@..\@nil} +\long\def\@xifempty#1#2@#3#4#5\@nil{% + \ifx#3#4\@xp\@firstoftwo\else\@xp\@secondoftwo\fi} +% \end{macrocode} +% \cs{@ifnotempty} is a shorthand that makes code read better when +% no action is needed in the empty case. At a cost of double +% argument-reading---so for often-executed code, avoiding +% \cs{@ifnotempty} might be wise. +% \begin{macrocode} +\long\def\@ifnotempty#1{\@ifempty{#1}{}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Some abbreviations to conserve token mem. +% \begin{macrocode} +\def\FN@{\futurelet\@let@token} +\def\DN@{\def\next@} +\def\RIfM@{\relax\ifmmode} +\def\setboxz@h{\setbox\z@\hbox} +\def\wdz@{\wd\z@} +\def\boxz@{\box\z@} +\def\relaxnext@{\let\@let@token\relax} +% \end{macrocode} +% +% \begin{macro}{\new@ifnextchar} +% This macro is a new version of \latex/'s \verb+\@ifnextchar+, +% macro that does not skip over spaces. +% \begin{macrocode} +\long\def\new@ifnextchar#1#2#3{% +% \end{macrocode} +% By including the space after the equals sign, we make it possible +% for \cs{new@ifnextchar} to do look-ahead for any token, including a +% space! +% \begin{macrocode} + \let\reserved@d= #1% + \def\reserved@a{#2}\def\reserved@b{#3}% + \futurelet\@let@token\new@ifnch +} +% +\def\new@ifnch{% + \ifx\@let@token\reserved@d \let\reserved@b\reserved@a \fi + \reserved@b +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@ifstar} +% There will essentially never be a space before the \qc{\*}, so +% using \cs{@ifnextchar} is unnecessarily slow. +% \begin{macrocode} +\def\@ifstar#1#2{\new@ifnextchar *{\def\reserved@a*{#1}\reserved@a}{#2}} +% \end{macrocode} +% \end{macro} +% +% The hook \cs{every@size} was changed to \cs{every@math@size} in the +% December 1994 release of \latex/ and its calling procedures changed. +% If \cs{every@math@size} is undefined it means the user has an older +% version of \latex/ so we had better define it and patch a couple of +% functions (\cs{glb@settings} and \cs{set@fontsize}). +% \begin{macrocode} +\@ifundefined{every@math@size}{% +% \end{macrocode} +% Reuse the same token register; since it was never used except for +% the purposes that are affected below, this is OK. +% \begin{macrocode} +\let\every@math@size=\every@size +\def\glb@settings{% + \expandafter\ifx\csname S@\f@size\endcsname\relax + \calculate@math@sizes + \fi + \csname S@\f@size\endcsname + \ifmath@fonts +% \ifnum \tracingfonts>\tw@ +% \@font@info{Setting up math fonts for +% \f@size/\f@baselineskip}\fi + \begingroup + \escapechar\m@ne + \csname mv@\math@version \endcsname + \globaldefs\@ne + \let \glb@currsize \f@size + \math@fonts + \endgroup + \the\every@math@size + \else +% \ifnum \tracingfonts>\tw@ +% \@font@info{No math setup for \f@size/\f@baselineskip}% +% \fi + \fi +} +% \end{macrocode} +% Remove |\the\every@size| from \cs{size@update}. +% \begin{macrocode} +\def\set@fontsize#1#2#3{% + \@defaultunits\@tempdimb#2pt\relax\@nnil + \edef\f@size{\strip@pt\@tempdimb}% + \@defaultunits\@tempskipa#3pt\relax\@nnil + \edef\f@baselineskip{\the\@tempskipa}% + \edef\f@linespread{#1}% + \let\baselinestretch\f@linespread + \def\size@update{% + \baselineskip\f@baselineskip\relax + \baselineskip\f@linespread\baselineskip + \normalbaselineskip\baselineskip + \setbox\strutbox\hbox{% + \vrule\@height.7\baselineskip + \@depth.3\baselineskip + \@width\z@}% +%%% \the\every@size + \let\size@update\relax}% + } +}{}% end \@ifundefined test +% \end{macrocode} +% +% \begin{macro}{\ex@} +% The \cs{ex@} variable provides a small unit of space for use in +% math-mode constructions, that varies according to the current type +% size. For example, the \cn{pmb} command uses \cs{ex@} units. +% Since a macro or mu unit solution for the \meta{dimen} \cs{ex@} won't +% work without changing a lot of current code in the \pkg{amsmath} +% package, we set \cs{ex@} through the \cs{every@math@size} hook. +% The value of \cs{ex@} is scaled nonlinearly in a range of roughly +% 0.5pt to 1.5pt, by the function \cs{compute@ex@}. +% \begin{macrocode} +\newdimen\ex@ +\addto@hook\every@math@size{\compute@ex@} +% \end{macrocode} +% \end{macro} +% +% \cs{compute@ex@} computes \cs{ex@} as a nonlinear scaling from 10pt +% to current font size (\cs{f@size}). Using .97 as the multiplier makes 1 +% |ex@| $\approx$ .9pt when the current type size is 8pt and 1 |ex@| +% $\approx$ 1.1pt when the current type size is 12pt. +% +% The formula is essentially +% \begin{displaymath} +% \newcommand{\points}{\mbox{pt}} +% \newcommand{\floor}[1]{\lfloor#1\rfloor} +% 1\points \pm (1\points - (.97)^{\floor{\vert 10 - n\vert}}) +% \end{displaymath} +% where $n$ = current type size, but adjusted to differentiate +% half-point sizes as well as whole point sizes, and there is a +% cutoff for extraordinarily large values of \cs{f@size} ($>$ 20pt) +% so that the value of \cs{ex@} never exceeds 1.5pt. +% +% \begin{macrocode} +\def\compute@ex@{% + \begingroup + \dimen@-\f@size\p@ + \ifdim\dimen@<-20\p@ +% \end{macrocode} +% Never make \cs{ex@} larger than 1.5pt. +% \begin{macrocode} + \global\ex@ 1.5\p@ + \else +% \end{macrocode} +% Adjust by the reference size and multiply by 2 to allow for +% half-point sizes. +% \begin{macrocode} + \advance\dimen@10\p@ \multiply\dimen@\tw@ +% \end{macrocode} +% Save information about the current sign of \cs{dimen@}. +% \begin{macrocode} + \edef\@tempa{\ifdim\dimen@>\z@ -\fi}% +% \end{macrocode} +% Get the absolute value of \cs{dimen@}. +% \begin{macrocode} + \dimen@ \ifdim\dimen@<\z@ -\fi \dimen@ + \advance\dimen@-\@m sp % fudge factor +% \end{macrocode} +% Here we use \cs{vfuzz} merely as a convenient scratch register +% \begin{macrocode} + \vfuzz\p@ +% \end{macrocode} +% Multiply in a loop. +% \begin{macrocode} + \def\do{\ifdim\dimen@>\z@ + \vfuzz=.97\vfuzz + \advance\dimen@ -\p@ +%\message{\vfuzz: \the\vfuzz, \dimen@: \the\dimen@}% + \@xp\do \fi}% + \do + \dimen@\p@ \advance\dimen@-\vfuzz + \global\ex@\p@ + \global\advance\ex@ \@tempa\dimen@ + \fi + \endgroup +%\typeout{\string\f@size: \f@size}\showthe\ex@ +} +% \end{macrocode} +% Tests of the \cs{compute@ex@} function yield the following results: +% +% \begin{center}\begin{tabular}{rlrl} +% \cs{f@size}& \cs{ex@}& \cs{f@size}& \cs{ex@}\\ +% 10& 1.0pt& 9& 0.94089pt\\ +% 11& 1.05911pt& 8.7& 0.91266pt\\ +% 12& 1.11473pt& 8.5& 0.91266pt\\ +% 14.4& 1.23982pt& 8.4& 0.88527pt\\ +% 17.28& 1.36684pt& 8& 0.88527pt\\ +% 20.74& 1.5pt& 7& 0.83293pt\\ +% 19.5& 1.4395pt& 6& 0.78369pt\\ +% && 5& 0.73737pt\\ +% && 1& 0.57785pt +% \end{tabular}\end{center} +% +% \begin{macro}{\@addpunct} +% Use of the \cs{@addpunct} function allows ending punctuation in +% section headings and elsewhere to be intelligently omitted +% when punctuation is already present. +% \begin{macrocode} +\def\@addpunct#1{\ifnum\spacefactor>\@m \else#1\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\frenchspacing} +% Change \cn{frenchspacing} to ensure that \cs{@addpunct} will +% continue to work properly even when `french' spacing is in effect. +% \begin{macrocode} +\def\frenchspacing{\sfcode`\.1006\sfcode`\?1005\sfcode`\!1004% + \sfcode`\:1003\sfcode`\;1002\sfcode`\,1001 } +% \end{macrocode} +% \end{macro} +% +% \subsection{Miscellaneous} +% \begin{macrocode} +\def\nomath@env{\@amsmath@err{% + \string\begin{\@currenvir} allowed only in paragraph mode% +}\@ehb% "You've lost some text" +} +% \end{macrocode} +% A trade-off between main memory space and hash size; using +% \verb+\Invalid@@+ saves 14 bytes of main memory for each use of +% \verb+\Invalid@+, at the cost of one control sequence name. +% \verb+\Invalid@+ is currently used about five times and +% \verb+\Invalid@@+ is used by itself in some other instances, +% which means that it saves us more memory than \verb+\FN@+, +% \verb+\RIfM@+, and some of the other abbreviations above. +% \begin{macrocode} +\def\Invalid@@{Invalid use of \string} +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \CheckSum{337} +% \Finale diff --git a/macros/latex-dev/required/amsmath/amsgen.ins b/macros/latex-dev/required/amsmath/amsgen.ins new file mode 100644 index 0000000000..8c5683cb5a --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsgen.ins @@ -0,0 +1,50 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amsgen.sty}{\from{amsgen.dtx}{}} +} + +\endbatchfile diff --git a/macros/latex-dev/required/amsmath/amsgen.pdf b/macros/latex-dev/required/amsmath/amsgen.pdf Binary files differnew file mode 100644 index 0000000000..9078999dc0 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsgen.pdf diff --git a/macros/latex-dev/required/amsmath/amsldoc.pdf b/macros/latex-dev/required/amsmath/amsldoc.pdf Binary files differnew file mode 100644 index 0000000000..decc68fe74 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsldoc.pdf diff --git a/macros/latex-dev/required/amsmath/amsldoc.tex b/macros/latex-dev/required/amsmath/amsldoc.tex new file mode 100644 index 0000000000..9e08f029f5 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsldoc.tex @@ -0,0 +1,2770 @@ +% +% Copyright (C) 1995, 2000, 2013 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +\documentclass[leqno,titlepage,openany]{amsldoc}[1999/12/13] + +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} + +\ifx\UndEfiNed\url + \ClassError{amsldoc}{% + This version of amsldoc.tex must be processed\MessageBreak + with a newer version of amsldoc.cls (2.02 or later).}{} +\fi + +\renewcommand\bibname{References} + +% Definitions that should be moved to amsldoc.cls +% when it is next updated +\makeatletter +\let\cleardouble@page\cleardoublepage +\AtBeginDocument{% + \ifx\cleardouble@page\cleardoublepage + \def\cleardoublepage{\clearpage{\pagestyle{empty}\cleardouble@page}} + \fi +} + +% #1 is empty or one of class, environment, option, package +% could use different font in each case +\makeatletter +\def\@category@index#1#2{% + \autoindex{% + #2\actualchar\string\index#1font{#2}% + \ifx\@nil#1\@nil\else\space#1\fi + }% +} + +\let\indexpackagefont\textsf +\let\indexclassfont\textsf +\let\indexoptionfont\texttt +\let\indexenvironmentfont\texttt +\let\indexfont\texttt +\makeatother +% For a package that won't be indexed, i.e. amsmath +\newcommand{\nipkg}{\textsf} +\def\tikz/{Ti\textit{k}Z} +% End definitions for amsldoc.cls + +\title{User's Guide for the \nipkg{amsmath} Package (Version~2.1)} +\author{American Mathematical Society, \LaTeX3 Project} +\date{1999-12-13 (revised 2002-02-25, 2016-11-14, 2018-04-05)} +\makeatletter +\def\@thanks{\bigskip\MaintainedByLaTeXTeam{amslatex}} +\makeatother + +% Use the amsmath package and amscd package in order to print +% examples. +\usepackage{amsmath} +\usepackage{amscd} + +\usepackage{imakeidx} +% Need alternate coding for vertical bar to get it into index. +% Based on \qcbang and \cnbang in amsldoc.cls, refined by David Carlisle. +% Give it a sort field that will be at the end of the symbols; +% must avoid " and | which have special meanings. +\DeclareRobustCommand{\qcvert}{\qc\|\index{{z1}@{\ntt\char'174}}} +\DeclareRobustCommand{\cnvert}{% + \ncn{\|}\index{{z0}@{\ntt\bslchar\char'174}}} +% Need alternate index sort field for bang to allow & to sort first +\DeclareRobustCommand{\altcnbang}{% + \ncn{\!}\index{"!b@{\ntt\bslchar\qcbang}}} +\DeclareRobustCommand{\cnamp}{% + \index{"!a@\texttt{\&}}} + +\makeindex[intoc] % generate index data +\providecommand{\see}[2]{\textit{see} #1} + +% The amsldoc class includes a number of features useful for +% documentation about TeX, including: +% +% ---Commands \tex/, \amstex/, \latex/, ... for uniform treatment +% of the various logos and easy handling of following spaces. +% +% ---Commands for printing various common elements: \cn for command +% names, \fn for file names (including font-file names), \env for +% environments, \pkg and \cls for packages and classes, etc. + +% Many of the command names used here are rather long and will +% contribute to poor linebreaking if we follow the \latex/ practice +% of not hyphenating anything set in tt font; instead we selectively +% allow some hyphenation. +\allowtthyphens % defined in amsldoc.cls + +\hyphenation{ac-cent-ed-sym-bol add-to-counter add-to-length align-at + aligned-at allow-dis-play-breaks ams-art ams-cd ams-la-tex amsl-doc + ams-symb ams-tex ams-text ams-xtra bmatrix bold-sym-bol cen-ter-tags + eqn-ar-ray idots-int int-lim-its latex med-space neg-med-space + neg-thick-space neg-thin-space no-int-lim-its no-name-lim-its + over-left-arrow over-left-right-arrow over-right-arrow pmatrix + qed-sym-bol set-length side-set small-er tbinom the-equa-tion + thick-space thin-space un-der-left-arrow un-der-left-right-arrow + un-der-right-arrow use-pack-age var-inj-lim var-proj-lim vmatrix + xalign-at xx-align-at} + +% Prepare for illustrating the \vec example +\newcommand{\vect}[1]{\mathbf{#1}} + +\newcommand{\booktitle}[1]{\textit{#1}} +\newcommand{\journalname}[1]{\textit{#1}} +\newcommand{\seriesname}[1]{\textit{#1}} + +% Command to insert and index a particular phrase. Doesn't work for +% certain kinds of special characters in the argument. +\newcommand{\ii}[1]{#1\index{#1}} + +\newcommand{\vstrut}[1]{\vrule width0pt height#1\relax} + +% An environment for presenting comprehensive address information: +\newenvironment{infoaddress}{% + \par\topsep\medskipamount + \trivlist\centering + \item[]% + \begin{minipage}{.7\columnwidth}% + \raggedright +}{% + \end{minipage}% + \endtrivlist +} + +\newenvironment{eqxample}{% + \par\addvspace\medskipamount + \noindent\begin{minipage}{.5\columnwidth}% + \def\producing{\end{minipage}\begin{minipage}{.5\columnwidth}% + \hbox\bgroup\kern-.2pt\vrule width.2pt% + \vbox\bgroup\parindent0pt\relax +% The 3pt is to cancel the -\lineskip from \displ@y + \abovedisplayskip3pt \abovedisplayshortskip\abovedisplayskip + \belowdisplayskip0pt \belowdisplayshortskip\belowdisplayskip + \noindent} +}{% + \par +% Ensure that a lonely \[\] structure doesn't take up width less than +% \hsize. + \hrule height0pt width\hsize + \egroup\vrule width.2pt\kern-.2pt\egroup + \end{minipage}% + \par\addvspace\medskipamount +} + +% Errors in output shouldn't be \texttt, and they may also be longer +% than one line, but they should be identified by the "errorbullet". +% (They were formerly labeled as aubsections.) +\newenvironment{erroro}[1]{% + \par\addvspace\medskipamount + \noindent\hangindent\parindent + \hbox to\parindent{\errorbullet\hfil}\ignorespaces + #1\par\vspace{\smallskipamount} +}{% + \par\addvspace\medskipamount +} + +% The chapters are so short, perhaps we shouldn't call them by the +% name `Chapter'. We make \chaptername read an argument in order to +% remove a following \space or "{} " (both possibilities are present +% in book.cls). + +\renewcommand{\chaptername}[1]{} +\newcommand{\chapnum}[1]{\mdash #1\mdash } +\makeatletter +\def\@makechapterhead#1{% + \vspace{1.5\baselineskip}% + {\parindent \z@ \raggedright \reset@font + \ifnum \c@secnumdepth >\m@ne + \large\bfseries \chapnum{\thechapter}% + \par\nobreak + \vskip.5\baselineskip\relax + \fi + #1\par\nobreak + \vskip\baselineskip + }} +\makeatother + +% A command for ragged-right parbox in a tabular. +\newcommand{\rp}{\let\PBS\\\raggedright\let\\\PBS} + +% Non-indexed file name +\newcommand{\nfn}[1]{\texttt{#1}} + +% For the examples in the math spacing table. +%%\newcommand{\lspx}{\mbox{\rule{5pt}{.6pt}\rule{.6pt}{6pt}}} +%%\newcommand{\rspx}{\mbox{\rule[-1pt]{.6pt}{7pt}% +%% \rule[-1pt]{5pt}{.6pt}}} +\newcommand{\lspx}{\mathord{\Rightarrow\mkern-1mu}} +\newcommand{\rspx}{\mathord{\mkern-1mu\Leftarrow}} +\newcommand{\spx}[1]{$\lspx #1\rspx$} + +% For a list of characters representing document input. +\newcommand{\clist}[1]{% + \mbox{\ntt\spaceskip.2em plus.1em \xspaceskip\spaceskip#1}} + +% Fix weird \latex/ definition of rightmark. +\makeatletter +\def\rightmark{\expandafter\@rightmark\botmark{}{}} +% Also turn off section marks. +\let\sectionmark\@gobble +\renewcommand{\chaptermark}[1]{% + \uppercase{\markboth{\rhcn#1}{\rhcn#1}}} +\newcommand{\rhcn}{\thechapter. } +\makeatother + +% Include down to \section but not \subsection, in toc: +\setcounter{tocdepth}{1} + +% Subheadings for the bibliography +\newif\iffirstbibsubhead \firstbibsubheadtrue +\newcommand{\bibsubhead}[1]{% + \iffirstbibsubhead \firstbibsubheadfalse + \else \addvspace{\medskipamount} + \fi + \item[]\hspace*{-\leftmargin}\textbf{#1}\par + \vspace{\smallskipamount} +} + +\DeclareMathOperator{\ix}{ix} +\DeclareMathOperator{\nul}{nul} +\DeclareMathOperator{\End}{End} +\DeclareMathOperator{\xxx}{xxx} + +\usepackage{hyperref} +\hypersetup{pdfborder=0 0 0} +\makeatletter +\let\oldcs\cs +\def\cs#1{\texorpdfstring{\oldcs{#1}}{\@backslashchar\@backslashchar#1}} +\let\cn\cs +\makeatother +\begin{document} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\frontmatter + +\maketitle + +\pagestyle{headings} +\tableofcontents +\cleardoublepage % for better page number placement + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\mainmatter +\chapter{Introduction} + +\index{amsmath@\texttt{amsmath} package|(} + +The \nipkg{amsmath} package is a \LaTeX{} package that provides +miscellaneous enhancements for improving the information structure and +printed output of documents that contain mathematical formulas. Readers +unfamiliar with \LaTeX{} should refer to \cite{lamport}. If you have an +up-to-date version of \LaTeX{}, the \nipkg{amsmath} package is normally +provided along with it. Upgrading when a newer version of the +\nipkg{amsmath} package is released can be done via +\url{http://mirror.ctan.org/macros/latex/required/amsmath.zip}. + +This documentation describes the features of the \nipkg{amsmath} package +and discusses how they are intended to be used. It also covers some +ancillary packages: +\begin{ctab}{lll} +\pkg{amsbsy}& \pkg{amsopn}& \pkg{amsxtra}\\ +\pkg{amscd}& \pkg{amstext}\\ +\end{ctab} +These all have something to do with the contents of math formulas. For +information on extra math symbols and math fonts, see \cite{amsfonts} +and \url{https://www.ams.org/tex/amsfonts.html}. For documentation of the +\pkg{amsthm} package or AMS document classes (\cls{amsart}, +\cls{amsbook}, etc.\@) see \cite{amsthdoc} or \cite{amshandbk} and +\url{https://www.ams.org/tex/author-info.html}. + +If you are a long-time \latex/ user and have lots of mathematics in what +you write, then you may recognize solutions for some familiar problems +in this list of \nipkg{amsmath} features: +\begin{itemize} + +\item A convenient way to define new `operator name' commands analogous +to \cn{sin} and \cn{lim}, including proper side spacing and automatic +selection of the correct font style and size (even when used in +sub- or superscripts). + +\item Multiple substitutes for the \env{eqnarray} environment to make +various kinds of equation arrangements easier to write. + +\item Equation numbers automatically adjust up or down to avoid +overprinting on the equation contents (unlike \env{eqnarray}). + +\item Spacing around equals signs matches the normal spacing in the +\env{equation} environment (unlike \env{eqnarray}). + +\item A way to produce multiline subscripts as are often used with +summation or product symbols. + +\item An easy way to substitute a variant equation number for a given +equation instead of the automatically supplied number. + +\item An easy way to produce subordinate equation numbers of the form +(1.3a) (1.3b) (1.3c) for selected groups of equations. + +\end{itemize} + +The \nipkg{amsmath} package is distributed together with some small +auxiliary packages: +\begin{description} +\item[\nipkg{amsmath}] Primary package, provides various features for + displayed equations and other mathematical constructs. + +\item[\pkg{amstext}] Provides a \cn{text} command for + typesetting a fragment of text inside a display. + +\item[\pkg{amsopn}] Provides \cn{DeclareMathOperator} for defining new + `operator names' like \cn{sin} and \cn{lim}. + +\item[\pkg{amsbsy}] For backward compatibility this package continues +to exist but use of the newer \pkg{bm} package that comes with \LaTeX{} +is recommended instead. + +\item[\pkg{amscd}] Provides a \env{CD} environment for simple + commutative diagrams (no support for diagonal arrows). + +\item[\pkg{amsxtra}] Provides certain odds and ends such as + \cn{fracwithdelims} and \cn{accentedsymbol}, for compatibility with + documents created using version 1.1. + +\end{description} + +The \nipkg{amsmath} package incorporates \pkg{amstext}, \pkg{amsopn}, and +\pkg{amsbsy}. The features of \pkg{amscd} and \pkg{amsxtra}, however, +are available only by invoking those packages separately. + +The independent \pkg{mathtools} package \cite{mt} provides some +enhancements to \nipkg{amsmath}; \pkg{mathtools} loads \nipkg{amsmath} +automatically, so there is no need to separately load \nipkg{amsmath} +if \pkg{mathtools} is used. Some \pkg{mathtools} facilities +will be noted below as appropriate. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Options for the \nipkg{amsmath} package}\label{options} + +The \nipkg{amsmath} package has the following options: +\index{options!amsmath@\texttt{amsmath} package options|(} +\begin{description} + +\item[\opt{centertags}] (default) For an equation containing a +\env{split} environment, place equation +numbers\index{equationn@equation numbers!vertical placement} +vertically centered on the total height of the equation. + +\item[\opt{tbtags}] `Top-or-bottom tags': For an equation containing +a \env{split} environment, place equation +numbers\index{equationn@equation numbers!vertical placement} level with the last +(resp.\ first) line, if numbers are on the right (resp.\ left). + +\item[\opt{sumlimits}] (default) Place the subscripts and +superscripts\index{subscripts and superscripts!placement}\relax +\index{limits|see{subscripts and superscripts}} of summation symbols +above and below, in displayed equations. This option also affects other +symbols of the same type\mdash $\prod$, $\coprod$, $\bigotimes$, +$\bigoplus$, and so forth\mdash but excluding integrals (see below). + +\item[\opt{nosumlimits}] Always place the subscripts and superscripts of +summation-type symbols to the side, even in displayed equations. + +\item[\opt{intlimits}] Like \opt{sumlimits}, but for +integral\index{integrals!placement of limits} symbols. + +\item[\opt{nointlimits}] (default) Opposite of \opt{intlimits}. + +\item[\opt{namelimits}] (default) Like \opt{sumlimits}, but for certain +`operator names' such as $\det$, $\inf$, $\lim$, $\max$, $\min$, that +traditionally have subscripts% +\index{subscripts and superscripts!placement} placed underneath when +they occur in a displayed equation. + +\item[\opt{nonamelimits}] Opposite of \opt{namelimits}. + +\end{description} + +\goodbreak + +\begin{description} +\item[\opt{alignedleftspaceyes}] +\item[\opt{alignedleftspaceno}] +\item[\opt{alignedleftspaceyesifneg}] +\end{description} + +To use one of these package options, put the option name in the optional +argument of the \cn{usepackage} command\mdash e.g., +\verb"\usepackage[intlimits]{amsmath}". +For AMS document classes and any other classes that preload \nipkg{amsmath} +desired options must be specified with the \cn{documentclass}\mdash +e.g.,\\ +\verb+\documentclass[intlimits,tbtags,reqno]{amsart}+. + +The \nipkg{amsmath} package also recognizes the following options which +are normally selected (implicitly or explicitly) through the +\cn{documentclass} command, and thus need not be repeated in the option +list of the \cn{usepackage}|{amsmath}| statement. +\begin{description} + +\item[\opt{leqno}] Place equation numbers on the left.% +\index{equationn@equation numbers!left or right placement} + +\item[\opt{reqno}] Place equation numbers on the right. + +\item[\opt{fleqn}] Position equations at a fixed indent from the left +margin rather than centered in the text column.% +\index{displayed equations!centering} + +\end{description} + +Three options have been added to control the space to the left of +\env{aligned} and \env{gathered} environments. Prior to the 2017 release +a thin space was added to the left but not the right of these constructs. +This appears to have been an accidental feature of the implementation and +was typically corrected by prefixing the environments with \altcnbang. + +The new default behavior is aimed to ensure that the environments do +not have a thin space added in most cases, and that existing documents +using |\!\begin{aligned}| continue to work as before. + +\begin{description} +\item[\opt{alignedleftspaceyes}] Always add \cn{\,} to the left of \env{aligned} and \env{gathered}. +\item[\opt{alignedleftspaceno}] Never add \cn{\,} to the left of \env{aligned} and \env{gathered}. +\item[\opt{alignedleftspaceyesifneg}] Only add \cn{\,} if the environment is prefixed by negative space. (New default behavior.) +\end{description} + +\index{options!amsmath@\texttt{amsmath} package options|)} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Displayed equations} + +\section{Introduction} +The \nipkg{amsmath} package provides a number of additional displayed +equation structures\index{displayed equations}% +\index{equations|see{displayed equations}} beyond the ones +provided in basic \latex/. The augmented set includes: +\begin{verbatim} + equation equation* align align* + gather gather* alignat alignat* + multline multline* flalign flalign* + split +\end{verbatim} +(Although the standard \env{eqnarray} environment remains available, +it is better to use \env{align} or \env{equation}+\env{split} instead. +Within \env{eqnarray}, spacing\index{horizontal spacing} around signs +of relation is not the preferred mathematical spacing, and is +inconsistent with that spacing as it appears in other environments. +Long lines in this environment may result in misplaced or overprinted +equation numbers. This environment also does not support the use of +\cn{qed} or \cn{qedhere} as provided by theorem packages.) + +Except for \env{split}, each environment has both starred and unstarred +forms, where the unstarred forms have automatic numbering using +\latex/'s \env{equation} counter. You can suppress the number on any +particular line by putting \cn{notag} before the end of that line; +\cn{notag} should not be used outside a display environment as it will +mess up the numbering. You can also +override\index{equationn@equation numbers!overriding} a number with a tag +of your own using \cn{tag}|{|\<label>|}|, where \<label> means arbitrary +text such as |$*$| or |ii| used to \qq{number} the equation. +A tag can reference a different tagged display by use of +|\tag{\ref{|\<label>|}|\<modifier>|}| where \<modifier> is optional. +If you are using \pkg{hyperref}, use \cn{ref*}; +use of the starred form of \cn{ref} prevents a reference to a modified +tag containing a nested link from linking to the original display. + +There is also a +\cn{tag*} command that causes the text you supply to be typeset +literally, without adding parentheses around it. \cn{tag} and \cn{tag*} +can also be used within the unnumbered versions of all the \nipkg{amsmath} +alignment structures. Some examples of the use of \cn{tag} may be found +in the sample files \fn{testmath.tex} and \fn{subeqn.tex} provided with +the \nipkg{amsmath} package. + +The \env{split} environment is a special subordinate form that is used +only \emph{inside} one of the others. It cannot be used inside +\env{multline}, however. \env{split} supports only one alignment (|&|) +column; if more are needed, \env{aligned} or \env{alignedat} should be +used. The width of a \env{split} structure is the full line width. + +In the structures that do alignment (\env{split}, \env{align} and +variants), relation symbols have an |&| before them but not +after\mdash unlike \env{eqnarray}. Putting the |&| after the +relation symbol will interfere with the normal spacing; it has to go +before. + +In all multiline environments, lines are divided by \cn{\\}. The \cn{\\} +should \emph{not} be used to end the last line. Using it there will +result in unwanted extra vertical space following the display. + +In \emph{all} math environments (inline or display), blank lines +(equivalent to \cn{par}) are not permitted, and will result in an error. + +\begin{table}[p] +\caption[]{Comparison of displayed equation environments (vertical lines +indicating nominal margins)}\label{displays} +\renewcommand{\theequation}{\arabic{equation}} +\begin{eqxample} +\begin{verbatim} +\begin{equation*} +a=b +\end{equation*} +\end{verbatim} +\producing +\begin{equation*} +a=b +\end{equation*} +\end{eqxample} + +\begin{eqxample} +\begin{verbatim} +\begin{equation} +a=b +\end{equation} +\end{verbatim} +\producing +\begin{equation} +a=b +\end{equation} +\end{eqxample} + +\begin{eqxample} +\begin{verbatim} +\begin{equation}\label{xx} +\begin{split} +a& =b+c-d\\ + & \quad +e-f\\ + & =g+h\\ + & =i +\end{split} +\end{equation} +\end{verbatim} +\producing +\begin{equation}\label{xx} +\begin{split} +a& =b+c-d\\ + & \quad +e-f\\ + & =g+h\\ + & =i +\end{split} +\end{equation} +\end{eqxample} + +\begin{eqxample} +\begin{verbatim} +\begin{multline} +a+b+c+d+e+f\\ ++i+j+k+l+m+n +\end{multline} +\end{verbatim} +\producing +\begin{multline} +a+b+c+d+e+f\\ ++i+j+k+l+m+n +\end{multline} +\end{eqxample} + +\begin{eqxample} +\begin{verbatim} +\begin{gather} +a_1=b_1+c_1\\ +a_2=b_2+c_2-d_2+e_2 +\end{gather} +\end{verbatim} +\producing +\begin{gather} +a_1=b_1+c_1\\ +a_2=b_2+c_2-d_2+e_2 +\end{gather} +\end{eqxample} + +\begin{eqxample} +\begin{verbatim} +\begin{align} +a_1& =b_1+c_1\\ +a_2& =b_2+c_2-d_2+e_2 +\end{align} +\end{verbatim} +\producing +\begin{align} +a_1& =b_1+c_1\\ +a_2& =b_2+c_2-d_2+e_2 +\end{align} +\end{eqxample} + +\begin{eqxample} +\begin{verbatim} +\begin{align} +a_{11}& =b_{11}& + a_{12}& =b_{12}\\ +a_{21}& =b_{21}& + a_{22}& =b_{22}+c_{22} +\end{align} +\end{verbatim} +\producing +\begin{align} +a_{11}& =b_{11}& + a_{12}& =b_{12}\\ +a_{21}& =b_{21}& + a_{22}& =b_{22}+c_{22} +\end{align} +\end{eqxample} + +\begin{eqxample} +\begin{verbatim} +\begin{flalign*} +a_{11} + b_{11}& = c_{11}& + a_{12}& =b_{12}\\ +b_{21}& = c_{21}& + a_{22}& =b_{22}+c_{22} +\end{flalign*} +\end{verbatim} +\producing +\begin{flalign*} +a_{11} + b_{11}& = c_{11}& + a_{12}& =b_{12}\\ +b_{21}& = c_{21}& + a_{22}& =b_{22}+c_{22} +\end{flalign*} +\end{eqxample} +\end{table} + +%% ------------------------------------------------------------------ %% +\enlargethispage{1\baselineskip} + +\section{Single equations} + +The \env{equation} environment is for a single equation with an +automatically generated number. The \env{equation*} environment is the +same except for omitting the number.% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\footnote{Basic \latex/ doesn't provide an \env{equation*} environment, +but rather a functionally equivalent environment named +\env{displaymath}.} +The wrapper \verb+\[ ... \]+ is equivalent to \env{equation*}.% +\index{[@\verb+\[ ... \]+} + +%% ------------------------------------------------------------------ %% + +\section{Split equations without alignment} + +The \env{multline} environment is a variation of the \env{equation} +environment used for equations that don't fit on a single line. The +first line of a \env{multline} will be at the left margin and the last +line at the right margin, except for an indention on both sides in the +amount of \cn{multlinegap}. Any additional lines in between will be +centered independently within the display width (unless the \opt{fleqn} +option is in effect).% +\index{options!behavior of particular options} + +Like \env{equation}, \env{multline} has only a single equation number +(thus, none of the individual lines should be marked with \cn{notag}). +The equation number is placed on the last line (\opt{reqno} option) or +first line (\opt{leqno} option); vertical centering as for \env{split} +is not supported by \env{multline}.% +\index{options!behavior of particular options} + +It's possible to force one of the middle lines to the left or right with +commands \cn{shoveleft}, \cn{shoveright}. These commands take the entire +line as an argument, up to but not including the final \cn{\\}; for +example +\begin{multline} +\framebox[.65\columnwidth]{A}\\ +\framebox[.5\columnwidth]{B}\\ +\shoveright{\framebox[.55\columnwidth]{C}}\\ +\framebox[.65\columnwidth]{D} +\end{multline} +\begin{verbatim} +\begin{multline} +\framebox[.65\columnwidth]{A}\\ +\framebox[.5\columnwidth]{B}\\ +\shoveright{\framebox[.55\columnwidth]{C}}\\ +\framebox[.65\columnwidth]{D} +\end{multline} +\end{verbatim} + +The value of \cn{multlinegap} can be changed with the usual \latex/ +commands \cn{setlength} or \cn{addtolength}. + +%% ------------------------------------------------------------------ %% + +\section{Split equations with alignment} + +Like \env{multline}, the \env{split} environment is for \emph{single} +equations that are too long to fit on one line and hence must be split +into multiple lines. Unlike \env{multline}, however, the \env{split} +environment provides for alignment among the split lines, using |&| to +mark alignment points. Unlike the other \nipkg{amsmath} equation +structures, the \env{split} environment provides no numbering, because +it is intended to be used \emph{only inside some other displayed + equation structure}, usually an \env{equation}, \env{align}, or +\env{gather} environment, which provides the numbering. For example: +\begin{equation}\label{e:barwq}\begin{split} +H_c&=\frac{1}{2n} \sum^n_{l=0}(-1)^{l}(n-{l})^{p-2} + \sum_{l _1+\dots+ l _p=l}\prod^p_{i=1} \binom{n_i}{l _i}\\ +&\quad\cdot[(n-l )-(n_i-l _i)]^{n_i-l _i}\cdot + \Bigl[(n-l )^2-\sum^p_{j=1}(n_i-l _i)^2\Bigr]. + \kern-2em % adjust equation body to the right [mjd,13-Nov-1994] +\end{split}\end{equation} + +\begin{verbatim} +\begin{equation}\label{e:barwq}\begin{split} +H_c&=\frac{1}{2n} \sum^n_{l=0}(-1)^{l}(n-{l})^{p-2} + \sum_{l _1+\dots+ l _p=l}\prod^p_{i=1} \binom{n_i}{l _i}\\ +&\quad\cdot[(n-l )-(n_i-l _i)]^{n_i-l _i}\cdot + \Bigl[(n-l )^2-\sum^p_{j=1}(n_i-l _i)^2\Bigr]. +\end{split}\end{equation} +\end{verbatim} + +The \env{split} structure should constitute the entire body of the +enclosing structure, apart from commands like \cn{label} that produce no +visible material. + +%% ------------------------------------------------------------------ %% + +\section{Equation groups without alignment} + +The \env{gather} environment is used for a group of consecutive +equations when there is no alignment desired among them; each one is +centered separately within the text width (see Table~\ref{displays}). +Equations inside \env{gather} are separated by a \cn{\\} command. +Any equation in a \env{gather} may consist of a \verb'\begin{split}' + \dots\ \verb'\end{split}' structure\mdash for example: +\begin{verbatim} +\begin{gather} + first equation\\ + \begin{split} + second & equation\\ + & on two lines + \end{split} + \\ + third equation +\end{gather} +\end{verbatim} + +%% ------------------------------------------------------------------ %% + +\section{Equation groups with mutual alignment} + +The \env{align} environment is used for two or more equations when +vertical alignment is desired; usually binary relations such as equal +signs are aligned (see Table~\ref{displays}). + +To have several equation columns side-by-side, use extra ampersands +to separate the columns: +\begin{align} +x&=y & X&=Y & a&=b+c\\ +x'&=y' & X'&=Y' & a'&=b\\ +x+x'&=y+y' & X+X'&=Y+Y' & a'b&=c'b +\end{align} +% +\begin{verbatim} +\begin{align} +x&=y & X&=Y & a&=b+c\\ +x'&=y' & X'&=Y' & a'&=b\\ +x+x'&=y+y' & X+X'&=Y+Y' & a'b&=c'b +\end{align} +\end{verbatim} +Line-by-line annotations on an equation can be done by judicious +application of \cn{text} inside an \env{align} environment: +\begin{align} +x& = y_1-y_2+y_3-y_5+y_8-\dots + && \text{by \eqref{eq:C}}\\ + & = y'\circ y^* && \text{by \eqref{eq:D}}\\ + & = y(0) y' && \text {by Axiom 1.} +\end{align} +% +\begin{verbatim} +\begin{align} +x& = y_1-y_2+y_3-y_5+y_8-\dots + && \text{by \eqref{eq:C}}\\ + & = y'\circ y^* && \text{by \eqref{eq:D}}\\ + & = y(0) y' && \text {by Axiom 1.} +\end{align} +\end{verbatim} +A variant environment \env{alignat} allows the horizontal space between +equations to be explicitly specified. This environment takes one argument, +the number of \qq{equation columns} (the number of pairs of right-left +aligned columns; the argument is the number of pairs): count the maximum +number of \verb'&'s in any row, add~1 and divide by~2. +\begin{alignat}{2} +x& = y_1-y_2+y_3-y_5+y_8-\dots + &\quad& \text{by \eqref{eq:C}}\\ + & = y'\circ y^* && \text{by \eqref{eq:D}}\\ + & = y(0) y' && \text {by Axiom 1.} +\end{alignat} +% +\begin{verbatim} +\begin{alignat}{2} +x& = y_1-y_2+y_3-y_5+y_8-\dots + &\quad& \text{by \eqref{eq:C}}\\ + & = y'\circ y^* && \text{by \eqref{eq:D}}\\ + & = y(0) y' && \text {by Axiom 1.} +\end{alignat} +\end{verbatim} +The environment \env{flalign} (``full length alignment'') stretches the +space between the equation columns to the maximum possible width, leaving +only enough space at the margin for the equation number, if present. +\begin{flalign} +x&=y & X&=Y\\ +x'&=y' & X'&=Y'\\ +x+x'&=y+y' & X+X'&=Y+Y' +\end{flalign} +% +\begin{verbatim} +\begin{flalign} +x&=y & X&=Y\\ +x'&=y' & X'&=Y'\\ +x+x'&=y+y' & X+X'&=Y+Y' +\end{flalign} +\end{verbatim} +% +\begin{flalign*} +x&=y & X&=Y\\ +x'&=y' & X'&=Y'\\ +x+x'&=y+y' & X+X'&=Y+Y' +\end{flalign*} +% +\begin{verbatim} +\begin{flalign*} +x&=y & X&=Y\\ +x'&=y' & X'&=Y'\\ +x+x'&=y+y' & X+X'&=Y+Y' +\end{flalign*} +\end{verbatim} + +%% ------------------------------------------------------------------ %% + +\section{Alignment building blocks} + +Like \env{equation}, the multi-equation environments \env{gather}, +\env{align}, and \env{alignat} are designed to produce a structure +whose width is the full line width. This means, for example, that one +cannot readily add parentheses around the entire structure. But +variants\index{ed env@\texttt{-ed} environments|(} +\env{gathered}, \env{aligned}, and \env{alignedat} are provided whose +total width is the actual width of the contents; thus they can be used +as a component in a containing expression. E.g., +\begin{equation*} +\left.\begin{aligned} + B'&=-\partial\times E,\\ + E'&=\partial\times B - 4\pi j, +\end{aligned} +\right\} +\qquad \text{Maxwell's equations} +\end{equation*} +\begin{verbatim} +\begin{equation*} +\left.\begin{aligned} + B'&=-\partial\times E,\\ + E'&=\partial\times B - 4\pi j, +\end{aligned} +\right\} +\qquad \text{Maxwell's equations} +\end{equation*} +\end{verbatim} +Like the \env{array} environment, these \texttt{-ed} variants also take +an optional\index{options!positioning of \texttt{-ed} environments} +|[t]|\index{t option@\texttt{t} (top) option}, +|[b]|\index{b option@\texttt{b} (bottom) option} or the default +|[c]|\index{c option@\texttt{c} (center) option} +argument to specify vertical +positioning. For maximum interoperability, do not insert a +space\index{options!space before \texttt{[}} +or line break\index{line break} before the option. See +also the note on page~\pageref{breaknote} regarding page breaking +within the \texttt{-ed} environments. + +\qq{Cases} constructions like the following are common in +mathematics: +\begin{equation}\label{eq:C} +P_{r-j}= + \begin{cases} + 0& \text{if $r-j$ is odd},\\ + r!\,(-1)^{(r-j)/2}& \text{if $r-j$ is even}. + \end{cases} +\end{equation} +and in the \nipkg{amsmath} package there is a \env{cases} environment to +make them easy to write: +\begin{verbatim} +P_{r-j}=\begin{cases} + 0& \text{if $r-j$ is odd},\\ + r!\,(-1)^{(r-j)/2}& \text{if $r-j$ is even}. + \end{cases} +\end{verbatim} +Notice the use of \cn{text} (cf.~\secref{text}) and the nested math +formulas. \env{cases} is set in \cn{textstyle}. If \cn{displaystyle} +is wanted, it must be requested explicitly; \pkg{mathtools} provides +a \env{dcases} environment for this purpose. + +The |-ed|\index{ed env@\texttt{-ed} environments|)} and \env{cases} +environments must appear within an enclosing math environment, which can +be either in text, between |$...$|, or in any of the display environments. + +%% ------------------------------------------------------------------ %% + +\section{Adjusting tag placement} + +Placing equation numbers can be a rather complex problem in multiline +displays. The environments of the \nipkg{amsmath} package try hard to +avoid overprinting an equation number on the equation contents, if +necessary moving the number down or up to a separate line. Difficulties +in accurately calculating the profile of an equation can occasionally +result in number movement that doesn't look right. +A \cn{raisetag} command is provided to adjust the vertical position of the +current equation number, if it has been shifted away from its normal +position. To move a particular number up by six points, write +|\raisetag{6pt}|. (At the end of a display, this also shifts up the +text following the display.) +This kind of adjustment is fine tuning like line +breaks and page breaks, and should therefore be left undone until your +document is nearly finalized, or you may end up redoing the fine tuning +several times to keep up with changing document contents. + +%% ------------------------------------------------------------------ %% + +\section{Vertical spacing and page breaks in multiline displays} + +You can use the \cn{\\}|[|\<dimension>|]|% +\index{options!extra vertical space after \cn{\\}} +command to get extra vertical +space between lines in all the \nipkg{amsmath} displayed equation +environments, as is usual in \latex/. Do not type a space between the% +\index{options!space before \texttt{[}} +\cn{\\} and the following |[|; \emph{only} for display environments +defined by \nipkg{amsmath} the space is interpreted to mean that the +bracketed material is part of the document content. + +When the \nipkg{amsmath} package is +in use \ii{page breaks} between equation lines are normally disallowed; +the philosophy is that page breaks in such material should receive +individual attention from the author. To get an individual page break +inside a particular displayed equation, a \cn{displaybreak} command is +provided. \cn{displaybreak} is best placed immediately before the +\cn{\\} where it is to take effect. Like \latex/'s \cn{pagebreak}, +\cn{displaybreak} takes an optional argument% +\index{options!behavior of particular options} between 0 and 4 denoting +the desirability of the pagebreak. |\displaybreak[0]| means \qq{it is + permissible to break here} without encouraging a break; +\cn{displaybreak} with no optional argument is the same as +|\displaybreak[4]| and forces a break. + +If you prefer a strategy of letting page breaks fall where they may, +even in the middle of a multiline equation, then you might put +\cn{allowdisplaybreaks}\texttt{[1]} in the preamble of your document. An +optional argument\index{options!behavior of particular options} +1\ndash 4 can be used for finer control: |[1]| means +allow page breaks, but avoid them as much as possible; values of 2,3,4 +mean increasing permissiveness. When display breaks are enabled with +\cn{allowdisplaybreaks}, the \cn{\\*} command can be used to prohibit a +pagebreak after a given line, as usual. + +\begin{bfseries} +Note:\label{breaknote} Certain equation environments wrap their contents +in an unbreakable box, with the consequence that neither \cn{displaybreak} +nor \cn{allowdisplaybreaks} will have any effect on them. These include +\env{split}, \env{aligned}, \env{gathered}, and \env{alignedat}. +\end{bfseries} + +%% ------------------------------------------------------------------ %% + +\section{Interrupting a display} + +The command \cn{intertext} is used for a short interjection of one or +two lines of text\index{text fragments inside math} in the middle of a +multiple-line display structure (see also the \cn{text} command in +\secref{text}). Its salient feature is preservation of the alignment, +which would not happen if you simply ended the display and then started +it up again afterwards. \cn{intertext} may only appear right after a +\cn{\\} or \cn{\\*} command. Notice the position of the word \qq{and} in +this example. +\begin{align} + A_1&=N_0(\lambda;\Omega')-\phi(\lambda;\Omega'),\\ + A_2&=\phi(\lambda;\Omega')-\phi(\lambda;\Omega),\\ +\intertext{and} + A_3&=\mathcal{N}(\lambda;\omega). +\end{align} +\begin{verbatim} +\begin{align} + A_1&=N_0(\lambda;\Omega')-\phi(\lambda;\Omega'),\\ + A_2&=\phi(\lambda;\Omega')-\phi(\lambda;\Omega),\\ +\intertext{and} + A_3&=\mathcal{N}(\lambda;\omega). +\end{align} +\end{verbatim} + +The \pkg{mathtools} package provides a command \cn{shortintertext} that +is intended for use when the interjected text is only a few words; it uses +less vertical space than \cn{intertext}. This +is most effective when equation numbers are on the right.% +\index{equationn@equation numbers!left or right placement} + +%% ------------------------------------------------------------------ %% + +\section{Equation numbering} + +\subsection{Numbering hierarchy} +In \latex/ if you wanted to have equations numbered within +sections\mdash that is, have +equation numbers (1.1), (1.2), \dots, (2.1), (2.2), +\dots, in sections 1, 2, and so forth\mdash you could redefine +\cn{theequation} as suggested in the \latex/ manual \cite[\S6.3, \S +C.8.4]{lamport}: +\begin{verbatim} +\renewcommand{\theequation}{\thesection.\arabic{equation}} +\end{verbatim} + +This works pretty well, except that the equation counter won't be reset +to zero at the beginning of a new section or chapter, unless you do it +yourself using \cn{setcounter}. To make this a little more convenient, +the \nipkg{amsmath} package provides a +command\index{equationn@equation numbers!hierarchy} \cn{numberwithin}. +To have equation numbering tied to section numbering, with automatic +reset of the equation counter, write +\begin{verbatim} +\numberwithin{equation}{section} +\end{verbatim} +As its name implies, the \cn{numberwithin} command can be applied to +any counter, not just the \texttt{equation} counter. + +\subsection{Cross references to equation numbers} + +To make cross-references to equations easier, an \cn{eqref} +command\index{equationn@equation numbers!cross-references} is provided. This +automatically supplies the parentheses around the equation number. I.e., +if \verb'\ref{abc}' produces 3.2 then \verb'\eqref{abc}' produces +(3.2). The parentheses around an \cn{eqref} equation number will be +set in upright type regardless of type style of the context. + +\subsection{Subordinate numbering sequences} + +The \nipkg{amsmath} package provides also a wrapper environment, +\env{subequations}\index{equationn@equation numbers!subordinate numbering}, to make it +easy to number equations in a particular \cn{align} or similar group with +a subordinate numbering scheme. For example +\begin{verbatim} +\begin{subequations} +... +\end{subequations} +\end{verbatim} +causes all numbered equations within that part of the document to be +numbered (4.9a) (4.9b) (4.9c) \dots, if the preceding numbered +equation was (4.8). A \cn{label} command immediately after +\verb/\begin{subequations}/ will produce a \cn{ref} of the parent +number 4.9, not 4.9a. The counters used by the subequations +environment are \verb/parentequation/ and \verb/equation/ and +\cn{addtocounter}, \cn{setcounter}, \cn{value}, etc., can be applied +as usual to those counter names. To get anything other than lowercase +letters for the subordinate numbers, use standard \latex/ methods for +changing numbering style \cite[\S6.3, \S C.8.4]{lamport}. For example, +redefining \cn{theequation} as follows will produce roman numerals. +\begin{verbatim} +\begin{subequations} +\renewcommand{\theequation}{\theparentequation \roman{equation}} +... +\end{verbatim} + +\subsection{Numbering style} + +The default equation number is set in \cn{normalfont}. This means that +in bold section headings, bold is suppressed; a workaround for this is +to use \verb+(\ref{+\ldots\verb+})+ rather than \verb+\eqref{+\ldots\verb+}+. + +If smaller type is specified for a numbered display, the size of the +equation number will also be small. The default size can be ensured +throughout a document by applying this patch in the preamble: +\begin{verbatim} +\makeatletter +\renewcommand{\maketag@@@}[1]{\hbox{\m@th\normalsize\normalfont#1}}% +\makeatother +\end{verbatim} +(This modification may be included in a future version of +\nipkg{amsmath}.) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Miscellaneous mathematical features} + +\section{Matrices}\label{ss:matrix} + +The \nipkg{amsmath} package provides some environments for +matrices\index{matrices} beyond the basic \env{array} environment of +\latex/. The \env{pmatrix}, \env{bmatrix}, \env{Bmatrix}, \env{vmatrix} +and \env{Vmatrix} have (respectively) $(\,)$, $[\,]$, $\lbrace\,\rbrace$, +$\lvert\,\rvert$, and $\lVert\,\rVert$ delimiters\index{delimiters} +built in. For naming consistency there is a +\env{matrix} environment sans delimiters. This is not entirely redundant +with the \env{array} environment; the matrix environments all use more +economical horizontal spacing than the rather prodigal spacing of the +\env{array} environment. Also, unlike the \env{array} environment, you +don't have to give column specifications for any of the matrix +environments; by default you can have up to 10 centered columns.% +\footnote{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +More precisely: The maximum number of columns in a matrix is determined +by the counter |MaxMatrixCols| (normal value = 10), which you can change +if necessary using \latex/'s \cn{setcounter} or \cn{addtocounter} +commands.% +}\space%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +(If you need left or right alignment in a column or other special +formats you may use \env{array}, or the \pkg{mathtools} +package which provides \verb+*+ variants% +\index{matrix@\indexenvironmentfont{matrix} environment!\verb+*+ variants} +of these environments with +an optional argument to specify left or right alignment.) + +To produce a small matrix suitable for use in text, there is a +\env{smallmatrix} environment (e.g., +\begin{math} +\bigl( \begin{smallmatrix} + a&b\\ c&d +\end{smallmatrix} \bigr) +\end{math}) +that comes closer to fitting within a single text line than a normal +matrix. Delimiters\index{delimiters} must be provided. (The +\pkg{mathtools} package provides |p|,|b|,|B|,|v|,|V| versions of +\env{smallmatrix},% +\index{smallmatrix@\indexenvironmentfont{smallmatrix} environment!variant delimiters} +as well as |*| variants% +\index{smallmatrix@\indexenvironmentfont{smallmatrix} environment!\verb+*+ variants} +as described above.) +The above example was produced by +\begin{verbatim} +\bigl( \begin{smallmatrix} + a&b\\ c&d +\end{smallmatrix} \bigr) +\end{verbatim} + +\cn{hdotsfor}|{|\<number>|}| produces a row of dots in a +matrix\index{matrices!ellipsis dots}\index{ellipsis dots!in +matrices}\index{dots|see{ellipsis dots}} spanning the given number of +columns. For example, +\begin{center} +\begin{minipage}{.3\columnwidth} +\noindent$\begin{matrix} a&b&c&d\\ +e&\hdotsfor{3} \end{matrix}$ +\end{minipage}% +\qquad +\begin{minipage}{.45\columnwidth} +\begin{verbatim} +\begin{matrix} a&b&c&d\\ +e&\hdotsfor{3} \end{matrix} +\end{verbatim} +\end{minipage}% +\end{center} + +The spacing of the dots can be varied through use of a square-bracket +option,\index{options!behavior of particular options} +for example, |\hdotsfor[1.5]{3}|. The number in square brackets +will be used as a multiplier (i.e., the normal value is 1.0). +\begin{equation}\label{eq:D} +\begin{pmatrix} D_1t&-a_{12}t_2&\dots&-a_{1n}t_n\\ +-a_{21}t_1&D_2t&\dots&-a_{2n}t_n\\ +\hdotsfor[2]{4}\\ +-a_{n1}t_1&-a_{n2}t_2&\dots&D_nt\end{pmatrix}, +\end{equation} +\begin{verbatim} +\begin{pmatrix} D_1t&-a_{12}t_2&\dots&-a_{1n}t_n\\ +-a_{21}t_1&D_2t&\dots&-a_{2n}t_n\\ +\hdotsfor[2]{4}\\ +-a_{n1}t_1&-a_{n2}t_2&\dots&D_nt\end{pmatrix} +\end{verbatim} + +%% ------------------------------------------------------------------ %% + +\section{Math spacing commands} + +The \nipkg{amsmath} package slightly extends the set of math +spacing\index{horizontal spacing} commands, as shown below. +Both the spelled-out and abbreviated forms of these commands are robust, +and they can also be used outside of math. +\begin{ctab}{lll|lll} +Abbrev.& Spelled out& Example & Abbrev.& Spelled out& Example\\ +\hline +\vstrut{2.5ex} +& no space& \spx{}& & no space & \spx{}\\ +\cn{\,}& \cn{thinspace}& \spx{\,}& + \altcnbang& \cn{negthinspace}& \spx{\!}\\ +\cn{\:}& \cn{medspace}& \spx{\:}& + & \cn{negmedspace}& \spx{\negmedspace}\\ +\cn{\;}& \cn{thickspace}& \spx{\;}& + & \cn{negthickspace}& \spx{\negthickspace}\\ +& \cn{quad}& \spx{\quad}\\ +& \cn{qquad}& \spx{\qquad} +\end{ctab} +For the greatest possible control over math spacing, use \cn{mspace} +and `math units'. One math unit, or |mu|, is equal to 1/18 em. Thus to +get a negative \cn{quad} you could write |\mspace{-18.0mu}|. + +%% ------------------------------------------------------------------ %% + +\section{Dots} + +For preferred placement of ellipsis dots (raised or on-line) in various +contexts there is no general consensus. It may therefore be considered a +matter of taste. By using the semantically oriented commands +\begin{itemize} +\item \cn{dotsc} for \qq{dots with commas} +\item \cn{dotsb} for \qq{dots with binary operators/relations} +\item \cn{dotsm} for \qq{multiplication dots} +\item \cn{dotsi} for \qq{dots with integrals} +\item \cn{dotso} for \qq{other dots} (none of the above) +\end{itemize} +instead of \cn{ldots} and \cn{cdots}, you make it possible for your +document to be adapted to different conventions on the fly, in case (for +example) you have to submit it to a publisher who insists on following +house tradition in this respect. The default treatment for the various +kinds follows American Mathematical Society conventions: +\begin{center} +\begin{tabular}{@{}l@{}l@{}} +\begin{minipage}[t]{.54\textwidth} +\begin{verbatim} +Then we have the series $A_1, A_2, +\dotsc$, the regional sum $A_1 ++A_2 +\dotsb $, the orthogonal +product $A_1 A_2 \dotsm $, and +the infinite integral +\[\int_{A_1}\int_{A_2}\dotsi\]. +\end{verbatim} +\end{minipage} +& +\begin{minipage}[t]{.45\textwidth} +\noindent +Then we have the series $A_1,A_2,\dotsc$, +the regional sum $A_1+A_2+\dotsb$, +the orthogonal product $A_1A_2\dotsm$, +and the infinite integral +\[\int_{A_1}\int_{A_2}\dotsi.\] +\end{minipage} +\end{tabular} +\end{center} +For most situations, the undifferentiated \cn{dots} can be used, and +\nipkg{amsmath} will output the most suitable form based on the +immediate context; if an inappropriate form results, it can be corrected +after examining the output. + +%% ------------------------------------------------------------------ %% + +\section{Nonbreaking dashes} + +A command \cn{nobreakdash} is provided to suppress the possibility of a +line break\index{line break|(} after the following hyphen or dash. For +example, if you write `pages 1\ndash 9' as |pages 1\nobreakdash--9| +then a line break will never occur between the dash and the 9. You can +also use \cn{nobreakdash} to prevent undesirable hyphenations in +combinations like |$p$-adic|. For frequent use, it's advisable to make +abbreviations, e.g., +\begin{verbatim} +\newcommand{\p}{$p$\nobreakdash}% for "\p-adic" +\newcommand{\Ndash}{\nobreakdash--}% for "pages 1\Ndash 9" +% For "\n dimensional" ("n-dimensional"): +\newcommand{\n}[1]{$n$\nobreakdash-\hspace{0pt}} +\end{verbatim} +The last example shows how to prohibit a line break\index{line break|)} +after the hyphen but allow normal hyphenation in the following +word. (It suffices to add a zero-width space after the hyphen.) + +%% ------------------------------------------------------------------ %% + +\section{Accents in math} + +In ordinary \LaTeX{} the placement of the second accent in doubled math +accents is often poor. With the \nipkg{amsmath} package you +will get improved placement of the second accent: +$\hat{\hat{A}}$ (\cn{hat}|{\hat{A}}|). + +The commands \cn{dddot} and \cn{ddddot} are available to produce triple +and quadruple dot accents in addition to the \cn{dot} and \cn{ddot} +accents already available in \latex/. + +To get a superscripted hat or tilde character, load the \pkg{amsxtra} +package and use \cn{sphat} or \cn{sptilde}. Usage is \verb'A\sphat' +(note the absence of the \verb'^' character). + + +To place an arbitrary symbol in math accent position, or to get under +accents, see the \pkg{accents} package by Javier Bezos. (\nipkg{amsmath} +must be loaded before \pkg{accents}.) + +%% ------------------------------------------------------------------ %% + +\section{Roots} + +In ordinary \latex/ the placement of root indices is sometimes not so +good: $\sqrt[\beta]{k}$ (|\sqrt||[\beta]{k}|). In the +\nipkg{amsmath} package \cn{leftroot} and \cn{uproot} allow you to adjust +the position of the root:% +\index{options!adjust positioning} +\begin{verbatim} + \sqrt[\leftroot{-2}\uproot{2}\beta]{k} +\end{verbatim} +will move the beta up and to the right: +$\sqrt[\leftroot{-2}\uproot{2}\beta]{k}$. The negative argument used +with \cn{leftroot} moves the $\beta$ to the right. The units are a small +amount that is a useful size for such adjustments. + +%% ------------------------------------------------------------------ %% + +\section{Boxed formulas} + +The command \cn{boxed} puts a box around its +argument, like \cn{fbox} except that the contents are in math mode: +\begin{equation} +\boxed{\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))} +\end{equation} +\begin{verbatim} + \boxed{\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))} +\end{verbatim} + +%% ------------------------------------------------------------------ %% + +\section{Over and under arrows} + +Basic \latex/ provides \cn{overrightarrow} and \cn{overleftarrow} +commands. Some additional over and under arrow commands are provided +by the \nipkg{amsmath} package to extend the set: + +\begin{tabbing} +\qquad\=\ncn{overleftrightarrow}\qquad\=\kill +\> \cn{overleftarrow} \> \cn{underleftarrow} \+\\ + \cn{overrightarrow} \> \cn{underrightarrow} \\ + \cn{overleftrightarrow}\> \cn{underleftrightarrow} +\end{tabbing} + +%% ------------------------------------------------------------------ %% + +\section{Extensible arrows} + +\cn{xleftarrow} and \cn{xrightarrow} produce +arrows\index{arrows!extensible} that extend automatically to accommodate +unusually wide subscripts or superscripts. These commands take one +optional argument\index{options!behavior of particular options} +(the subscript) and one mandatory argument (the +superscript, possibly empty): +\begin{equation} +A\xleftarrow{n+\mu-1}B \xrightarrow[T]{n\pm i-1}C +\end{equation} +\begin{verbatim} + \xleftarrow{n+\mu-1}\quad \xrightarrow[T]{n\pm i-1} +\end{verbatim} + +%% ------------------------------------------------------------------ %% + +\section{Affixing symbols to other symbols} + +\latex/ provides \cn{stackrel} for placing a +superscript\index{subscripts and superscripts} above a binary relation. +In the \nipkg{amsmath} package there are somewhat more general commands, +\cn{overset} and \cn{underset}, that can be used to place one symbol +above or below another symbol, whether it's a relation or something +else. The input |\overset{*}{X}| will place a superscript-size $*$ above +the $X$: $\overset{*}{X}$; \cn{underset} is the analog for adding a +symbol underneath. + +See also the description of \cn{sideset} in \secref{sideset}. + +%% ------------------------------------------------------------------ %% + +\section{Fractions and related constructions} + +\subsection{The \cn{frac}, \cn{dfrac}, and \cn{tfrac} commands} + +The \cn{frac} command, which is in the basic command set of +\latex/,\index{fractions|(} takes two arguments\mdash numerator and +denominator\mdash and typesets them in normal fraction form. The +\nipkg{amsmath} package provides also \cn{dfrac} and \cn{tfrac} as +convenient abbreviations for |{\displaystyle\frac| |...| |}| +and\indexcs{textstyle}\relax +\indexcs{displaystyle} |{\textstyle\frac| |...| |}|. +\begin{equation} +\frac{1}{k}\log_2 c(f)\quad\tfrac{1}{k}\log_2 c(f)\quad +\sqrt{\frac{1}{k}\log_2 c(f)}\quad\sqrt{\dfrac{1}{k}\log_2 c(f)} +\end{equation} +\begin{verbatim} +\begin{equation} +\frac{1}{k}\log_2 c(f)\;\tfrac{1}{k}\log_2 c(f)\; +\sqrt{\frac{1}{k}\log_2 c(f)}\;\sqrt{\dfrac{1}{k}\log_2 c(f)} +\end{equation} +\end{verbatim} + +\subsection{The \cn{binom}, \cn{dbinom}, and \cn{tbinom} commands} + +For binomial expressions\index{binomials} such as $\binom{n}{k}$ +\nipkg{amsmath} has \cn{binom}, \cn{dbinom} and \cn{tbinom}: +\begin{equation} +2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2} +\end{equation} +\begin{verbatim} +2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2} +\end{verbatim} + +\subsection{The \cn{genfrac} command} + +The capabilities of \cn{frac}, \cn{binom}, and their variants are +subsumed by a generalized fraction command \cn{genfrac} with six +arguments. The last two correspond to \cn{frac}'s numerator and +denominator; the first two are optional delimiters\index{delimiters} (as +seen in \cn{binom}); the third is a line thickness override (\cn{binom} +uses this to set the fraction line thickness to 0\mdash i.e., invisible); +and the fourth argument is a mathstyle override: integer values 0\ndash 3 +select respectively \cn{displaystyle}, \cn{textstyle}, \cn{scriptstyle}, +and \cn{scriptscriptstyle}. If the third argument is left empty, the line +thickness defaults to `normal'. + +\begin{center}\begin{minipage}{.85\columnwidth} +\raggedright \normalfont\ttfamily \exhyphenpenalty10000 +\newcommand{\ma}[1]{% + \string{{\normalfont\itshape#1}\string}\penalty9999 \ignorespaces} +\string\genfrac \ma{left-delim} \ma{right-delim} \ma{thickness} +\ma{mathstyle} \ma{numerator} \ma{denominator} +\end{minipage}\end{center} +To illustrate, here is how \cn{frac}, \cn{tfrac}, and +\cn{binom} might be defined. +\begin{verbatim} +\newcommand{\frac}[2]{\genfrac{}{}{}{}{#1}{#2}} +\newcommand{\tfrac}[2]{\genfrac{}{}{}{1}{#1}{#2}} +\newcommand{\binom}[2]{\genfrac{(}{)}{0pt}{}{#1}{#2}} +\end{verbatim} +If you find yourself repeatedly using \cn{genfrac} throughout a document +for a particular notation, you will do yourself a favor (and your +publisher) if you define a meaningfully-named abbreviation for that +notation, along the lines of \cn{frac} and \cn{binom}. + +The primitive generalized fraction commands \cs{over}, \cs{overwithdelims}, +\cs{atop}, \cs{atopwithdelims}, \cs{above}, \cs{abovewithdelims} produce +warning messages if used with the \nipkg{amsmath} package, for reasons +discussed in \fn{technote.tex}. + +%% ------------------------------------------------------------------ %% + +\section{Continued fractions} + +The continued fraction\index{continued fractions} +\begin{equation} +\cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+\cdots +}}} +\end{equation} +can be obtained by typing +{\samepage +\begin{verbatim} +\cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+\dotsb +}}} +\end{verbatim} +}% End of \samepage +This produces better-looking results than straightforward use of +\cn{frac}. Left or right placement of any of the numerators is +accomplished by using \cn{cfrac}|[l]| or \cn{cfrac}|[r]| instead of +\cn{cfrac}.\index{options!adjust positioning}% +\index{fractions|)} + +%% ------------------------------------------------------------------ %% + +\section{Smash options} + +The command \cn{smash} is used to typeset a subformula with an +effective height and depth of zero, which is sometimes +useful in adjusting the subformula's position with respect to adjacent +symbols. With the \nipkg{amsmath} package \cn{smash} has optional +arguments\index{options!behavior of particular options} +|[t]|\index{t option@\texttt{t} (top) option} and +|[b]|\index{b option@\texttt{b} (bottom) option} because occasionally it is +advantageous to be able to \qq{smash} only the top or only the bottom +of something while retaining the natural depth or height. For example, +when adjacent radical symbols are unevenly sized or positioned because +of differences in the height and depth of their contents, \cn{smash} +can be employed to make them more consistent. Compare +$\sqrt{x}+\sqrt{y}+\sqrt{z}$ and $\sqrt{x}+\sqrt{\smash[b]{y}}+\sqrt{z}$, +where the latter was produced by +\verb"$\sqrt{x}" \verb"+" +\verb"\sqrt{"\5\verb"\smash[b]{y}}" \verb"+" \verb"\sqrt{z}$". + +%% ------------------------------------------------------------------ %% + +\section{Delimiters} + +\index{delimiters|(} + +\subsection{Delimiter sizes}\label{bigdel} + +The automatic delimiter sizing done by \cn{left} and \cn{right} has two +limitations: First, it is applied mechanically to produce delimiters +large enough to encompass the largest contained item, and second, the +range of sizes is not even approximately continuous but has fairly large +quantum jumps. This means that a math fragment that is infinitesimally +too large for a given delimiter size will get the next larger size, a +jump of 3pt or so in normal-sized text. There are two or three +situations where the delimiter size is commonly adjusted, using a set of +commands that have `big' in their names.% +\index{delimiters!fixed size|(} +\begin{ctab}{l|llllll} +Delimiter& + text& \ncn{left}& \ncn{bigl}& \ncn{Bigl}& \ncn{biggl}& \ncn{Biggl}\\ +size& + size& \ncn{right}& \ncn{bigr}& \ncn{Bigr}& \ncn{biggr}& \ncn{Biggr}\\ +\hline +Result\vstrut{5ex}& + $\displaystyle(b)(\frac{c}{d})$& + $\displaystyle\left(b\right)\left(\frac{c}{d}\right)$& + $\displaystyle\bigl(b\bigr)\bigl(\frac{c}{d}\bigr)$& + $\displaystyle\Bigl(b\Bigr)\Bigl(\frac{c}{d}\Bigr)$& + $\displaystyle\biggl(b\biggr)\biggl(\frac{c}{d}\biggr)$& + $\displaystyle\Biggl(b\Biggr)\Biggl(\frac{c}{d}\Biggr)$ +\end{ctab} +The first kind of situation is a cumulative operator with limits above +and below. With \cn{left} and \cn{right} the delimiters usually turn out +larger than necessary, and using the |Big| or |bigg| +sizes\index{big@\cn{big}, \cn{Big}, \cn{bigg}, \dots\ delimiters} +instead gives better results: +\begin{equation*} +\left[\sum_i a_i\left\lvert\sum_j x_{ij}\right\rvert^p\right]^{1/p} +\quad\text{versus}\quad +\biggl[\sum_i a_i\Bigl\lvert\sum_j x_{ij}\Bigr\rvert^p\biggr]^{1/p} +\end{equation*} +\begin{verbatim} +\biggl[\sum_i a_i\Bigl\lvert\sum_j x_{ij}\Bigr\rvert^p\biggr]^{1/p} +\end{verbatim} +The second kind of situation is clustered pairs of delimiters where +\cn{left} and \cn{right} make them all the same size (because that is +adequate to cover the encompassed material) but what you really want +is to make some of the delimiters slightly larger to make the nesting +easier to see. +\begin{equation*} +\left((a_1 b_1) - (a_2 b_2)\right) +\left((a_2 b_1) + (a_1 b_2)\right) +\quad\text{versus}\quad +\bigl((a_1 b_1) - (a_2 b_2)\bigr) +\bigl((a_2 b_1) + (a_1 b_2)\bigr) +\end{equation*} +\begin{verbatim} +\left((a_1 b_1) - (a_2 b_2)\right) +\left((a_2 b_1) + (a_1 b_2)\right) +\quad\text{versus}\quad +\bigl((a_1 b_1) - (a_2 b_2)\bigr) +\bigl((a_2 b_1) + (a_1 b_2)\bigr) +\end{verbatim} +The third kind of situation is a slightly oversize object in running +text, such as $\left\lvert\frac{b'}{d'}\right\rvert$ where the +delimiters produced by \cn{left} and \cn{right} cause too much line +spreading. In that case \ncn{bigl} and \ncn{bigr}\index{big@\cn{big}, +\cn{Big}, \cn{bigg}, \dots\ delimiters} can be used to produce +delimiters that are slightly larger than the base size but still able to +fit within the normal line spacing: +$\bigl\lvert\frac{b'}{d'}\bigr\rvert$. + +In ordinary \latex/ \ncn{big}, \ncn{bigg}, \ncn{Big}, and \ncn{Bigg} +delimiters aren't scaled properly over the full range of \latex/ font +sizes. With the \nipkg{amsmath} package they are.% +\index{delimiters!fixed size|)} + +\subsection{Vertical bar notations} + +The \nipkg{amsmath} package provides commands \cn{lvert}, \cn{rvert}, +\cn{lVert}, \cn{rVert} (compare \cn{langle}, \cn{rangle}) to address the +%problem of overloading for the vert bar character \qc{\|}. This +problem of overloading for the vert bar character \qcvert. This +character is currently used in \latex/ documents to represent a wide +variety of mathematical objects: the `divides' relation in a +number-theory expression like $p\vert q$, or the absolute-value +operation $\lvert z\rvert$, or the `such that' condition in set +notation, or the `evaluated at' notation $f_\zeta(t)\bigr\rvert_{t=0}$. +The multiplicity of uses in itself is not so bad; what is bad, however, +is that fact that not all of the uses take the same typographical +treatment, and that the complex discriminatory powers of a knowledgeable +reader cannot be replicated in computer processing of mathematical +documents. It is recommended therefore that there should be a one-to-one +correspondence in any given document between the vert bar character +%\qc{\|} and a selected mathematical notation, and similarly for the +\qcvert\ and a selected mathematical notation, and similarly for the +%double-bar command \ncn{\|}\index{"|@\verb"*+"\"|+}. This immediately +double-bar command \cnvert. This immediately +rules out the use of \qc{|} +%and \ncn{\|}\index{"|@\verb"*+"\"|+} for delimiters, because left and right +and \cnvert\ for delimiters, because left and right +delimiters are distinct usages that do not relate in the same way to +adjacent symbols; recommended practice is therefore to define suitable +commands in the document preamble for any paired-delimiter use of vert +bar symbols: +\begin{verbatim} +\providecommand{\abs}[1]{\lvert#1\rvert} +\providecommand{\norm}[1]{\lVert#1\rVert} +\end{verbatim} +whereupon the document would contain |\abs{z}| to produce $\lvert +z\rvert$ and |\norm{v}| to produce $\lVert v\rVert$. +The \pkg{mathools} provides the command \cn{DeclarePairedDelimiter} +for defining |\abs|-like macros with scaling delimiters. +\index{delimiters|)} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Operator names} + +\section{Defining new operator names}\label{s:opname} + +Math functions\index{operator names}\relax \index{function +names|see{operator names}} such as $\log$, $\sin$, and $\lim$ are +traditionally typeset in roman type to make them visually more distinct +from one-letter math variables, which are set in math italic. The more +common ones have predefined names, \cn{log}, \cn{sin}, \cn{lim}, and so +forth, but new ones come up all the time in mathematical papers, so the +\nipkg{amsmath} package provides a general mechanism for defining new +`operator names'. To define a math function \ncn{xxx} to work like +\cn{sin}, you write +\begin{verbatim} +\DeclareMathOperator{\xxx}{xxx} +\end{verbatim} +whereupon ensuing uses of \ncn{xxx} will produce {\upshape xxx} in the +proper font and automatically add proper spacing\index{horizontal +spacing!around operator names} on either side when necessary, so that you +get $A\xxx B$ instead of $A\mathrm{xxx}B$. In the second argument of +\cn{DeclareMathOperator} (the name text), a pseudo-text mode prevails: +the hyphen character \qc{\-} will print as a text hyphen rather than a +minus sign and an asterisk \qc{\*} will print as a raised text asterisk +instead of a centered math star. (Compare +\textit{a}-\textit{b}*\textit{c} and $a-b*c$.) But otherwise the name +text is printed in math mode, so that you can use, e.g., subscripts and +superscripts there. + +%%%%xxx%%%\enlargethispage{1\baselineskip} +If the new operator should have subscripts and superscripts placed in +`limits' position above and below as with $\lim$, $\sup$, or $\max$, use +the \qc{\*} form of the \cn{DeclareMathOperator} command: +\begin{verbatim} +\DeclareMathOperator*{\Lim}{Lim} +\end{verbatim} +See also the discussion of subscript placement in +Section~\ref{subplace}. + +\goodbreak + +The following operator names are predefined: + +\vspace{-1\baselineskip} +\begin{ctab}{@{}rlrlrlrl} +\cn{arccos}& $\arccos$ &\cn{deg}& $\deg$ & \cn{lg}& $\lg$ & \cn{projlim}& $\projlim$\\ +\cn{arcsin}& $\arcsin$ &\cn{det}& $\det$ & \cn{lim}& $\lim$ & \cn{sec}& $\sec$\\ +\cn{arctan}& $\arctan$ &\cn{dim}& $\dim$ & \cn{liminf}& $\liminf$ &\cn{sin}& $\sin$\\ +\cn{arg}& $\arg$ & \cn{exp}& $\exp$ & \cn{limsup}& $\limsup$ &\cn{sinh}& $\sinh$\\ +\cn{cos}& $\cos$ & \cn{gcd}& $\gcd$ & \cn{ln}& $\ln$ & \cn{sup}& $\sup$\\ +\cn{cosh}& $\cosh$ & \cn{hom}& $\hom$ & \cn{log}& $\log$ & \cn{tan}& $\tan$\\ +\cn{cot}& $\cot$ & \cn{inf}& $\inf$ & \cn{max}& $\max$ & \cn{tanh}& $\tanh$\\ +\cn{coth}& $\coth$ & \cn{injlim}& $\injlim$ &\cn{min}& $\min$\\ +\cn{csc}& $\csc$ & \cn{ker}& $\ker$ & \cn{Pr}& $\Pr$ +\end{ctab} +\par\nobreak +\vspace{-1.2\baselineskip} +\begin{ctab}{rlrl} +\cn{varinjlim}& $\displaystyle\varinjlim$& +\cn{varliminf}& $\displaystyle\varliminf$\\ +\cn{varprojlim}& $\displaystyle\varprojlim$& +\cn{varlimsup}& $\displaystyle\varlimsup$ +\end{ctab} + +There is also a command \cn{operatorname} such that using +\begin{verbatim} +\operatorname{abc} +\end{verbatim} +in a math formula is equivalent to a use of \ncn{abc} defined by +\cn{DeclareMathOperator}. This may be occasionally useful for +constructing more complex notation or other purposes. (Use the variant +\cn{operatorname*} to get limits.) + +%% ------------------------------------------------------------------ %% + +\section{\cn{mod} and its relatives} + +Commands \cn{mod}, \cn{bmod}, \cn{pmod}, \cn{pod} are provided to deal +with the special spacing conventions of \qq{mod} notation. \cn{bmod} and +\cn{pmod} are available in \latex/, but with the \nipkg{amsmath} package +the spacing of \cn{pmod} will adjust to a smaller value if it's used in +a non-display-mode formula. \cn{mod} and \cn{pod} are variants of +\cn{pmod} preferred by some authors; \cn{mod} omits the parentheses, +whereas \cn{pod} omits the \qq{mod} and retains the parentheses. +\begin{equation} +\gcd(n,m\bmod n);\quad x\equiv y\pmod b; +\quad x\equiv y\mod c;\quad x\equiv y\pod d +\end{equation} +\begin{verbatim} +\gcd(n,m\bmod n);\quad x\equiv y\pmod b; +\quad x\equiv y\mod c;\quad x\equiv y\pod d +\end{verbatim} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\enlargethispage{1\baselineskip} + +\chapter{The \cn{text} command}\label{text} + +The main use of the command \cn{text} is for words or +phrases\index{text fragments inside math} in a display. It is very +similar to the \latex/ command \cn{mbox} in its effects, but has a +couple of advantages. If you want a word or phrase of text in a +subscript, you can type |..._{\textrm{word or phrase}}|, which is slightly +easier than the \cn{mbox} equivalent: |..._{\mbox{\rmfamily\scriptsize| |word| +|or| |phrase}}|. Note that the standard \cn{textrm} command will use the +\nipkg{amsmath} \cn{text} definition, but ensure the \verb+\rmfamily+ +font is used. +\begin{equation} +f_{[x_{i-1},x_i]} \text{ is monotonic,} +\quad i = 1,\dots,c+1 +\end{equation} +\begin{verbatim} +f_{[x_{i-1},x_i]} \text{ is monotonic,} +\quad i = 1,\dots,c+1 +\end{verbatim} + +The font used for \cn{text} is the same as that of the surrounding +environment; i.e., within a theorem, the contents of \cn{text} will +be set in italic. + +If a math expression is included in a \cn{text} string, it must be +explicitly marked as math (|$...$|). +\[ +\partial_s f(x) = \frac{\partial}{\partial x_0} f(x)\quad + \text{for $x= x_0 + I x_1$.} +\] +\begin{verbatim} +\partial_s f(x) = \frac{\partial}{\partial x_0} f(x)\quad + \text{for $x= x_0 + I x_1$.} +\end{verbatim} + +Function names should \emph{not} be entered as \cn{text}. Instead, +use \cn{mathrm} or \cn{DeclareMathOperator} as appropriate. These are +fixed entities that should not change depending on outside content +(such as appearing within a theorem that is set in italic), and in the +case of declared operators, proper spacing\index{horizontal +spacing!around operator names} is applied automatically. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Integrals and sums} + +\section{Multiline subscripts and superscripts} + +The \cn{substack} command can be used to produce a multiline subscript +or superscript:\index{subscripts and superscripts!multiline}\relax +\index{superscripts|see{subscripts and superscripts}} for example +\begin{ctab}{ll} +\begin{minipage}[t]{.6\columnwidth} +\begin{verbatim} +\sum_{\substack{ + 0\le i\le m\\ + 0<j<n}} + P(i,j) +\end{verbatim} +\end{minipage} +& +$\displaystyle +\sum_{\substack{0\le i\le m\\ 0<j<n}} P(i,j)$ +\end{ctab} +A slightly more generalized form is the \env{subarray} environment which +allows you to specify that each line should be left-aligned instead of +centered, as here: +\begin{ctab}{ll} +\begin{minipage}[t]{.6\columnwidth} +\begin{verbatim} +\sum_{\begin{subarray}{l} + i\in\Lambda\\ 0<j<n + \end{subarray}} + P(i,j) +\end{verbatim} +\end{minipage} +& +$\displaystyle + \sum_{\begin{subarray}{l} + i\in \Lambda\\ 0<j<n + \end{subarray}} + P(i,j)$ +\end{ctab} + +%% ------------------------------------------------------------------ %% + +\section{The \cn{sideset} command}\label{sideset} + +There's also a command called \cn{sideset}, for a rather special +purpose: putting symbols at the subscript and +superscript\index{subscripts and superscripts!on sums} corners of a +large operator symbol such as $\sum$ or $\prod$. \emph{Note: this +command is not designed to be applied to anything other than sum-class +symbols.} The prime +example is the case when you want to put a prime on a sum symbol. If +there are no limits above or below the sum, you could just use +\cn{nolimits}: here's +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +|\sum\nolimits' E_n| in display mode: +\begin{equation} +\sum\nolimits' E_n +\end{equation} +If, however, you want not only the prime but also something below or +above the sum symbol, it's not so easy\mdash indeed, without +\cn{sideset}, it would be downright difficult. With \cn{sideset}, you +can write +\begin{ctab}{ll} +\begin{minipage}[t]{.6\columnwidth} +\begin{verbatim} +\sideset{}{'} + \sum_{n<k,\;\text{$n$ odd}} nE_n +\end{verbatim} +\end{minipage} +&$\displaystyle +\sideset{}{'}\sum_{n<k,\;\text{$n$ odd}} nE_n +$ +\end{ctab} +The extra pair of empty braces is explained by the fact that +\cn{sideset} has the capability of putting an extra symbol or symbols at +each corner of a large operator; to put an asterisk at each corner of a +product symbol, you would type +\begin{ctab}{ll} +\begin{minipage}[t]{.6\columnwidth} +\begin{verbatim} +\sideset{_*^*}{_*^*}\prod +\end{verbatim} +\end{minipage} +&$\displaystyle +\sideset{_*^*}{_*^*}\prod +$ +\end{ctab} + +%% ------------------------------------------------------------------ %% + +\section{Placement of subscripts and limits}\label{subplace} + +The default positioning for subscripts depends on the +base symbol involved. The default for sum-class symbols is +`displaylimits' positioning: When a sum-class symbol appears +in a displayed formula, subscript and superscript are placed in `limits' +position above and below, but in an inline formula, they are placed to +the side, to avoid unsightly and wasteful spreading of the +surrounding text lines. +The default for integral-class symbols is to have sub- and +superscripts always to the side, even in displayed formulas. +(See the discussion of the \opt{intlimits} and related +options\index{options!behavior of particular options} in +Section~\ref{options}.) + +Operator names such as $\sin$ or $\lim$ may have either `displaylimits' +or `limits' positioning depending on how they were defined. The standard +operator names are defined according to normal mathematical usage. + +The commands \cn{limits} and \cn{nolimits} can be used to override the +normal behavior of a base symbol: +\begin{equation*} +\sum\nolimits_X,\qquad \iint\limits_{A}, +\qquad\varliminf\nolimits_{n\to \infty} +\end{equation*} +To define a command whose subscripts follow the +same `displaylimits' behavior as \cn{sum}, put +\cn{displaylimits} at the tail end of the definition. When multiple +instances of \cn{limits}, \cn{nolimits}, or \cn{displaylimits} occur +consecutively, the last one takes precedence. + +%% ------------------------------------------------------------------ %% + +\section{Multiple integral signs} + +\cn{iint}, \cn{iiint}, and \cn{iiiint} give multiple integral +signs\index{integrals!multiple} with the spacing between them nicely +adjusted, in both text and display style. \cn{idotsint} is an extension +of the same idea that gives two integral signs with dots between them. +\begin{gather} +\iint\limits_A f(x,y)\,dx\,dy\qquad\iiint\limits_A +f(x,y,z)\,dx\,dy\,dz\\ +\iiiint\limits_A +f(w,x,y,z)\,dw\,dx\,dy\,dz\qquad\idotsint\limits_A f(x_1,\dots,x_k) +\end{gather} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Commutative diagrams}\label{s:commdiag} +\index{commutative diagrams} + +Some commutative diagram commands like the ones in \amstex/ are +available as a separate package, \pkg{amscd}. For complex commutative +diagrams authors will need to turn to more comprehensive packages like +\tikz/\index{TikZ@\tikz/ package} (in particular, \pkg{tikz-cd}) +or \xypic/\index{XY-pic@\xypic/ package}, +but for simple diagrams without diagonal +arrows\index{arrows!in commutative diagrams} the \pkg{amscd} commands +may be more convenient. Here is one example. +\begin{equation*} +\begin{CD} +S^{\mathcal{W}_\Lambda}\otimes T @>j>> T\\ +@VVV @VV{\End P}V\\ +(S\otimes T)/I @= (Z\otimes T)/J +\end{CD} +\end{equation*} +\begin{verbatim} +\begin{CD} +S^{\mathcal{W}_\Lambda}\otimes T @>j>> T\\ +@VVV @VV{\End P}V\\ +(S\otimes T)/I @= (Z\otimes T)/J +\end{CD} +\end{verbatim} +In the \env{CD} environment the commands |@>>>|, +|@<<<|, |@VVV|, and |@AAA| give respectively right, left, down, and up +arrows. For the horizontal arrows, material between the first and second +|>| or |<| symbols will be typeset as a superscript, and material +between the second and third will be typeset as a subscript. Similarly, +material between the first and second or second and third |A|s or |V|s +of vertical arrows will be typeset as left or right \qq{sidescripts}. +The commands |@=| and \verb'@|' give horizontal and vertical double lines. +A \qq{null arrow} command |@.| can be used instead of a visible arrow +to fill out an array where needed. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Using math fonts} + +\section{Introduction} + +For more comprehensive information on font use in \latex/, see the +\latex/ font guide (\fn{fntguide.tex}) or \booktitle{The \latex/ +Companion} \cite{tlc2}. The basic set of math font commands\index{math +fonts}\relax \index{math symbols|see{math fonts}} in \latex/ includes +\cn{mathbf}, \cn{mathrm}, \cn{mathcal}, \cn{mathsf}, \cn{mathtt}, +\cn{mathit}. Additional math alphabet commands such as +\cn{mathbb} for blackboard bold, \cn{mathfrak} for Fraktur, and +\cn{mathscr} for Euler script are available through the packages +\pkg{amsfonts} and \pkg{euscript} (distributed separately). + +%% ------------------------------------------------------------------ %% +\enlargethispage{1\baselineskip} + +\section{Recommended use of math font commands} + +If you find yourself employing math font commands frequently in your +document, you might wish that they had shorter names, such as \ncn{mb} +instead of \cn{mathbf}. Of course, there is nothing to keep you from +providing such abbreviations for yourself by suitable \cn{newcommand} +statements. But for \latex/ to provide shorter names would actually be a +disservice to authors, as that would obscure a much better alternative: +defining custom command names derived from the names of the underlying +mathematical objects, rather than from the names of the fonts used to +distinguish the objects. For example, if you are using bold to indicate +vectors, then you will be better served in the long run if you define a +`vector' command instead of a `math-bold' command: +\begin{verbatim} + \newcommand{\vect}[1]{\mathbf{#1}} +\end{verbatim} +you can write |\vect{a} + \vect{b}| to produce $\vect{a} + +\vect{b}$. +If you decide several months down the road that you want to use the bold +font for some other purpose, and mark vectors by a small over-arrow +instead, then you can put the change into effect merely by changing the +definition of \ncn{vect}; otherwise you would have to replace all +occurrences of \cn{mathbf} throughout your document, perhaps even +needing to inspect each one to see whether it is indeed +an instance of a vector. + +It can also be useful to assign distinct +command names for different letters of a particular font: +\begin{verbatim} +\DeclareSymbolFont{AMSb}{U}{msb}{m}{n}% or use amsfonts package +\DeclareMathSymbol{\C}{\mathalpha}{AMSb}{"43} +\DeclareMathSymbol{\R}{\mathalpha}{AMSb}{"52} +\end{verbatim} +These statements would define the commands \cn{C} and \cn{R} to produce +blackboard-bold letters from the `AMSb' math symbols font. If you refer +often to the\break complex numbers or real numbers in your document, you +might find this method more convenient than (let's say) defining a +\ncn{field} command and writing\break |\field{C}|, |\field{R}|. But for +maximum flexibility and control, define such a \ncn{field} command and +then define \ncn{C} and \ncn{R} in terms of that +command:\indexcs{mathbb} +\begin{verbatim} +\usepackage{amsfonts}% to get the \mathbb alphabet +\newcommand{\field}[1]{\mathbb{#1}} +\newcommand{\C}{\field{C}} +\newcommand{\R}{\field{R}} +\end{verbatim} + +%% ------------------------------------------------------------------ %% +\enlargethispage{3\baselineskip} + +\section{Bold math symbols} + +The \cn{mathbf} command is commonly used to obtain bold Latin letters in +math, but for most other kinds of math symbols it has no effect, or its +effects depend unreliably on the set of math fonts that are in use. For +example, writing +\begin{verbatim} +\Delta \mathbf{\Delta}\mathbf{+}\delta \mathbf{\delta} +\end{verbatim} +produces $\Delta \mathbf{\Delta}\mathbf{+}\delta +\mathbf{\delta}$; the \cn{mathbf} has no effect on the plus +sign or the small delta. +% should be paragraph break; avoid overfull box on next line +The \nipkg{amsmath} package therefore provides two additional commands, +\cn{boldsymbol} and \cn{pmb}, that can be applied to other kinds of math +symbols. \cn{boldsymbol} can be used for a math symbol that remains +unaffected by \cn{mathbf} if (and only if) your current math font set +includes a bold version of that symbol. \cn{pmb} can be used as a last +resort for any math symbols that do not have a true bold version +provided by your set of math fonts; \qq{pmb} stands for \qq{poor man's +bold} and the command works by typesetting multiple copies of the symbol +with slight offsets. The quality of the output is inferior, especially +for symbols that contain any hairline strokes. When the standard default set of +\latex/ math fonts are in use (Computer Modern), the only symbols that +are likely to require \cn{pmb} are large operator symbols like \cn{sum}, +extended delimiter\index{delimiters} symbols, or the extra math symbols +provided by the \pkg{amssymb} package \cite{amsfonts}. + +The following formula shows some of the results that are possible: +\begin{verbatim} +A_\infty + \pi A_0 +\sim \mathbf{A}_{\boldsymbol{\infty}} \boldsymbol{+} + \boldsymbol{\pi} \mathbf{A}_{\boldsymbol{0}} +\sim\pmb{A}_{\pmb{\infty}} \pmb{+}\pmb{\pi} \pmb{A}_{\pmb{0}} +\end{verbatim} +\begin{equation*} +A_\infty + \pi A_0 +\sim \mathbf{A}_{\boldsymbol{\infty}} \boldsymbol{+} + \boldsymbol{\pi} \mathbf{A}_{\boldsymbol{0}} +\sim\pmb{A}_{\pmb{\infty}} \pmb{+}\pmb{\pi} \pmb{A}_{\pmb{0}} +\end{equation*} +If you want to use only the \cn{boldsymbol} command without loading the +whole \nipkg{amsmath} package, the \pkg{bm} package is recommended (this +is a standard \latex/ package, not an AMS package; you probably have it +already if you have a 1997 or newer version of \latex/). + +%% ------------------------------------------------------------------ %% + +\section{Italic Greek letters} + +For italic versions of the capital Greek letters, the following commands +are provided: +\begin{ctab}{rlrl} +\cn{varGamma}& $\varGamma$& \cn{varSigma}& $\varSigma$\\ +\cn{varDelta}& $\varDelta$& \cn{varUpsilon}& $\varUpsilon$\\ +\cn{varTheta}& $\varTheta$& \cn{varPhi}& $\varPhi$\\ +\cn{varLambda}& $\varLambda$& \cn{varPsi}& $\varPsi$\\ +\cn{varXi}& $\varXi$& \cn{varOmega}& $\varOmega$\\ +\cn{varPi}& $\varPi$ +\end{ctab} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Error messages and output problems} + +\section{General remarks} + +This is a supplement to Chapter~8 of the \latex/ manual \cite{lamport} +(first edition: Chapter~6). Appendix~B of the +\textit{Companion}~\cite{tlc2} lists all \latex/ errors including those +for \nipkg{amsmath} with likely causes for each. For the reader's +convenience, the set of error messages discussed here overlaps +somewhat with the set in those references, +but please be aware that we don't provide exhaustive coverage here. +The error messages are arranged in alphabetical order, disregarding +unimportant text such as |! LaTeX Error:| at the beginning, and +nonalphabetical characters such as \qc{\\}. Where examples are given, we +show also the help messages that appear on screen when you respond to an +error message prompt by entering |h|. + +Remember that the important error message is the first for a given line. +When running in nonstop mode, errors accumulate, and the first error +may create a further error condition from which it is impossible to +recover. In such a situation processing will stop after 100~errors, +so the reporting of genuine errors may not be complete, and it may be +impossible to determine which reported errors are genuine and which +are not. + +A final section discusses some output errors, i.e., instances where +the printed document has something wrong but there was no \latex/ +error during typesetting. + +%% ------------------------------------------------------------------ %% +%% ********** +\enlargethispage{-2\baselineskip} + +\section{Error messages} + +\begin{error}{\begin{split} won't work here.} +\errexa +\begin{verbatim} +! Package amsmath Error: \begin{split} won't work here. + ... + +l.8 \begin{split} + +? h +\Did you forget a preceding \begin{equation}? +If not, perhaps the `aligned' environment is what you want. +? +\end{verbatim} +\errexpl +The \env{split} environment does not construct a stand-alone displayed +equation; it needs to be used within some other environment such as +\env{equation} or \env{gather}. + +\end{error} + +\begin{error}{Erroneous nesting of equation structures} +\errexa +\begin{verbatim} +! Package amsmath Error: Erroneous nesting of equation structures; +(amsmath) trying to recover with `aligned'. + +See the amsmath package documentation for explanation. +Type H <return> for immediate help. + ... + +l.260 \end{alignat*} + \end{equation*} +\end{verbatim} +\errexpl +The structures \env{align}, \env{alignat}, etc., are designed +for top-level use and for the most part cannot be nested inside some +other displayed equation structure. The chief exception is that +\env{align} and most of its variants can be used inside the +\env{gather} environment. +\end{error} + +\begin{error}{Extra & on this line} +\errexa +\begin{verbatim} +! Package amsmath Error: Extra & on this line. + +See the amsmath package documentation for explanation. +Type H <return> for immediate help. + ... + +l.9 \end{alignat} + +? h +\An extra & here is so disastrous that you should probably exit + and fix things up. +? +\end{verbatim} +\errexpl +In an \env{alignat} structure the number of alignment points per line +is dictated by the numeric argument given after |\begin{alignat}|. +If you use more alignment points in a line it is assumed that you +accidentally left out a newline command \cn{\\} and the above error is +issued. +\end{error} + +%% ********** +\enlargethispage{1.5\baselineskip} + +\begin{error}{Font OMX/cmex/m/n/7=cmex7 not loadable ...} +\errexa +\begin{verbatim} +! Font OMX/cmex/m/n/7=cmex7 not loadable: Metric (TFM) file not found. +<to be read again> + relax +l.8 $a + b+b^2$ +? h +I wasn't able to read the size data for this font, +so I will ignore the font specification. +[Wizards can fix TFM files using TFtoPL/PLtoTF.] +You might try inserting a different font spec; +e.g., type `I\font<same font id>=<substitute font name>'. +? +\end{verbatim} +\errexpl +Certain extra sizes of some Computer Modern fonts that were formerly +available mainly through the AMSFonts\index{amsfont@AMSFonts collection} +distribution are considered part of standard \latex/ (as of June 1994): +\fn{cmex7}\ndash \texttt{9}, \fn{cmmib5}\ndash \texttt{9}, and +\fn{cmbsy5}\ndash \texttt{9}. If these extra sizes are missing on your +system, you should try first to get them from the source where you +obtained \latex/. If that fails, you could try getting the fonts from +CTAN (e.g., in the form of Metafont\index{Metafont source files} source +files, directory \nfn{/tex-archive/fonts/latex/mf}, or in PostScript +Type 1 format, directory +\nfn{/tex-archive/fonts/cm/ps-type1/bakoma}\index{BaKoMa fonts}\relax +\index{PostScript fonts}). + +If the font name begins with \fn{cmex}, there is a special option% +\index{options!behavior of particular options} +\opt{cmex10} for the \nipkg{amsmath} package that provides a temporary +workaround. I.e., change the \cn{usepackage} to +\begin{verbatim} +\usepackage[cmex10]{amsmath} +\end{verbatim} +This will force the use of the 10-point size of the \fn{cmex} font in +all cases. Depending on the contents of your document this may be +adequate. +\end{error} + +\enlargethispage{1\baselineskip} +\begin{error}{Improper argument for math accent} +\errexa +\begin{verbatim} +! Package amsmath Error: Improper argument for math accent: +(amsmath) Extra braces must be added to +(amsmath) prevent wrong output. + +See the amsmath package documentation for explanation. +Type H <return> for immediate help. + ... + +l.415 \tilde k_{\lambda_j} = P_{\tilde \mathcal + {M}} +? +\end{verbatim} +\errexpl +Non-simple arguments for any \LaTeX{} command should be enclosed in +braces. In this example extra braces are needed as follows: +\begin{verbatim} +... P_{\tilde{\mathcal{M}}} +\end{verbatim} +\end{error} + +\begin{error}{Math formula deleted: Insufficient extension fonts} +\errexa +\begin{verbatim} +! Math formula deleted: Insufficient extension fonts. +l.8 $ab+b^2$ + +? +\end{verbatim} +\errexpl +This usually follows a previous error |Font ... not loadable|; see the +discussion of that error (above) for solutions. +\end{error} + +\enlargethispage{1\baselineskip} +\begin{error}{Missing number, treated as zero} +\errexa +\begin{verbatim} +! Missing number, treated as zero. +<to be read again> + a +l.100 \end{alignat} + +? h +A number should have been here; I inserted `0'. +(If you can't figure out why I needed to see a number, +look up `weird error' in the index to The TeXbook.) + +? +\end{verbatim} +\errexpl +There are many possibilities that can lead to this error. However, one +possibility that is relevant for the \nipkg{amsmath} package is that you +forgot to give the number argument of an \env{alignat} environment, as +in: +\begin{verbatim} +\begin{alignat} + a& =b& c& =d\\ +a'& =b'& c'& =d' +\end{alignat} +\end{verbatim} +where the first line should read instead +\begin{verbatim} +\begin{alignat}{2} +\end{verbatim} + +Another possibility is that you have a left bracket character |[| +following a line break\index{line break} command \cn{\\} in a multiline +construction such as \env{array}, \env{tabular}, or \env{eqnarray}. +This will be interpreted by \latex/ as the beginning of an `additional +vertical space request \cite[\S C.1.6]{lamport}, even if it occurs on the +following line and is intended to be part of the contents. For example, +\begin{verbatim} +\begin{array}{c} +a+b\\ +[f,g]\\ +m+n +\end{array} +\end{verbatim} +To prevent the error message in such a case, you can +add braces as discussed in the \latex/ manual \cite[\S C.1.1]{lamport}: +\begin{verbatim} +\begin{array}{c} +a+b\\ +{[f,g]}\\ +m+n +\end{array} +\end{verbatim} +or precede the bracketed expression by \cn{relax}. +\end{error} + +\goodbreak + +\begin{error}{Missing \right. inserted} +\errexa +\begin{verbatim} +! Missing \right. inserted. +<inserted text> + \right . +l.10 \end{multline} + +? h +I've inserted something that you may have forgotten. +(See the <inserted text> above.) +With luck, this will get me unwedged. But if you +really didn't forget anything, try typing `2' now; then +my insertion and my current dilemma will both disappear. +\end{verbatim} +\errexpl +This error typically arises when you try to insert a +line break\index{line break} or |&|\cnamp\ between a +\cn{left}-\cn{right} pair of delimiters\index{delimiters} in any +multiline environment, including \env{split}. +\begin{verbatim} +\begin{multline} +AAA\left(BBB\\ + CCC\right) +\end{multline} +\end{verbatim} +There are two possible solutions: (1)~instead of using \cn{left} and +\cn{right}, use `big' delimiters\index{delimiters!fixed size} of fixed +size (\cn{bigl} \cn{bigr} \cn{biggl} \cn{biggr} \dots; see +\secref{bigdel}); or (2)~use null delimiters\index{delimiters!null} to +break up the \cn{left}-\cn{right} pair into parts for each line (or cell): +\begin{verbatim} +AAA\left(BBB\right.\\ + \left.CCC\right) +\end{verbatim} +The latter solution may result in mismatched +delimiter\index{delimiters!mismatched sizes} sizes; +ensuring that they match requires using \cn{vphantom} in the segment +that has the smaller delimiter (or possibly \cn{smash} in the segment +that has the larger delimiter). In the argument of \cn{vphantom} put a +copy of the tallest element that occurs in the other segment, e.g., +\begin{verbatim} +xxx \left(\int_t yyy\right.\\ + \left.\vphantom{\int_t} zzz ... \right) +\end{verbatim} +\end{error} + +\goodbreak + +\begingroup +\lccode`M=`M +\lccode`@=`\} +\lowercase{\endgroup +\begin{error}{Missing @ inserted}} + +\errexa +\begin{verbatim} +! Missing } inserted. +<inserted text> + \right . +l.10 \end{multline} + +? h +I've inserted something that you may have forgotten. +(See the <inserted text> above.) +With luck, this will get me unwedged. But if you +really didn't forget anything, try typing `2' now; then +my insertion and my current dilemma will both disappear. +\end{verbatim} +\errexpl +This error is often the result of using \verb+$+ within a multiline +display environment. Remove such \verb+$+ signs (except when they +appear within \verb+\text{...}+). +\end{error} + +\begin{error}{Old form `\pmatrix' should be \begin{pmatrix}.} +\errexa +\begin{verbatim} +! Package amsmath Error: Old form `\pmatrix' should be + \begin{pmatrix}. + +See the amsmath package documentation for explanation. +Type H <return> for immediate help. + ... + +\pmatrix ->\left (\matrix@check \pmatrix + \env@matrix +l.16 \pmatrix + {a&b\cr c&d\cr} +? h +`\pmatrix{...}' is old Plain-TeX syntax whose use is +ill-advised in LaTeX. +? +\end{verbatim} +\errexpl +When the \nipkg{amsmath} package is used, the old forms of \cn{pmatrix}, +\cn{matrix}, and \cn{cases} cannot be used any longer because of naming +conflicts. Their syntax did not conform with standard \LaTeX{} syntax +in any case. +\end{error} + +\enlargethispage{2\baselineskip} +\begin{error}{Paragraph ended before \xxx was complete} +\errexa +\begin{verbatim} +Runaway argument? + +! Paragraph ended before \multline was complete. +<to be read again> + \par +l.100 + +? h +I suspect you've forgotten a `}', causing me to apply this +control sequence to too much text. How can we recover? +My plan is to forget the whole thing and hope for the best. +? +\end{verbatim} +\errexpl +This might be produced by a blank line between the |\begin| and |\end|. +Another possibility is a misspelling in the |\end{multline}| command, +e.g., +\begin{verbatim} +\begin{multline} +... +\end{multiline} +\end{verbatim} +or by using abbreviations for certain environments, such as |\bal| and +|\eal| for |\begin{align}| and |\end{align}|: +\begin{verbatim} +\bal +... +\eal +\end{verbatim} +For technical reasons that kind of abbreviation does not work with +the more complex displayed equation environments of the \nipkg{amsmath} package +(\env{gather}, \env{align}, \env{split}, etc.; cf.\ \fn{technote.tex}). +\end{error} + +\begin{error}{Runaway argument?} +See the discussion for the error message +\texttt{Paragraph ended before \ncn{xxx} was complete}. +\end{error} + +\begin{error}{Unknown option `xxx' for package `yyy'} +\errexa +\begin{verbatim} +! LaTeX Error: Unknown option `intlim' for package `amsmath'. +... +? h +The option `intlim' was not declared in package `amsmath', perhaps you +misspelled its name. Try typing <return> to proceed. +? +\end{verbatim} +\errexpl +This means that you misspelled the option\index{options!unknown} +name, or the package simply does not have an option that you expected +it to have. Consult the documentation for the given package. +\end{error} + +%% ------------------------------------------------------------------ %% + +\section{Warning messages} + +\begin{error}{Cannot use `split' here} +\errexa +\begin{verbatim} +Package amsmath Warning: Cannot use `split' here; +(amsmath) trying to recover with `aligned' +\end{verbatim} +\errexpl The \env{split} environment is designed to serve as the entire +body of an equation, or an entire line of an \env{align} or \env{gather} +environment. There cannot be any printed material before or +after it within the same enclosing structure: +\begin{verbatim} +\begin{equation} +\left\{ % <-- Not allowed +\begin{split} +... +\end{split} +\right. % <-- Not allowed +\end{equation} +\end{verbatim} +\end{error} + +\begin{error}{Foreign command \over [or \atop or \above]} +\errexa +\begin{verbatim} +Package amsmath Warning: Foreign command \over; \frac or \genfrac +(amsmath) should be used instead. +\end{verbatim} +\errexpl The primitive generalized fraction commands of \tex/\mdash +\cs{over}, \cs{atop}, \cs{above}\mdash are deprecated when the +\nipkg{amsmath} package is used because their syntax is foreign to \latex/ +and \nipkg{amsmath} provides native \latex/ equivalents. See +\fn{technote.tex} for further information. +\end{error} + +%% ------------------------------------------------------------------ %% + +\section{Wrong output} + +\begin{erroro}{Section numbers 0.1, 5.1, 8.1 instead of 1, 2, 3} +% +This most likely means that you have the arguments for \cn{numberwithin} +in reverse order: +\begin{verbatim} +\numberwithin{section}{equation} +\end{verbatim} +That means `print the section number as \textit{equation +number}.\textit{section number} and reset to 1 every time an equation +occurs' when what you probably wanted was the inverse +\begin{verbatim} +\numberwithin{equation}{section} +\end{verbatim} +\end{erroro} + +\begin{erroro}{The \cn{numberwithin} command had no effect on equation + numbers} +% +Are you looking at the first section in your document? Check the section +numbers elsewhere to see if the problem is the one described in the +previous item. +\end{erroro} + +\begin{erroro}{Bracketed material disappears at the beginning of + \env{aligned} or \env{gathered}} +% +For most multiline equation environments, \nipkg{amsmath} disables the +\latex/ convention to recognize a [bracketed] expression as an option% +\index{ed env@\texttt{-ed} environments}% +\index{options!positioning of \texttt{-ed} environments}% +\index{options!space before \texttt{[}} +when it occurs at the beginning of an environment or immediately +following \cn{\\}, provided a space intervenes. This fails at the +beginning of \env{aligned} and \env{gathered}, and is a bug. Insert +\cn{relax} before the opening brace to restore the desired result. +\end{erroro} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Additional information} + +\section{Compatibility with other packages} + +Several packages have already been mentioned as providing facilities +lacking in \nipkg{amsmath}. + +\begin{itemize} +\item \pkg{bm} is recommended for specifying bold math symbols. +\item \pkg{mathtools} provides enhancements to some \nipkg{amsmath} + environments as well as additional compatible features, such as + \env{rcases} (similar to \env{cases} but with the brace on the + right-hand side), \env{multlined} (a subsidiary environment + comparable to \env{multline}), and \cn{shortintertext} (more + compact spacing than \cn{intertext}). If \pkg{mathtools} is used, + \nipkg{amsmath} is loaded automatically, so it is not necessary + to load it separately. +\item \pkg{unicode-math} provides commands for (most?)\ math symbols + in Unicode. +%\item \pkg{empheq} +\end{itemize} + +These packages have known problems when used with \nipkg{amsmath}. +\begin{itemize} +\item \pkg{lineno} may omit numbers before display environments. +\item \pkg{breqn} redefines a number of commands from other packages, + so is best loaded after \nipkg{amsmath} and other packages with math + facilities.\\ \pkg{breqn} is not yet totally stable, and a number of + bugs have been reported via \texttt{tex.stackexchange} \cite{tex-sx}. +\item \pkg{wasysym}, \pkg{mathabx} and perhaps other font packages also + define multiple integrals\index{integrals!multiple} using the same + names as \nipkg{amsmath}. +\end{itemize} + +%% ------------------------------------------------------------------ %% + +\section{Converting existing documents} + +\subsection{Converting from plain \LaTeX{}} + +A \LaTeX{} document will typically continue to work the same in most +respects if \verb'\usepackage{amsmath}' is added in the document +preamble. By default, however, the \nipkg{amsmath} package suppresses page +breaks inside multiple-line displayed equation structures such as +\env{eqnarray}, \env{align}, and \env{gather}. To continue allowing page +breaks inside \env{eqnarray} after switching to \nipkg{amsmath}, you will +need to add the following line in your document preamble: +\begin{verbatim} +\allowdisplaybreaks[1] +\end{verbatim} +To ensure normal spacing around relation symbols, you might also want to +change \env{eqnarray} to \env{align}, \env{multline}, or +\env{equation}\slash\env{split} as appropriate. + +Most of the other differences in \nipkg{amsmath} usage can be considered +optional refinements, e.g., using +\begin{verbatim} +\DeclareMathOperator{\Hom}{Hom} +\end{verbatim} +instead of \verb'\newcommand{\Hom}{\mbox{Hom}}'. + +\subsection{Converting from \texorpdfstring{\amslatex/}{amslatex} 1.1} +See \fn{diffs-m.txt}. + +%% ------------------------------------------------------------------ %% + +\section{Technical notes} +The file \fn{technote.tex} contains some remarks on miscellaneous +technical questions that are less likely to be of general interest. + +%% ------------------------------------------------------------------ %% + +\section{Getting help} + +The \nipkg{amsmath} collection of packages is maintained by the \latex/ +team \cite{ltx-team}. Bugs should be reported using the instructions +at \url{https://www.latex-project.org/bugs/}. +Please be careful not to confuse \nipkg{amsmath} with the AMS document +classes (\cls{amsart}, \cls{amsbook}, and \cls{amsproc}), which +automatically incorporate \nipkg{amsmath}; bugs in the classes should +be reported directly to AMS, by email to \mail{tech-support@ams.org}. + +%Questions or comments regarding \nipkg{amsmath} and related packages +%should be sent to: +%\begin{infoaddress} +%American Mathematical Society\\ +%Technical Support\\ +%Electronic Products and Services\\ +%P. O. Box 6248\\ +%Providence, RI 02940\\[3pt] +%Phone: 800-321-4AMS (321-4267) \quad or \quad 401-455-4080\\ +%Internet: \mail{tech-support@ams.org} +%\end{infoaddress} +%If you are reporting a problem you should include +%the following information to make proper investigation possible: +%\begin{enumerate} +%\item The source file where the problem occurred, preferably reduced +% to minimum size by removing any material that can be removed without +% affecting the observed problem. +%\item A \latex/ log file showing the error message (if applicable) and +% the version numbers of the document class and option files being used. +%\end{enumerate} + +The online forum\index{online Q\,\&\,A forum} \texttt{tex.stackexchange} +\cite{tex-sx} is a good source of answers to common questions on usage. +Look first in the archive to see if your question has already been asked +and answered; if it has not, post your own question. + +There is an online discussion group called \fn{comp.text.tex} \cite{ctt} +that is a fairly good source of information about \latex/ and \tex/ in +general. This group, formerly a Unix newsgroup, predates +\texttt{tex.stackexchange} by decades, and the archives can be a useful +resource for historical investigation. + +%% ------------------------------------------------------------------ %% + +\section{Of possible interest}\label{a:possible-interest} +Information about obtaining AMSFonts or other \tex/-related +software from the AMS web server at \fn{www.ams.org} +can be obtained by sending an email request to +\mail{tech-support@ams.org}. This software is also posted on +CTAN\index{CTAN (Comprehensive \TeX\ Archive Network)} and included +in distributions based on \TeX\,Live\index{TEX Live@\TeX\,Live}. + +The \tex/ Users Group\index{TeX Users@\tex/ Users Group} is a nonprofit +organization that publishes a journal +(\journalname{TUGboat}\index{TUGboat@\journalname{TUGboat}}), holds +meetings, and serves as a clearinghouse for general information about +\tex/ and \tex/-related software. +\begin{infoaddress} +\tex/ Users Group\\ +PO Box 2311\\ +Portland, OR 97208-2311\\ +USA\\[3pt] +Phone: +1-503-223-9994\\ +Email: \mail{office@tug.org} +\end{infoaddress} +Membership in the \tex/ Users Group is a good way to support continued +development of free \tex/-related software. There are also many local +\tex/ user groups in other countries; information about contacting a +local user group can be gotten from the \tex/ Users Group. + +\index{amsmath@\texttt{amsmath} package|)} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newpage + +\begin{thebibliography}{10} +\addcontentsline{toc}{chapter}{\bibname} + +\raggedright + +\bibsubhead{References in print} + +\bibitem{mil} George Gr\"atzer, \booktitle{More Math into \latex/}, fifth ed., +Springer, New York, 2016. +% Deal with a line breaking problem +%\begin{raggedright} +%\bibitem{mil} G. Gr\"{a}tzer, +%\emph{Math into \LaTeX{}: An Introduction to \LaTeX{} and AMS-\LaTeX{}} +% \url{https://www.ams.org/cgi-bin/bookstore/bookpromo?fn=91&arg1=bookvideo&itmc=MLTEX}, +%Birkh\"{a}user, Boston, 1995.\par +%\end{raggedright} + +\bibitem{kn} Donald E. Knuth, \booktitle{The \tex/book}, +Addison-Wesley, Reading, MA, 1984. + +\bibitem{lamport} Leslie Lamport, \booktitle{\latex/: A document preparation +system}, 2nd revised ed., Addison-Wesley, Reading, MA, 1994. + +\bibitem{tlc2} Frank Mittelbach, Michel Goossens, et al., +\booktitle{The \latex/ companion}, second ed., Addison-Wesley, Reading, +MA, 2004. This is now also available as an ebook, in both English and +German; see \url{https://www.latex-project.org/help/books/}. +The front matter, including the full Table of Contents, can be viewed +online, from a link on the same page. +%Michel Goossens, Frank Mittelbach, and Alexander Samarin, +%\booktitle{The \latex/ companion}, Addison-Wesley, Reading, MA, 1994. +% [\emph{Note: The 1994 edition is not a reliable guide for the +% \nipkg{amsmath} package unless you refer to the errata for Chapter +% 8\mdash file \fn{compan.err}, distributed with \LaTeX{}.}] + +\bibitem{msf} Frank Mittelbach and Rainer Sch\"opf, +\textit{The new font family selection\mdash user +interface to standard \latex/}, \journalname{TUGboat} \textbf{11}, +no.~2 (June 1990), pp.~297\ndash 305. + +\bibitem{jt} Michael Spivak, \booktitle{The joy of \tex/}, 2nd revised ed., +Amer. Math. Soc., Providence, RI, 1990. + +\bibsubhead{Package documentation} + +\bibitem{amshandbk}\booktitle{AMS author handbook}, separate versions +for journal articles, monographs and proceedings articles, Amer. Math. +Soc., Providence, RI, 2017; +\url{https://www.ams.org/publications/authors/tex/author-handbook}. + +\bibitem{amsfonts}\booktitle{AMSFonts version \textup{2.2d}\mdash user's guide}, +Amer. Math. Soc., Providence, RI, 2002; distributed +with the AMSFonts package +\url{http://mirror.ctan.org/tex-archive/fonts/amsfonts/doc/amsfndoc.pdf}. + +\bibitem{amsthdoc}\booktitle{Using the \pkg{amsthm} Package}, version 2.20.3, +Amer. Math. Soc., Providence, RI, 2017; +\url{http://mirror.ctan.org/tex-archive/macros/latex/required/amscls/doc/amsthdoc.pdf}. + +\bibitem{mt} Morten H{\o}gholm, Lars Madsen, \booktitle{The \pkg{mathtools} +package}, 2018; +\url{http://mirror.ctan.org/tex-archive/macros/latex/contrib/mathtools/mathtools.pdf}. + +\bibsubhead{Online resources} + +\bibitem{ltx-team} The \latex/ Project, \url{https://www.latex-project.org}. + +\bibitem{ctt} Online discussion group \texttt{comp.text.tex}, +\url{https://groups.google.com/forum/\#!forum/comp.text.tex}. + +\bibitem{tex-sx} Online question and answer forum \texttt{tex.stackexchange}, +\url{https://tex.stackexchange.com}. + +\end{thebibliography} + +\printindex + +\end{document} diff --git a/macros/latex-dev/required/amsmath/amsmath.dtx b/macros/latex-dev/required/amsmath/amsmath.dtx new file mode 100644 index 0000000000..8671694b70 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsmath.dtx @@ -0,0 +1,6383 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 2000, 2013 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +%\iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\raggedbottom +\let\savedarg\arg +\usepackage{amsmath} +\let\arg\savedarg +\GetFileInfo{amsmath.sty} +\begin{document} +\title{The \pkg{amsmath} package} +\author{Frank Mittelbach\and Rainer Sch\"opf\and Michael Downes\and + David M. Jones\and David Carlisle} +\date{Version \fileversion, \filedate} +\providecommand{\histnote}{} +\renewenvironment{histnote}{% + \trivlist\item[\hspace{\labelsep}\bfseries Historical Note:]% +}{% + \endtrivlist +} +\DocInput{amsmath.dtx} +\end{document} +%</driver> +%\fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% +% A \latex/ package named \pkg{amstex} was created in 1988--1989 by +% adapting \fn{amstex.tex} for use within \latex/. The \pkg{amsmath} +% package is the successor of the \pkg{amstex} package. It was +% substantially overhauled to integrate it with \latex/2e, which +% arrived on the scene in 1994. It provides more or less the same +% features, but there are quite a few organizational differences as +% well as some new features and bug fixes. For example, the +% \pkg{amstex} package automatically loaded the \pkg{amsfonts} +% package, but the \pkg{amsmath} package does not. At the present +% time (November 1999) user-level documentation of the commands +% provided here is found in the AMSmath Users' Guide, +% \fn{amsldoc.tex}. +% +% \StopEventually{} +% +% Standard file identification. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must be December 1994 or later +% \end{macrocode} +% +% Providing a rollback to earlier version(s) +% \begin{macrocode} +\providecommand\DeclareRelease[3]{} +\providecommand\DeclareCurrentRelease[2]{} +% +\DeclareRelease{}{2018-12-01}{amsmath-2018-12-01.sty} +\DeclareCurrentRelease{}{2019-04-01} +% \end{macrocode} +% +% \begin{macrocode} +\ProvidesPackage{amsmath}[2019/04/01 v2.17c AMS math features] +% \end{macrocode} +% +% \section{Catcode defenses} +% +% Some packages change the catcode of characters that are essential +% in low-level \tex/ syntax. Any package that does so does not +% qualify as a PWWO package (\qq{Plays Well With Others}) because it +% can cause other packages to fail if they are loaded later. \LaTeX{} +% is partly to blame for this because it fails to provide adequate +% built-in safeguards in the package loading mechanisms. In the +% absence of such safeguards, we will provide them here. +% \begin{macrocode} +\edef\@temp{\catcode 96=\number\catcode 96 } +\catcode\string `\`=12 +\def\do#1{\catcode\number`#1=\number\catcode`#1} +\edef\@temp{% + \noexpand\AtEndOfPackage{% + \@temp + \do\"\do\'\do\(\do\)\do\*\do\+\do\,\do\-\do\.% + \do\/\do\<\do\=\do\>\do\[\do\]\do\^\do\_\relax + }% +} +\@temp +\def\do#1{\catcode\number`#1=12 } +\do\"\do\'\do\(\do\)\do\*\do\+\do\,\do\-\do\. +\do\/\do\<\do\=\do\>\do\[\do\] +\catcode`\^=7 \catcode`\_=8 +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Declare some options} +% +% Handling of limits on integrals, sums, operatornames. +% \begin{macrocode} +\DeclareOption{intlimits}{\let\ilimits@\displaylimits} +\DeclareOption{nointlimits}{\let\ilimits@\nolimits} +\DeclareOption{sumlimits}{\let\slimits@\displaylimits} +\DeclareOption{nosumlimits}{\let\slimits@\nolimits} +\DeclareOption{namelimits}{\PassOptionsToPackage{namelimits}{amsopn}} +\DeclareOption{nonamelimits}{% + \PassOptionsToPackage{nonamelimits}{amsopn}} +% \end{macrocode} +% +% The following two switches might have been defined already by the +% documentclass, but it doesn't hurt to re-execute the \cs{newif}'s. +% \begin{macrocode} +\newif\ifctagsplit@ +\newif\iftagsleft@ +% \end{macrocode} +% Right or left placement of equation numbers. +% \begin{macrocode} +\DeclareOption{leqno}{\tagsleft@true} +\DeclareOption{reqno}{\tagsleft@false} +\DeclareOption{centertags}{\ctagsplit@true} +\DeclareOption{tbtags}{\ctagsplit@false} +% \end{macrocode} +% +% The \opt{cmex10} option is an escape hatch for people who don't +% happen to have sizes 7--9 of the \fn{cmex} fonts available to them +% yet. (Strictly speaking they are considered part of a minimum +% \latex/ distribution now, i.e., all \LaTeXe{} users should have +% them, without needing to get the AMSFonts distrib.) +% \begin{macrocode} +\DeclareOption{cmex10}{% + \ifnum\cmex@opt=\@ne \def\cmex@opt{0}% + \else \def\cmex@opt{10}\fi +} +% \end{macrocode} +% To help things work out better with various package loading orders +% of \pkg{amsmath} and \pkg{amsfonts}, we establish a variable to +% communicate the status of the cmex font definition. If the +% \pkg{amsfonts} package was loaded first this variable might be +% already defined, in which case we want to preserve its value. +% \begin{macrocode} +\@ifundefined{cmex@opt}{\def\cmex@opt{7}}{} +% \end{macrocode} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Flush-left equations [DMJ]} +% +% The left margin of math enviroments is controlled by +% \cs{@mathmargin}. This can be set to \cs{@centering} to +% implement the default behaviour, i.e., centered equations, and to +% something else to implement the flushleft style. +% +% In theory, all that's needed to activate the flushleft mode +% in the AMS document classes is something like this: +% \begin{verbatim} +% \DeclareOption{fleqn}{% +% \AtBeginDocument{\@mathmargin30pt\relax}% +% } +% \end{verbatim} +% (In fact, unless the document class wants to specify the +% \cs{@mathmargin}, it doesn't need to do anything with the +% \opt{fleqn} option.) +% \begin{macrocode} +\newif\if@fleqn +% +\newskip\@mathmargin +\@mathmargin\@centering +% +\DeclareOption{fleqn}{% + \@fleqntrue + \@mathmargin = -1sp + \let\mathindent=\@mathmargin + \AtBeginDocument{% + \ifdim\@mathmargin= -1sp + \@mathmargin\leftmargini minus\leftmargini + \fi + }% +} +% \end{macrocode} +% +% DMJ: This ensures that \cs{@mathmargin} is given some sort of +% sensible default if the class doesn't specify one, while still +% allowing a user to override the default value in their document +% preamble. (Incidentally, I'm initializing \cs{@mathmargin} to +% \cs{leftmargini} for compatibility with \fn{fleqn.clo}, but I'm +% not at all convinced that's the right thing to do.) +% +% The next question is what happens when amsmath is used with +% one of the standard classes. Unfortunately, \latex/ implements +% \opt{fleqn} somewhat clumsily; instead of paramaterizing the +% definitions of the math structures (as I've attempted to do +% here), \fn{fleqn.clo} declares a dimen \cn{mathindent} that is +% much like my \cs{@mathmargin} and then redefines \cn\[, \cn\], +% \cn{equation}, and \cn{eqnarray}. This means that things could +% get rather messy in 2.09 compatibility mode, since \fn{fleqn.clo} +% might be loaded after \fn{amsmath.sty}, which could cause a real +% mess. +% +% [mjd,1999/07/07]: Let \cs{mathindent} = \cs{@mathmargin} as +% envisioned by DMJ. Compatibility-mode documents will all use the +% \pkg{amstex} package, not \pkg{amsmath}. There is a remote chance +% of a problem if someone makes an assignment to \cs{mathindent} in a +% way that implicitly assumes it is a dimen register (inasmuch as it +% has now become a skip register), and the string ``plus'' follows in +% the input stream, but if someone's document croaks in that way, I +% think they will just have to bite the bullet and fix it. The +% alternative is to penalize a lot of other users with a known +% handicap. +% +% \section{Spacing around \cn{aligned} and \cn{gathered}} +% +% [dpc, 2016] Option to control the space to the left of aligned and gathered. +% +% Previously \cn{aligned} and \cn{gathered} inserted a thin space on +% their left but not their right, there is no good reason for this +% that anyone can remember, it has just always been that way +% inherited from amstex. The usual advice to authors has been to use +% |\!\begin{aligned}| to get better spacing. +% +% Here introduce: +% +% \opt{alignedleftspaceyes} to keep the behaviour of adding this space. +% +% \opt{alignedleftspaceno} to disable adding this space. +% +% \opt{alignedleftspaceyesifneg} the new default behaviour, do not add +% the space unless the environment is preceded by a negative skip or +% kern, so that |\!\begin{aligned}| works as before. +% +% \changes{v2.16a}{2016/11/05}{New options to control aligned spacing} +% \begin{macrocode} +\DeclareOption{alignedleftspaceyes}{\def\alignedspace@left{\null\,}} +\DeclareOption{alignedleftspaceno}{\def\alignedspace@left{\null}} +\DeclareOption{alignedleftspaceyesifneg}{% +\def\alignedspace@left{% + \edef\@tempa{\expandafter\@car\the\lastskip\@nil}% + \if-\@tempa\null\,% + \else + \edef\@tempa{\expandafter\@car\the\lastkern\@nil}% + \if-\@tempa\null\,% + \else\null + \fi + \fi}% +} +% \end{macrocode} +% +% +% \begin{macrocode} +\DeclareOption{?}{} +% \end{macrocode} +% +% \begin{macrocode} +\ExecuteOptions{% + nointlimits,sumlimits,namelimits,centertags,alignedleftspaceyesifneg} +% \end{macrocode} +% The \cs{par} after \cs{ProcessOptions} is to ensure the correct +% line number on screen if an error occurs during option processing; +% otherwise the lookahead for a \qc{\*} option would result in \tex/ +% showing the following line instead. +% \begin{macrocode} +\ProcessOptions\par +% \end{macrocode} +% +% \begin{macrocode} +\@ifpackagewith{amsmath}{?}{% + \typeout{^^J% +Documentation for the amsmath package is found in amsldoc.dvi^^J% +(or .pdf or .tex).^^J% +^^J% +See also https://www.ams.org/tex/amslatex.html.^^J% +^^J% +Note: Using the first edition of The LaTeX Companion (1994) without^^J% +errata as a guide for amsmath use is not recommended.^^J% + }% +}{% + \typeout{% +For additional information on amsmath, use the \lq ?\rq\space option.% + }% +} +% \end{macrocode} +% +% Processing to handle the \opt{cmex10} option is a little tricky +% because of different possible loading orders for \pkg{amsmath} and +% \pkg{amsfonts}. The package \pkg{amsmath} sets the \cs{cmex@opt} +% flag to 7 or 10, and the package \pkg{amsfonts} sets the flag to 1 +% or 0. +% \begin{macrocode} +\ifnum\cmex@opt=7 \relax + \DeclareFontShape{OMX}{cmex}{m}{n}{% + <-8>cmex7<8>cmex8<9>cmex9% + <10><10.95><12><14.4><17.28><20.74><24.88>cmex10% + }{}% + \expandafter\let\csname OMX/cmex/m/n/10\endcsname\relax +\else + \ifnum\cmex@opt=\z@ % need to override cmex7 fontdef from amsfonts +% \end{macrocode} +% Force reloading of the OMX/cmex font definition file. +% \begin{macrocode} + \begingroup + \fontencoding{OMX}\fontfamily{cmex}% + \expandafter\let\csname OMX+cmex\endcsname\relax + \try@load@fontshape + \endgroup +% \end{macrocode} +% The \fn{cmex10} font gets special preload handling in the building +% of the \latex/ format file, need an extra bit here to work around +% that. +% \begin{macrocode} + \expandafter\let\csname OMX/cmex/m/n/10\endcsname\relax + \def\cmex@opt{10}% + \fi +\fi +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Call some other packages} +% +% The \pkg{amstext} package provides the \cn{text} command. The +% \pkg{amsbsy} package provides \cn{boldsymbol} and \cn{pmb}. (Since +% 1997 it is usually better to use the \pkg{bm} package instead; but +% I think we have to keep \pkg{amsbsy} here for backward +% compatibility [mjd,1999/11/19].) The \pkg{amsopn} package provides +% \cn{DeclareMathOperator}. +% \begin{macrocode} +\RequirePackage{amstext}[1995/01/25] +\RequirePackage{amsbsy}[1995/01/20] +\RequirePackage{amsopn}[1995/01/20] +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Miscellaneous} +% +% \begin{macro}{\ams@newcommand} +% Where \pkg{stix} and \pkg{amsmath} define the same control +% sequences, we want to avoid inadvertently overriding \pkg{stix}'s +% definitions. If \pkg{stix} is loaded before \pkg{amsmath}, the +% following conditional takes care of the problem. There is +% similar code in the \pkg{stix} package in case \pkg{amsmath} is +% loaded first. +% \begin{macrocode} +\@ifpackageloaded{stix}{% + \let\ams@newcommand\providecommand + \let\ams@renewcommand\providecommand + \let\ams@def\providecommand + \let\ams@DeclareRobustCommand\providecommand +}{% + \let\ams@newcommand\newcommand + \let\ams@renewcommand\renewcommand + \let\ams@def\def + \let\ams@DeclareRobustCommand\DeclareRobustCommand +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@amsmath@err} +% Defining this error function saves main mem. +% \begin{macrocode} +\def\@amsmath@err{\PackageError{amsmath}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\AmS} +% The \cs{AmS} prefix can be used to construct the combination +% |\AmS-\LaTeX|. +% \begin{macrocode} +\providecommand{\AmS}{{\protect\AmSfont + A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}} +% \end{macrocode} +% In \cn{AmSfont} we call cmsy directly in lieu of trying to access +% it through the math fonts setup (e.g. |\the\textfont2|) because +% math fonts can't be relied on to be properly set up if we are not +% inside a math formula. This means that if this command is used in a +% document where CM fonts are not wanted, then a font substitution +% will need to be declared, e.g.: +% \begin{verbatim} +% \DeclareFontShape{OMS}{cmsy}{m}{n}{ <-> sub * xxx/m/n }{} +% \end{verbatim} +% where |xxx| is some alternate font family. +% Taking the first letter of \cs{f@series} will produce |b| or |m| +% for the most common values (|b,bx,m|). It may produce nonsense for +% more unusual values of \cs{f@series}, so for safety's sake we have +% an additional \cs{if} test. We want to avoid setting the series to +% |bx| because in a standard \latex/ installation the combination +% |cmsy/bx/n| does not have a font definition, and the user +% would get a font substitution warning on screen. +% \begin{macrocode} +\newcommand{\AmSfont}{% + \usefont{OMS}{cmsy}{\if\@xp\@car\f@series\@nil bb\else m\fi}{n}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@mathmeasure} +% The function |\@mathmeasure| takes three arguments; the third arg +% is typeset as a math formula in an hbox, using arg |#2| as the +% mathstyle, and the result is left in the box named by the first +% arg. It is assumed that we are already in math mode, so we can turn +% off |\everymath| (in particular, |\check@mathfonts|). +% +% As of 2018/12 release we don't turn off |\evermath| as this +% optimization can be harmful. +% \changes{v2.17b}{2018/12/01}{Don't drop \cs{frozen@everymath}} +% \begin{macrocode} +\ifx\leavevmode@ifvmode\@undefined % kernel is < 2018/12 +\def\@mathmeasure#1#2#3{\setbox#1\hbox{\frozen@everymath\@emptytoks + \m@th$#2#3$}} +\else +\def\@mathmeasure#1#2#3{\setbox#1\hbox{% + \m@th$#2#3$}} +\fi +% \end{macrocode} +% \end{macro} +% +% The \cs{inf@bad} constant is for testing overfull boxes. +% \begin{macrocode} +\@ifundefined{inf@bad}{% + \newcount\inf@bad \inf@bad=1000000 \relax +}{} +% \end{macrocode} +% +%\subsection{Math spacing commands} +% +% \begin{macro}{\tmspace} +% \begin{macro}{\,} +% \begin{macro}{\thinspace} +% \begin{macro}{\!} +% \begin{macro}{\negthinspace} +% \begin{macro}{\:} +% \begin{macro}{\medspace} +% \begin{macro}{\negmedspace} +% \begin{macro}{\;} +% \begin{macro}{\thickspace} +% \begin{macro}{\negthickspace} +% Here we fill in some gaps in the set of spacing commands, and make them +% all work equally well in or out of math. +% We want all these commands to be robust but declaring them all with +% \cs{DeclareRobustCommand} uses up an control sequence name per +% command; to avoid this, we define a common command \cs{tmspace} +% (text-or-math space) which carries the robustness burden for all of +% them. The standard \cs{relax} before the \cs{ifmmode} is not +% necessary because of the \cs{protect} added by +% \cs{DeclareRobustCommand}. +% \changes{v2.17b}{2018/12/01}{Start LR-mode for \cs{thinspace} and +% friends if necessary (github/49)} +% \begin{macrocode} +\ifx\leavevmode@ifvmode\@undefined +\DeclareRobustCommand{\tmspace}[3]{% + \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} +\else +\DeclareRobustCommand{\tmspace}[3]{% + \ifmmode\mskip#1#2\else\leavevmode@ifvmode\kern#1#3\fi\relax} +\fi +\renewcommand{\,}{\tmspace+\thinmuskip{.1667em}} +\let\thinspace\, +\renewcommand{\!}{\tmspace-\thinmuskip{.1667em}} +\let\negthinspace\! +\renewcommand{\:}{\tmspace+\medmuskip{.2222em}} +\let\medspace\: +\newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}} +\renewcommand{\;}{\tmspace+\thickmuskip{.2777em}} +\let\thickspace\; +\newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\mspace} +% And while we're at it, why don't we provide an equivalent of +% \cn{hspace} for math mode use. This allows use of |mu| units in +% (for example) constructing compound math symbols. +% \begin{macrocode} +\newcommand{\mspace}[1]{\mskip#1\relax} +% \end{macrocode} +% \end{macro} +% +% \subsection{Vertical bar symbols} +% \begin{macro}{\lvert} +% \begin{macro}{\rvert} +% \begin{macro}{\lVert} +% \begin{macro}{\rVert} +% Add left/right specific versions of \cn{vert}, \cn{Vert}. Don't +% assume the delimiter codes are the CM defaults. +% \begin{macrocode} +\def\@tempa#1#2\@nil{% + \ifx\delimiter#1\@tempcnta#2\relax\else\@tempcnta\z@\fi +} +\@xp\@tempa\vert\@empty\@nil +\ifnum\@tempcnta>\z@ + \advance\@tempcnta "4000000 + \xdef\lvert{\delimiter\number\@tempcnta\space } + \advance\@tempcnta "1000000 + \xdef\rvert{\delimiter\number\@tempcnta\space } +\else + \ifx\@@undefined\lvert + % Fall back to cmex encoding since we don't know what else to do. + \DeclareMathDelimiter{\lvert} + {\mathopen}{symbols}{"6A}{largesymbols}{"0C} + \DeclareMathDelimiter{\rvert} + {\mathclose}{symbols}{"6A}{largesymbols}{"0C} + \fi +\fi +\@xp\@tempa\Vert\@empty\@nil +\ifnum\@tempcnta>\z@ + \advance\@tempcnta "4000000 + \xdef\lVert{\delimiter\number\@tempcnta\space } + \advance\@tempcnta "1000000 + \xdef\rVert{\delimiter\number\@tempcnta\space } +\else + \ifx\@@undefined\lVert + \DeclareMathDelimiter{\lVert} + {\mathopen}{symbols}{"6B}{largesymbols}{"0D} + \DeclareMathDelimiter{\rVert} + {\mathclose}{symbols}{"6B}{largesymbols}{"0D} + \fi +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Fractions} +% Bury the generalized fraction primitives \cs{over}, \cs{atop}, +% etc., because of their bizarre syntax, which is decidedly out of +% place in a \latex/ document. +% \begin{macrocode} +\@saveprimitive\over\@@over +\@saveprimitive\atop\@@atop +\@saveprimitive\above\@@above +\@saveprimitive\overwithdelims\@@overwithdelims +\@saveprimitive\atopwithdelims\@@atopwithdelims +\@saveprimitive\abovewithdelims\@@abovewithdelims +% \end{macrocode} +% +% \begin{macro}{\primfrac} +% If someone insists on using \cs{over}, give a warning the first +% time and then resurrect the old definition. Laissez-faire policy. +% \begin{macrocode} +\DeclareRobustCommand{\primfrac}[1]{% + \PackageWarning{amsmath}{% +Foreign command \@backslashchar#1;\MessageBreak +\protect\frac\space or \protect\genfrac\space should be used instead% +\MessageBreak + } + \global\@xp\let\csname#1\@xp\endcsname\csname @@#1\endcsname + \csname#1\endcsname +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\renewcommand{\over}{\primfrac{over}} +\renewcommand{\atop}{\primfrac{atop}} +\renewcommand{\above}{\primfrac{above}} +\renewcommand{\overwithdelims}{\primfrac{overwithdelims}} +\renewcommand{\atopwithdelims}{\primfrac{atopwithdelims}} +\renewcommand{\abovewithdelims}{\primfrac{abovewithdelims}} +% \end{macrocode} +% +% \cn{frac} calls \cn{@@over} directly instead of via \cn{genfrac}, for +% better speed because it is so common. \cn{tfrac} and \cn{dfrac} are +% abbreviations for some commonly needed mathstyle overrides. To +% conserve csnames we avoid making \cn{dfrac} and \cn{tfrac} robust +% (\cn{genfrac} is itself robust). +% \begin{macrocode} +\DeclareRobustCommand{\frac}[2]{{\begingroup#1\endgroup\@@over#2}} +\newcommand{\dfrac}{\genfrac{}{}{}0} +\newcommand{\tfrac}{\genfrac{}{}{}1} +% \end{macrocode} +% The \cn{binom} command for binomial notation works like \cn{frac} +% and has similar variants. Note that we do not use \cs{z@} in +% \cn{dbinom} and \cn{tbinom} because they are not top-level robust +% like \cn{binom}, and so the \cs{z@} with the potentially +% problematic \qc{\@} character would become visible when writing one +% of those commands to a \fn{.toc} file. +% \begin{macrocode} +\DeclareRobustCommand{\binom}{\genfrac()\z@{}} +\newcommand{\dbinom}{\genfrac(){0pt}0} +\newcommand{\tbinom}{\genfrac(){0pt}1} +% \end{macrocode} +% +% \begin{macro}{\genfrac} +% \changes{v2.16a}{2016/11/05}{New genfrac implementation for extended +% TeXs} +% This command provides access to \tex/'s generalized fraction +% primitives. Args: \arg{1} left delim, \arg{2} right delim, \arg{3} +% line thickness, \arg{4} mathstyle override, \arg{5} numerator, +% \arg{6} denominator. But we only read the first four args at first, +% in order to give us a moment to select the proper generalized +% fraction primitive. Any of those four args could be empty, and when +% empty the obvious defaults are selected (no delimiters, default +% line thickness (normally .4pt), and no mathstyle override). +% +% the |withdelims| primitives do not work in xetex with OpenType +% fonts, and the relevant font dimen parameters are often not set +% in luatex as theer are no matching values in the OpenType Math +% table, so here we use variants that use the font parameters if +% they are set, but scale using |\left\right| rather than the +% |withdelims| primitives. +% +% \begin{macrocode} +\ifx\directlua\@undefined +% \end{macrocode} +% +% \begin{macrocode} +\ifx\XeTeXcharclass\@undefined +% \end{macrocode} +% Classic version +% \begin{macrocode} +\DeclareRobustCommand{\genfrac}[4]{% + \def\@tempa{#1#2}% + \edef\@tempb{\@nx\@genfrac\@mathstyle{#4}% + \csname @@\ifx @#3@over\else above\fi + \ifx\@tempa\@empty \else withdelims\fi\endcsname} + \@tempb{#1#2#3}} +% \end{macrocode} +% +% \begin{macrocode} +\else +% \end{macrocode} +% XeTeX version +% \begin{macrocode} +\def\genfrac@rule#1#2#3#4{% +\hbox{$\left#1\vcenter{\hrule \@width\z@ + \@height + \ifdim\fontdimen#2#3\tw@=\z@ + #4\fontdimen6#3\tw@ + \else + \fontdimen#2#3\tw@ + \fi + }\right.$}} +% \end{macrocode} +% +% \begin{macrocode} +\def\genfrac@choice#1#2{% +\ifx @#2@\else +% \end{macrocode} +% \changes{v2.17a}{2017/09/02}{move \cs{nulldelimiterspace} correction} +% \begin{macrocode} +\ifx c#1\kern-\nulldelimiterspace\fi +{\delimitershortfall\z@\delimiterfactor\@m + \mathsurround\z@\nulldelimiterspace\z@ +\mathchoice +{\genfrac@rule{#2}{20}\textfont{2.39}}% +{\genfrac@rule{#2}{21}\textfont{1}}% +{\genfrac@rule{#2}{21}\scriptfont{1.45}}% +{\genfrac@rule{#2}{21}\scriptscriptfont{1.35}}% +}% +\ifx o#1\kern-\nulldelimiterspace\fi +\fi +} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareRobustCommand{\genfrac}[6]{{% +\@mathstyle{#4}% +\genfrac@choice o{#1}% +{\begingroup#5\endgroup\ifx @#3@\@@over\else\@@above\fi#3\relax#6}% +\genfrac@choice c{#2}% +}} +% \end{macrocode} +% +% \begin{macrocode} +\fi +\else +% \end{macrocode} +% LuaTeX version +% \begin{macrocode} +\def\genfrac@rule#1#2#3{% +\hbox{$\left#1\vcenter{\hrule \@width\z@ + \@height + \ifdim\Umathfractiondelsize#2=\z@ + #3\fontdimen6#3\tw@ + \else + \Umathfractiondelsize#2% + \fi + }\right.$}} +% \end{macrocode} +% +% \begin{macrocode} +\def\genfrac@choice#1#2{% +\ifx @#2@\else +% \end{macrocode} +% \changes{v2.17a}{2017/09/02}{move \cs{nulldelimiterspace} correction} +% \begin{macrocode} +\ifx c#1\kern-\nulldelimiterspace\fi +{\delimitershortfall\z@\delimiterfactor\@m + \mathsurround\z@\nulldelimiterspace\z@ +\mathchoice +{\genfrac@rule{#2}\displaystyle{2.39}}% +{\genfrac@rule{#2}\textstyle{1}}% +{\genfrac@rule{#2}\scriptstyle{1.45}}% +{\genfrac@rule{#2}\scriptscriptstyle{1.35}}% +}% +\ifx o#1\kern-\nulldelimiterspace\fi +\fi +} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareRobustCommand{\genfrac}[6]{{% +\@mathstyle{#4}% +\genfrac@choice o{#1}% +{\begingroup#5\endgroup\ifx @#3@\@@over\else\@@above\fi#3\relax#6}% +\genfrac@choice c{#2}% +}} +% \end{macrocode} +% +% \begin{macrocode} +\fi +% \end{macrocode} +% +% End of test for Lua\TeX/Xe\TeX. +% +% \cs{@genfrac} takes the preceding arguments and reads the +% numerator and denominator. Note that there's no convenient way to +% make the numerator and denominator \emph{contents} +% displaystyle, through this interface. +% +% Args: \arg{1} mathstyle, \arg{2} fraction primitive, +% \arg{3} delimiters and rule thickness, +% \arg{4} numerator, \arg{5} denominator. +% \begin{macrocode} +\def\@genfrac#1#2#3#4#5{{#1{\begingroup#4\endgroup#2#3\relax#5}}} +% \end{macrocode} +% \end{macro} +% +% Empty mathstyle arg: no change; 0 = displaystyle, 1 = textstyle, 2 +% = scriptstyle, 3 = scriptscriptstyle. +% \begin{macrocode} +\def\@mathstyle#1{% + \ifx\@empty#1\@empty\relax + \else\ifcase#1\displaystyle % case 0 + \or\textstyle\or\scriptstyle\else\scriptscriptstyle\fi\fi} +% \end{macrocode} +% +% \subsection{Sums and Integrals} +% Default value for sum limits is \cs{displaylimits}, see option +% `nosumlimits'. +% +% We redefine all the cumulative operator symbols to use +% \cs{slimits@} so that switching between \cs{displaylimits} and +% \cs{nolimits} can be controlled by package options. Also add +% \cs{DOTSB} for the benefit of the dots lookahead. But we'd better +% make sure \cn{coprod} and the others are simple mathchars; if not, +% the attempted changes will probably fail miserably. +% +% \changes{v2.15}{2016/02/20}{Accept \cs{Umathchar}} +% \begin{macrocode} +\begingroup +% \end{macrocode} +% \begin{macrocode} +\edef\@tempa{\string\mathchar"} +\edef\@tempd{\string\Umathchar"} +\def\@tempb#1"#2\@nil{#1"} +\edef\@tempc{\expandafter\@tempb\meaning\coprod "\@nil} +\ifx\@tempc\@tempd\let\@tempc\@tempa\fi +% \end{macrocode} +% \begin{macrocode} +\ifx\@tempa\@tempc + \global\let\coprod@\coprod + \gdef\coprod{\DOTSB\coprod@\slimits@} + \global\let\bigvee@\bigvee + \gdef\bigvee{\DOTSB\bigvee@\slimits@} + \global\let\bigwedge@\bigwedge + \gdef\bigwedge{\DOTSB\bigwedge@\slimits@} + \global\let\biguplus@\biguplus + \gdef\biguplus{\DOTSB\biguplus@\slimits@} + \global\let\bigcap@\bigcap + \gdef\bigcap{\DOTSB\bigcap@\slimits@} + \global\let\bigcup@\bigcup + \gdef\bigcup{\DOTSB\bigcup@\slimits@} + \global\let\prod@\prod + \gdef\prod{\DOTSB\prod@\slimits@} + \global\let\sum@\sum + \gdef\sum{\DOTSB\sum@\slimits@} + \global\let\bigotimes@\bigotimes + \gdef\bigotimes{\DOTSB\bigotimes@\slimits@} + \global\let\bigoplus@\bigoplus + \gdef\bigoplus{\DOTSB\bigoplus@\slimits@} + \global\let\bigodot@\bigodot + \gdef\bigodot{\DOTSB\bigodot@\slimits@} + \global\let\bigsqcup@\bigsqcup + \gdef\bigsqcup{\DOTSB\bigsqcup@\slimits@} +\fi +\endgroup +% \end{macrocode} +% +% \subsection{Roots and radicals} +% +% \begin{macro}{\root} +% This root stuff needs syntax work and implementation work. Surely +% something more compact can be done?? [mjd, 1994/09/05] +% \begin{macrocode} +\newcommand{\leftroot}{\@amsmath@err{\Invalid@@\leftroot}\@eha} +\newcommand{\uproot}{\@amsmath@err{\Invalid@@\uproot}\@eha} +\newcount\uproot@ +\newcount\leftroot@ +\renewcommand{\root}{\relaxnext@ + \DN@{\ifx\@let@token\uproot\let\next@\nextii@\else + \ifx\@let@token\leftroot\let\next@\nextiii@\else + \let\next@\plainroot@\fi\fi\next@}% + \def\nextii@\uproot##1{\uproot@##1\relax\FN@\nextiv@}% + \def\nextiv@{\ifx\@let@token\@sptoken\DN@. {\FN@\nextv@}\else + \DN@.{\FN@\nextv@}\fi\next@.}% + \def\nextv@{\ifx\@let@token\leftroot\let\next@\nextvi@\else + \let\next@\plainroot@\fi\next@}% + \def\nextvi@\leftroot##1{\leftroot@##1\relax\plainroot@}% + \def\nextiii@\leftroot##1{\leftroot@##1\relax\FN@\nextvii@}% + \def\nextvii@{\ifx\@let@token\@sptoken + \DN@. {\FN@\nextviii@}\else + \DN@.{\FN@\nextviii@}\fi\next@.}% + \def\nextviii@{\ifx\@let@token\uproot\let\next@\nextix@\else + \let\next@\plainroot@\fi\next@}% + \def\nextix@\uproot##1{\uproot@##1\relax\plainroot@}% + \bgroup\uproot@\z@\leftroot@\z@\FN@\next@} +\def\plainroot@#1\of#2{\setbox\rootbox\hbox{% + $\m@th\scriptscriptstyle{#1}$}% + \mathchoice{\r@@t\displaystyle{#2}}{\r@@t\textstyle{#2}} + {\r@@t\scriptstyle{#2}}{\r@@t\scriptscriptstyle{#2}}\egroup} +% \end{macrocode} +% \end{macro} +% +% \changes{v2.0}{1999/06/17}{Normalize @@sqrt to sqrtsign} + +% Name change from \cs{@@sqrt} to \cs{sqrtsign} happened in the +% 1995/12/01 release of \latex/. If we were to assume that +% \cs{sqrtsign} is defined then someone with the 1995/06/01 release +% of \latex/ would have trouble using this package. +% \begin{macrocode} +\@ifundefined{sqrtsign}{\let\sqrtsign\@@sqrt}{} +\def\r@@t#1#2{\setboxz@h{$\m@th#1\sqrtsign{#2}$}% + \dimen@\ht\z@\advance\dimen@-\dp\z@ + \setbox\@ne\hbox{$\m@th#1\mskip\uproot@ mu$}% + \advance\dimen@ by1.667\wd\@ne + \mkern-\leftroot@ mu\mkern5mu\raise.6\dimen@\copy\rootbox + \mkern-10mu\mkern\leftroot@ mu\boxz@} +% \end{macrocode} +% +% \subsection{Et cetera} +% +% \changes{v2.0}{1999/06/18}{Leave Greek cap letters unaltered} +% +% Specific names for the variant italic cap Greek letters are not +% defined by \latex/. If no preceding package defined these, we will +% define them now. +% \begin{macrocode} +\@ifundefined{varGamma}{% + \DeclareMathSymbol{\varGamma}{\mathord}{letters}{"00} + \DeclareMathSymbol{\varDelta}{\mathord}{letters}{"01} + \DeclareMathSymbol{\varTheta}{\mathord}{letters}{"02} + \DeclareMathSymbol{\varLambda}{\mathord}{letters}{"03} + \DeclareMathSymbol{\varXi}{\mathord}{letters}{"04} + \DeclareMathSymbol{\varPi}{\mathord}{letters}{"05} + \DeclareMathSymbol{\varSigma}{\mathord}{letters}{"06} + \DeclareMathSymbol{\varUpsilon}{\mathord}{letters}{"07} + \DeclareMathSymbol{\varPhi}{\mathord}{letters}{"08} + \DeclareMathSymbol{\varPsi}{\mathord}{letters}{"09} + \DeclareMathSymbol{\varOmega}{\mathord}{letters}{"0A} +}{} +% \end{macrocode} +% +% \begin{macro}{\overline} +% \amstex/ redefines \cn{overline} as shown here, for reasons that +% are probably less important in \latex/: Make it read its argument +% as a macro argument rather than a ``math field'' (\emph{The +% \tex/book}, Chapter 26), to avoid problems when something that is +% apparently a single symbol is actually a non-simple macro (e.g., +% \cn{dag}) \emph{and} is given as a single-token argument without +% enclosing braces. +% \begin{macrocode} +\@saveprimitive\overline\@@overline +\DeclareRobustCommand{\overline}[1]{\@@overline{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\boxed} +% The \cs{boxed} command is specifically intended to put a box around +% an equation or piece of an equation. (Not including the equation +% number.) This isn't trivial for end-users to do it properly +% with \cs{fbox} so we provide a command for them. +% \begin{macrocode} +\newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\implies} +% \begin{macro}{\impliedby} +% \begin{macrocode} +\newcommand{\implies}{\DOTSB\;\Longrightarrow\;} +\newcommand{\impliedby}{\DOTSB\;\Longleftarrow\;} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\And} +% \begin{macrocode} +\def\And{\DOTSB\;\mathchar"3026 \;} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nobreakdash} +% The command \cn{nobreakdash} is designed only for use before a +% hyphen or dash (|-|, |--|, or |---|). +% Setting the hyphen in a box and then unboxing it means that the +% normal penalty will not be added after it---and if the penalty is +% not there a break will not be taken (unless an explicit penalty +% or glue follows, thus the final \verb=\nobreak=). +% \begin{macrocode} +\newcommand{\nobreakdash}{\leavevmode + \toks@\@emptytoks \def\@tempa##1{\toks@\@xp{\the\toks@-}\FN@\next@}% + \DN@{\ifx\@let@token-\@xp\@tempa + \else\setboxz@h{\the\toks@\nobreak}\unhbox\z@\fi}% + \FN@\next@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\colon} +% \cs{colon} is for a colon in math that resembles a text colon: +% small space on the left, larger space on the right. The \qc{\:} +% character by itself is treated as a \cs{mathrel} i.e. large, equal +% spacing on both sides. +% \begin{macrocode} +\renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript + \mkern-\thinmuskip{:}\mskip6muplus1mu\relax} +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Ellipsis dots} +% +% We can't use \cs{newif} for \cs{ifgtest@} because we want +% to include \cs{global} in the definitions of +% \cs{gtest@true} and \cs{gtest@false}. +% \begin{macrocode} +\let\ifgtest@\iffalse % initial value +\def\gtest@true{\global\let\ifgtest@\iftrue} +\def\gtest@false{\global\let\ifgtest@\iffalse} +\let\DOTSI\relax +\let\DOTSB\relax +\let\DOTSX\relax +{\uccode`7=`\\ \uccode`8=`m \uccode`9=`a \uccode`0=`t \uccode`!=`h + \uppercase{% + \gdef\math@#1#2#3#4#5#6\math@{\gtest@false\ifx 7#1\ifx 8#2% + \ifx 9#3\ifx 0#4\ifx !#5\xdef\meaning@{#6}\gtest@true + \fi\fi\fi\fi\fi}}} +{\uccode`7=`c \uccode`8=`h \uccode`9=`\" + \uppercase{\gdef\mathch@#1#2#3#4#5#6\mathch@{\gtest@false + \ifx 7#1\ifx 8#2\ifx 9#5\gtest@true\xdef\meaning@{9#6}\fi\fi\fi}}} +% \end{macrocode} +% \changes{v2.15}{2016/02/20}{Accept \cs{Umathchar}} +% \begin{macrocode} +{\uccode`(=`U \uccode`)=`m + \uppercase{\gdef\Umathch@#1#2#3#4"#5"#6\Umathch@{\gtest@false + \ifx(#2\ifx)#3\gtest@true + \ifcase"#5 \or\or\gdef\thedots@{\dotsb@}\or\gdef\thedots@{\dotsb@}\fi + \fi\fi + }}} +% \end{macrocode} +% \changes{v2.15}{2016/02/20}{Decode the mathcode of character tokens for Unicode TeX} +% For Unicode TeXs, if the next token is a character token look up the (U)mathcode. Do not do this for classic TeX for compatibility reasons. +% \begin{macrocode} +\ifx\Umathcharnumdef\@undefined +\gdef\thecharacter@#1\thecharacter@{} +\else +{\uccode`(=`t \uccode`)=`c + \uppercase{\gdef\thecharacter@#1#2#3#4#5\thecharacter@{% + \ifx(#1\ifx)#4% + \@xp\getmathcode@\meaning@\getmathcode@ + \fi\fi +}}} +\def\getmathcode@#1 #2 #3#4\getmathcode@{% + \Umathcharnumdef\@tempa\Umathcodenum`#3\relax + \edef\meaning@{\meaning\@tempa}% + \@xp\Umathch@\meaning@\Umathch@ +} +\fi +% \end{macrocode} +% \begin{macrocode} +\newcount\classnum@ +\def\getmathch@#1.#2\getmathch@{\classnum@#1 \divide\classnum@4096 + \ifcase\number\classnum@\or\or\gdef\thedots@{\dotsb@}\or + \gdef\thedots@{\dotsb@}\fi} +{\uccode`4=`b \uccode`5=`i \uccode`6=`n + \uppercase{\gdef\mathbin@#1#2#3{\relaxnext@ + \def\nextii@##1\mathbin@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\mathbin@{}% + \ifx 4#1\ifx 5#2\ifx 6#3\DN@{\FN@\nextii@}\fi\fi\fi\next@}}} +{\uccode`4=`r \uccode`5=`e \uccode`6=`l + \uppercase{\gdef\mathrel@#1#2#3{\relaxnext@ + \def\nextii@##1\mathrel@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\mathrel@{}% + \ifx 4#1\ifx 5#2\ifx 6#3\DN@{\FN@\nextii@}\fi\fi\fi\next@}}} +{\uccode`5=`m \uccode`6=`a \uccode`7=`c + \uppercase{\gdef\macro@#1#2#3#4\macro@{\gtest@false + \ifx 5#1\ifx 6#2\ifx 7#3\gtest@true + \xdef\meaning@{\macro@@#4\macro@@}\fi\fi\fi}}} +\def\macro@@#1->#2\macro@@{#2} +\newcount\DOTSCASE@ +{\uccode`6=`\\ \uccode`7=`D \uccode`8=`O \uccode`9=`T \uccode`0=`S + \uppercase{\gdef\DOTS@#1#2#3#4#5{\gtest@false\DN@##1\DOTS@{}% + \ifx 6#1\ifx 7#2\ifx 8#3\ifx 9#4\ifx 0#5\let\next@\DOTS@@ + \fi\fi\fi\fi\fi + \next@}}} +{\uccode`3=`B \uccode`4=`I \uccode`5=`X + \uppercase{\gdef\DOTS@@#1{\relaxnext@ + \def\nextii@##1\DOTS@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \DN@{\FN@\nextii@}% + \ifx 3#1\global\DOTSCASE@\z@\else + \ifx 4#1\global\DOTSCASE@\@ne\else + \ifx 5#1\global\DOTSCASE@\tw@\else\DN@##1\DOTS@{}% + \fi\fi\fi\next@}}} +{\uccode`5=`\\ \uccode`6=`n \uccode`7=`o \uccode`8=`t + \uppercase{\gdef\not@#1#2#3#4{\relaxnext@ + \def\nextii@##1\not@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\not@{}% + \ifx 5#1\ifx 6#2\ifx 7#3\ifx 8#4\DN@{\FN@\nextii@}\fi\fi\fi + \fi\next@}}} +% \end{macrocode} +% \changes{v2.15}{2016/02/20}{macro added to strip \cs{long} during tests} +% \begin{macrocode} +{\uccode`9=`\l % + \uppercase{\gdef\striplong@#1#2#3\relax{% + \ifx9#2 \@xp\@xp\@xp\zap@to@space\fi}}} +\def\zap@to@space#1 {} +% \end{macrocode} +% \begin{macrocode} +\def\keybin@{\gtest@true + \ifx\@let@token+\else\ifx\@let@token=\else + \ifx\@let@token<\else\ifx\@let@token>\else + \ifx\@let@token-\else\ifx\@let@token*\else\ifx\@let@token:\else + \gtest@false\fi\fi\fi\fi\fi\fi\fi} +% \end{macrocode} +% Patch to ensure \cs{@ldots} is defined. (Name changed to +% \cn{mathellipsis} in Dec 94 release of \latex/.) +% \begin{macrocode} +\@ifundefined{@ldots}{\def\@ldots{\mathellipsis}}{} +% \end{macrocode} +% \begin{macro}{\ldots} +% \begin{macro}{\dots} +% Reiterate the standard definition of \cs{ldots} to keep it from +% being clobbered by the redefinition of \cs{dots}. +% \begin{macrocode} +\DeclareRobustCommand{\ldots}{% + \ifmmode \mathellipsis \else \textellipsis \fi +} +\DeclareRobustCommand{\dots}{% + \ifmmode \@xp\mdots@\else \@xp\textellipsis \fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\def\tdots@{\leavevmode\unskip\relaxnext@ + \DN@{$\m@th\@ldots\, + \ifx\@let@token,\,$\else\ifx\@let@token.\,$\else + \ifx\@let@token;\,$\else\ifx\@let@token:\,$\else + \ifx\@let@token?\,$\else\ifx\@let@token!\,$\else + $ \fi\fi\fi\fi\fi\fi}% + \ \FN@\next@} +\def\mdots@{\FN@\mdots@@} +% \end{macrocode} +% \changes{v2.15}{2016/02/20}{Indent \cs{mdots@@} for readability and add additional tests} +% \begin{macrocode} +\def\mdots@@{\gdef\thedots@{\dotso@}% + \ifx\@let@token\boldsymbol + \gdef\thedots@\boldsymbol{\boldsymboldots@}% + \else + \ifx,\@let@token \gdef\thedots@{\dotsc}% + \else + \ifx\not\@let@token + \gdef\thedots@{\dotsb@}% + \else + \keybin@ + \ifgtest@ % if \keybin@ test + \gdef\thedots@{\dotsb@}% + \else +% \end{macrocode} +% \changes{v2.15d}{2016/06/28}{Add space token to prevent runaway argument error} +% \begin{macrocode} + \xdef\meaning@{\meaning\@let@token. .........}% +% \end{macrocode} +% In previous versions \verb|\long| macros were not seen by the lokkahead. +% That was bad as this file uses \verb|\(re)newcommand| for \verb|\implies| etc. +% \begin{macrocode} + \xdef\meaning@@{\@xp\striplong@\meaning@\relax\meaning@}% +% \end{macrocode} +% \begin{macrocode} + \@xp\math@\meaning@\math@ + \ifgtest@ % if \mathxxx test + \@xp\mathch@\meaning@\mathch@ + \ifgtest@ % if \mathchar + \@xp\getmathch@\meaning@\getmathch@ + \fi % end if \mathchar + \else % \not \mathxxx +% \end{macrocode} +% Test for \verb|\Umathchar| added. +% \begin{macrocode} + \@xp\Umathch@\meaning@"0"\Umathch@ + \ifgtest@ % if \Umathchar + \else % else not \Umathcar +% \end{macrocode} +% \begin{macrocode} + \@xp\macro@\meaning@@\macro@ + \ifgtest@ % if macro test + \@xp\not@\meaning@\not@ + \ifgtest@ % if macro starts \not test + \gdef\thedots@{\dotsb@}% + \else% else not \not + \@xp\DOTS@\meaning@\DOTS@ + \ifgtest@ % \if DOTS + \ifcase\number\DOTSCASE@ %ifcase dots + \gdef\thedots@{\dotsb@}% + \or\gdef\thedots@{\dotsi}\else + \fi % endifcase dots + \else % not macro starts \DOTS + \@xp\math@\meaning@\math@ + \ifgtest@ % \if macro starts \mathxxxx + \@xp\mathbin@\meaning@\mathbin@ + \ifgtest@ % if macro starts \mathbin + \gdef\thedots@{\dotsb@}% + \else % not macro starting \mathbin + \@xp\mathrel@\meaning@\mathrel@ + \ifgtest@ % if macro starts \mathrel + \gdef\thedots@{\dotsb@}% + \fi % endif macro starts \mathrel (no else) + \fi % endif macro starts \mathbin + \fi % endif macro starts with \mathxxx (no else) + \fi % endif macro starts \DOTS else + \fi % end macro starting \not \ifgtest@ test (no else) +% \end{macrocode} +% Additional test for a catcode 12 character. +% \begin{macrocode} + \else + \@xp\thecharacter@\meaning@\thecharacter@ +% \end{macrocode} +% \begin{macrocode} + \fi % end macro \ifgtest@ test (no else) + \fi % end if \Umathchar test + \fi % end \math@ \ifgtest@ + \fi % end \keybin@ \ifgtest@ test (no else) + \fi % end if \not (no else) + \fi % end if comma (no else) + \fi % end if boldsymbol (no else) + \thedots@} +% \end{macrocode} +% +% The \qc{\=} character is necessary in the two \cs{let} assignments +% in \cs{boldsymboldots@}, because the symbol we are making +% bold might be an \qc{\=} sign. +% \begin{macrocode} +\def\boldsymboldots@#1{% + \bold@true\let\@let@token=#1\let\delayed@=#1\mdots@@ + \boldsymbol#1\bold@false} +% \end{macrocode} +% +% The definition of \cs{@cdots} is merely the \fn{plain.tex} +% definition of \cs{cdots}. +% \begin{macrocode} +\ams@def\@cdots{\mathinner{\cdotp\cdotp\cdotp}} +\newcommand{\dotsi}{\!\@cdots} +\let\dotsb@\@cdots +% \end{macrocode} +% +% If any new right delimiters are defined, they would need to be +% added to the definition of \cs{rightdelim@} in order for \cn{dots} +% to work properly in all cases. +% \begin{macrocode} +\def\rightdelim@{\gtest@true + \ifx\@let@token)\else + \ifx\@let@token]\else + \ifx\@let@token\rbrack\else + \ifx\@let@token\}\else + \ifx\@let@token\rbrace\else + \ifx\@let@token\rangle\else + \ifx\@let@token\rceil\else + \ifx\@let@token\rfloor\else + \ifx\@let@token\rgroup\else + \ifx\@let@token\rmoustache\else + \ifx\@let@token\right\else + \ifx\@let@token\bigr\else + \ifx\@let@token\biggr\else + \ifx\@let@token\Bigr\else + \ifx\@let@token\Biggr\else\gtest@false + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} +\def\extra@{% + \rightdelim@\ifgtest@ + \else\ifx\@let@token$\gtest@true + \else\xdef\meaning@{\meaning\@let@token..........}% + \@xp\macro@\meaning@\macro@\ifgtest@ + \@xp\DOTS@\meaning@\DOTS@ + \ifgtest@ + \ifnum\DOTSCASE@=\tw@\gtest@true\else\gtest@false + \fi\fi\fi\fi\fi} +\newif\ifbold@ +\def\dotso@{\relaxnext@ + \ifbold@ + \let\@let@token\delayed@ + \def\nextii@{\extra@\@ldots\ifgtest@\,\fi}% + \else + \def\nextii@{\DN@{\extra@\@ldots\ifgtest@\,\fi}\FN@\next@}% + \fi + \nextii@} +% \end{macrocode} +% Why not save some tokens? (space vs. time). +% \begin{macrocode} +\def\extrap@#1{% + \DN@{#1\,}% + \ifx\@let@token,\else + \ifx\@let@token;\else + \ifx\@let@token.\else\extra@ + \ifgtest@\else + \let\next@#1\fi\fi\fi\fi\next@} +% \end{macrocode} +% +% \begin{macro}{\cdots} +% \begin{macro}{\dotsb} +% \begin{macro}{\dotsm} +% \begin{macro}{\dotso} +% \begin{macro}{\dotsc} +% The \cn{cdots} command. +% \begin{macrocode} +\ams@DeclareRobustCommand{\cdots}{\DN@{\extrap@\@cdots}\FN@\next@} +\let\dotsb\cdots +\let\dotsm\cdots +\DeclareRobustCommand{\dotso}{\relax + \ifmmode \DN@{\extrap@\@ldots}% + \else \let\next@\tdots@\fi + \FN@\next@} +\DeclareRobustCommand{\dotsc}{% + \DN@{\ifx\@let@token;\@ldots\,% + \else \ifx\@let@token.\@ldots\,% + \else \extra@\@ldots \ifgtest@\,\fi + \fi\fi}% + \FN@\next@} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\longrightarrow} +% \begin{macro}{\Longrightarrow} +% \begin{macro}{\longleftarrow} +% \begin{macro}{\Longleftarrow} +% \begin{macro}{\longleftrightarrow} +% \begin{macro}{\Longleftrightarrow} +% \begin{macro}{\mapsto} +% \begin{macro}{\longmapsto} +% \begin{macro}{\hookrightarrow} +% \begin{macro}{\hookleftarrow} +% \begin{macro}{\iff} +% Various arrows. +% \begin{macrocode} +\renewcommand{\longrightarrow}{% + \DOTSB\protect\relbar\protect\joinrel\rightarrow} +\renewcommand{\Longrightarrow}{% + \DOTSB\protect\Relbar\protect\joinrel\Rightarrow} +\renewcommand{\longleftarrow}{% + \DOTSB\leftarrow\protect\joinrel\protect\relbar} +\renewcommand{\Longleftarrow}{% + \DOTSB\Leftarrow\protect\joinrel\protect\Relbar} +\renewcommand{\longleftrightarrow}{\DOTSB\leftarrow\joinrel\rightarrow} +\renewcommand{\Longleftrightarrow}{\DOTSB\Leftarrow\joinrel\Rightarrow} +\renewcommand{\mapsto}{\DOTSB\mapstochar\rightarrow} +\renewcommand{\longmapsto}{\DOTSB\mapstochar\longrightarrow} +\renewcommand{\hookrightarrow}{\DOTSB\lhook\joinrel\rightarrow} +\renewcommand{\hookleftarrow}{\DOTSB\leftarrow\joinrel\rhook} +\renewcommand{\iff}{\DOTSB\;\Longleftrightarrow\;} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\doteq} +% The \cn{doteq} command formerly used \cs{buildrel}; we avoid that +% because it requires `\cn{over}' as part of its syntax. Use 0pt +% instead of \cs{z@} for robustitude. +% \begin{macrocode} +\renewcommand{\doteq}{% + \DOTSB\mathrel{\mathop{\kern0pt =}\limits^{\textstyle.}}} +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Integral signs} +% +% \begin{macro}{\if@display} +% The straightforward \cs{ifinner} test to see if the current math +% context is non-display, fails if, for instance, we are typesetting +% a multiline display within an \cs{halign}, with the pieces going +% into constructions like +% \begin{verbatim} +% $\displaystyle...$ +% \end{verbatim} +% So we need a better test to find out if we are `in a display'. We +% therefore create \cs{if@display}. +% +% \begin{macrocode} +\newif\if@display +\everydisplay\@xp{\the\everydisplay \@displaytrue} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\int} +% \begin{macro}{\oint} +% \begin{macro}{\iint} +% \begin{macro}{\iiint} +% \begin{macro}{\iiiint} +% \begin{macro}{\idotsint} +% Default value for integral limits is \cs{nolimits}, see the +% definition of the `nointlimits' option. +% \begin{macrocode} +\renewcommand{\int}{\DOTSI\intop\ilimits@} +\renewcommand{\oint}{\DOTSI\ointop\ilimits@} +\def\intkern@{\mkern-6mu\mathchoice{\mkern-3mu}{}{}{}} +\def\intdots@{\mathchoice{\@cdots}% + {{\cdotp}\mkern1.5mu{\cdotp}\mkern1.5mu{\cdotp}}% + {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}% + {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}} +% +\ams@newcommand{\iint}{\DOTSI\protect\MultiIntegral{2}} +\ams@newcommand{\iiint}{\DOTSI\protect\MultiIntegral{3}} +\ams@newcommand{\iiiint}{\DOTSI\protect\MultiIntegral{4}} +\newcommand{\idotsint}{\DOTSI\protect\MultiIntegral{0}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\MultiIntegral} +% If the \cs{limits} option is applied, use \cs{mathop} and fudge +% the left-hand space a bit to make the subscript visually centered. +% +% \verb'#1' is the multiplicity. +% \begin{macrocode} +\newcommand{\MultiIntegral}[1]{% + \edef\ints@c{\noexpand\intop + \ifnum#1=\z@\noexpand\intdots@\else\noexpand\intkern@\fi + \ifnum#1>\tw@\noexpand\intop\noexpand\intkern@\fi + \ifnum#1>\thr@@\noexpand\intop\noexpand\intkern@\fi + \noexpand\intop + \noexpand\ilimits@ + }% + \futurelet\@let@token\ints@a +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\ints@a{% + \ifx\limits\@let@token \ints@b + \else \ifx\displaylimits\@let@token \ints@b + \else\ifx\ilimits@\displaylimits \ints@b + \fi\fi\fi + \ints@c +} +% \end{macrocode} +% +% \begin{macrocode} +\def\ints@b{% + \mkern-7mu\mathchoice{\mkern-2mu}{}{}{}% + \mathop\bgroup + \mkern7mu\mathchoice{\mkern2mu}{}{}{}% + \let\ilimits@\egroup +}% +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Size dependent definitions} +% +% We now define all stuff which has to change whenever a new math +% size is to be activated. \latex/ provides a hook called +% |\every@math@size| to support such a need. All assignments in the +% |\every@math@size| hook that need to take outside effect should be +% global. +% +% \subsection{Struts for math} +% +% The various kinds of struts could use some analysis and perhaps +% consolidation. +% +% For example perhaps the \cn{bBigg} delimiters could use +% \begin{verbatim} +% 1.2\ht\strutbox (1.8, 2.4, 3.0) +% \end{verbatim} +% instead of +% \begin{verbatim} +% 1.0\big@size (1.5, 2.0, 2.5) +% \end{verbatim} +% since \cs{strut} is reset with every size change [mjd, 1994/10/07]. +% But this change would introduce the possibility of changed line +% and page breaks in existing documents, so would need to be +% handled with care. +% +% \begin{macro}{\Mathstrut@} +% \begin{macro}{\Mathstrutbox@} +% \begin{macro}{\resetMathstrut@} +% Here comes the code for Spivak's |\Mathstrut@|. +% \begin{macrocode} +\newbox\Mathstrutbox@ +\setbox\Mathstrutbox@=\hbox{} +\def\Mathstrut@{\copy\Mathstrutbox@} +% \end{macrocode} +% The setting of the height and depth of the |\Mathstrutbox@| is done +% in the |\every@math@size| hook since it depends on the height of a +% paren. As \cs{every@math@size} is triggered by |$| after a font +% size change, we want to avoid using another math formula |$...$| to +% measure the math paren height; instead we go through the mathcode +% of the \qc{\(} character. We assume that the mathcode has a leading +% hex digit 4 indicating `open delimiter'; this allows us to make a +% relatively simple function to get the correct font and character +% position. +% +% \changes{v2.15}{2016/02/20}{Modify \cs{resetMathstrut@} for Unicode \TeX} +% \changes{v2.15b}{2016/03/10}{Modify \cs{resetMathstrut@} for classic \TeX\ to preserve box 0} +% Original code assuming |\mathcode| is kept for 8bit \TeX. Unicode \TeX{} +% uses |\Umathcharnumdef| which works for xetex and luatex, which use +% different forms for |\mathchardef|. (New luatex always reports +% definitions using |\Umathchardef| syntax even if |\mathchardef| used.) +% +% The unicode version uses e-tex |\fontcharht| to avoid boxing which +% could also be done for pdftex, but not done here. +% \begin{macrocode} +\ifx\Umathcharnumdef\@undefined +% \end{macrocode} +% Original code +% \begin{macrocode} +\def\resetMathstrut@{% + \begingroup + \setbox\z@\hbox{% + \mathchardef\@tempa\mathcode`\(\relax + \def\@tempb##1"##2##3{\the\textfont"##3\char"}% + \expandafter\@tempb\meaning\@tempa \relax + }% + \edef\@tempa{% + \ht\Mathstrutbox@\the\ht\z@\relax + \dp\Mathstrutbox@\the\dp\z@\relax}% + \expandafter\endgroup\@tempa +} +\else +% \end{macrocode} +% xetex/luatex version +% \changes{v2.15a}{2016/03/03}{missing percent added} +% \begin{macrocode} +\def\resetMathstrut@{% + \begingroup + \Umathcharnumdef\@tempa\Umathcodenum`\(\relax + \def\@tempb##1"##2"##3"##4\relax{% + \endgroup + \ht\Mathstrutbox@=\fontcharht\textfont"##3 "##4\relax + \dp\Mathstrutbox@=\fontchardp\textfont"##3 "##4\relax}% + \expandafter\@tempb\meaning\@tempa \relax +} +% \end{macrocode} +% \begin{macrocode} +\fi +% \end{macrocode} +% These height and depth assignments are implicitly global. +% \begin{macrocode} +\addto@hook\every@math@size{\resetMathstrut@} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\strut@} +% \begin{macro}{\strutbox@} +% Next follows a special internal strut which is supposed to match +% the height and the depth of a normal |\strut| minus +% |\normallineskiplimit| according to M. Spivak. +% +% This should really go into the definition of \cs{size@update}, and +% then the box reset could be local; but \cs{size@update} doesn't +% have any hook and is handled in such a way that it cannot even be +% changed except by changing \cs{set@fontsize}. So instead we put +% \cs{reset@strutbox@} into \cs{every@math@size} and make it global. +% Then because of some complications in the way \cs{glb@settings} and +% \cs{check@mathfonts} work, we have to re-invoke it at the beginning +% of every environment that might use \cs{strut@}. Fortunately this +% can be achieved (more or less) through the \cs{spread@equation} +% hook. [mjd,2000/03/10] +% \begin{macrocode} +\newbox\strutbox@ +\def\strut@{\copy\strutbox@} +\def\reset@strutbox@{% + \global\setbox\strutbox@\hbox{% + \lower.5\normallineskiplimit + \vbox{\kern-\normallineskiplimit\copy\strutbox}}} +\addto@hook\every@math@size{\reset@strutbox@} +\AtBeginDocument{\reset@strutbox@} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Big delimiters} +% +% We are now going to redefine the plain \tex/ commands \cn{big}, +% \cn{bigl}, etc., to produce different results in different sizes. +% Actually we only have to define \cn{big}, \cn{Big}, etc., since +% they are used to construct the directional versions \cn{bigl}, +% \cn{bigr}, and the rest. +% +% \begin{macro}{\big} +% \begin{macro}{\Big} +% \begin{macro}{\bigg} +% \begin{macro}{\Bigg} +% To save token space we put everything into the common macro +% |\bBigg@|. The macros are now simply a call to |\bBigg@| with a +% factor to determine the correct height of the delimiter as an +% argument. This code should better go into a future version of +% the \latex/ kernel; the macro |\n@space| is then superfluous (since +% it is only used once) and should be removed to avoid wasting hash +% table space unnecessarily. +% \begin{macrocode} +\renewcommand{\big}{\bBigg@\@ne} +\renewcommand{\Big}{\bBigg@{1.5}} +\renewcommand{\bigg}{\bBigg@\tw@} +\renewcommand{\Bigg}{\bBigg@{2.5}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bBigg@} +% Now we tackle the macro which has to do the real work. It +% actually has two arguments, the factor and the wanted delimiter. +% \changes{v2.17b}{2018/12/01}{Start LR-mode for \cs{bigl} and +% friends if necessary (github/49)} +% \begin{macrocode} +\ifx\leavevmode@ifvmode\@undefined +\def\bBigg@#1#2{% +% \end{macrocode} +% We start with an extra set of braces because we want +% constructions like |\def\bigl{\mathopen\big}| to work without the +% overhead of extra arguments. +% \begin{macrocode} + {\@mathmeasure\z@{\nulldelimiterspace\z@}% + {\left#2\vcenter to#1\big@size{}\right.}% + \box\z@}} +\else +\def\bBigg@#1#2{\leavevmode@ifvmode + {\@mathmeasure\z@{\nulldelimiterspace\z@}% + {\left#2\vcenter to#1\big@size{}\right.}% + \box\z@}} +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\big@size} +% |\big@size| needs to be set to 1.2 times the height of a math +% paren. This height is already recorded in |\Mathstrutbox@|. +% \begin{macrocode} +\addto@hook\every@math@size{% + \global\big@size 1.2\ht\Mathstrutbox@ + \global\advance\big@size 1.2\dp\Mathstrutbox@ } +\newdimen\big@size +% \end{macrocode} +% \end{macro} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Math accents} +% +% We want to change the leading digit of math accents to be +% \cs{accentclass@} so that it can vary according to certain internal +% purposes. +% \begin{macrocode} +\def\accentclass@{7} +\def\noaccents@{\def\accentclass@{0}} +% \end{macrocode} +% +% There are a few \meta{math alphabet}s in the standard fonts where +% we have to change the extra macros because the standard definitions +% don't account for these accent problems. The first is for the +% \cs{mathit} command. +% \begin{macrocode} +\DeclareFontEncoding{OML}{}{\noaccents@} +% \end{macrocode} +% The next one corrects the \cs{cal} alphabet. +% \begin{macrocode} +\DeclareFontEncoding{OMS}{}{\noaccents@} +% \end{macrocode} +% +% \begin{macro}{\dddot} +% \begin{macro}{\ddddot} +% Triple and quadruple dot accents. +% \begin{macrocode} +\ams@newcommand{\dddot}[1]{% + {\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@ + \hbox{\normalfont ...}\vss}}}} +\ams@newcommand{\ddddot}[1]{% + {\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@ + \hbox{\normalfont....}\vss}}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% The following code deals with support for compound accents. +% By redefining \cs{set@mathaccent} we ensure that +% \cn{DeclareMathAccent} will define accent commands to run our +% \cs{mathaccentV} function instead of the primitive \cs{mathaccent}. +% \begin{macrocode} +\def\set@mathaccent#1#2#3#4{% + \xdef#2{\@nx\protect\@nx\mathaccentV + {\@xp\@gobble\string#2}\hexnumber@#1#4}% +} +% \end{macrocode} +% +% \begin{macro}{\hat} +% \begin{macro}{\check} +% \begin{macro}{\tilde} +% \begin{macro}{\acute} +% \begin{macro}{\grave} +% \begin{macro}{\dot} +% \begin{macro}{\ddot} +% \begin{macro}{\breve} +% \begin{macro}{\bar} +% \begin{macro}{\vec} +% \begin{macro}{\mathring} +% We redefine the standard math accent commands to +% call \cs{mathaccentV}, using the mathgroup/encoding-number +% information embedded in their previous definitions. If the +% definition of an accent command does not have the expected form, we +% leave the accent command alone, but give a warning. For widehat and +% widetilde, we need to avoid clobbering the definitions done by the +% \pkg{amsfonts} package. Arbitrating the contention between +% \pkg{amsmath} and \pkg{amsfonts} to allow doubling a widetilde +% accent looks tricky, so for the time being [mjd,1999/07/19] we just +% leave \cn{widehat} and \cn{widetilde} alone. As a result, if the +% \pkg{amsmath} package is loaded on top of a vanilla \latex/ +% documentclass, everything runs through with no warnings. If a +% Lucida Math or other math fonts package is loaded in addition to +% \pkg{amsmath}, there are greater difficulties, but those are +% addressed elsewhere. +% +% +% \changes{v2.15}{2016/02/20}{Detect \cs{Umathaccent} on package load} +% Adjust the test made at package load to recognise +% |\Umathaccent|. Although currently it is just used to give a +% modified warning that the accents will not be redefined. +% +% Note that the engines behave quite differently here, luatex +% even without these definitions using the OpenType accent set up by +% unicode-math stacks |\hat{hat{f}}| correctly but xetex acts like +% classic tex and needs this adjustment. This difference is not +% addressed here at all. +% +% This test is just at package loading and has no affect on the +% definitions used in 8bit TeX. +% \begin{macrocode} +%\def\@tempa#1{\@xp\@tempb\meaning#1\@nil#1} +% \end{macrocode} +% The extended definition below tests if the accent is already +% robust (as newer \LaTeX{} kernels do this by default) and if so +% picks up the robust definition. However, as of +% now it still redefines it to be non-robust. +% \begin{macrocode} +\def\@tempa#1{% + \@ifundefined{\@xp\@gobble\string#1\space}% + {\@xp\@tempb\meaning#1\@nil#1}% + {\@xp\@xp\@xp\@tempb\@xp\meaning + \csname\@xp\@gobble\string#1\space\endcsname\@nil#1}% +} +\def\@tempb#1>#2#3 #4\@nil#5{% + \@xp\ifx\csname#3\endcsname\mathaccent + \@tempc#4?"7777\@nil#5% + \else + \@xp\ifx\csname#3\endcsname\Umathaccent + \@tempd#4\@nil#5% + \else + \PackageWarningNoLine{amsmath}{% + Unable to redefine math accent \string#5}% + \fi\fi} +\def\@tempc#1"#2#3#4#5#6\@nil#7{% + \chardef\@tempd="#3\relax\set@mathaccent\@tempd{#7}{#2}{#4#5}} +\def\@tempd#1\@nil#2{% + \PackageWarningNoLine{amsmath}{% + Unable to redefine \string\Umathaccent\space\string#2}% +} +% \end{macrocode} +% \begin{macrocode} +\@tempa{\hat} +\@tempa{\check} +\@tempa{\tilde} +\@tempa{\acute} +\@tempa{\grave} +\@tempa{\dot} +\@tempa{\ddot} +\@tempa{\breve} +\@tempa{\bar} +\@tempa{\vec} +\@ifundefined{mathring}{% + \DeclareMathAccent{\mathring}{\mathalpha}{operators}{"17} +}{% + \@tempa{\mathring} +} +%%\@tempa\widetilde +%%\@tempa\widehat +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% Regression testing of amsmath 2.0 showed that in some documents +% there occurred fragments of the form +% \begin{verbatim} +% \hat\mathcal{G} +% \end{verbatim} +% This is not at all correct syntax for the argument of a \latex/ +% command but it produced the intended result anyway because of the +% internal syntax of the \cs{mathaccent} primitive. With +% \cs{mathaccentV}, it will yield an error message. We therefore do a +% special check for such syntax problems in order to make the error +% message more informative. (dmj: ??????) +% \begin{macrocode} +\newcommand{\acc@check}{} +\newcommand{\acc@error}{} +\def\acc@check{\@ifnextchar\@empty\relax\acc@error} +% \end{macrocode} +% We put most of the tokens in a separate macro so they do not get +% scanned unless they are actually needed. +% \begin{macrocode} +\def\acc@error{% + \@amsmath@err{% + Improper argument for math accent:\MessageBreak + Extra braces must be added to prevent wrong output% + }\@ehc +} +% \end{macrocode} +% +% For \cs{mathaccentV} part of the processing is dependent on the +% depth of nesting of math accent commands. We introduce a dedicated +% counter for this instead of using chardef because we want to +% increment/decrement it during processing, and incrementing a +% chardef integer is more work. +% \begin{macrocode} +\newcount\macc@depth +% \end{macrocode} +% +% Provide this function in case it is not already available. +% \begin{macrocode} +\long\def\@gobblethree#1#2#3{} +% \end{macrocode} +% +% The \cs{mathaccentV} function first counts the number of nested +% math accents by setting the argument in a throw-away box. (This is +% not as risky as such an operation would normally be because the +% argument is generally either a simple math symbol or a nested math +% accent call with a simple math symbol at the bottom of the +% nesting.) +% +% There are two benefits from counting the nesting levels first +% before doing anything else: (1) we can fall back to a simple +% \cs{mathaccent} call if the nesting depth is 1, and (2) if the +% nesting depth is greater than 1, we would like to be able to tell +% when we have reached the lowest level, because at that point we +% want to save the argument for later use and place an accent on top +% of a phantom copy. +% +% When we have multiple accents, they will be placed on top of the +% invisible box, followed by some suitable kerns, then a visible copy +% of the nucleus. To see why, let us look at what goes wrong with a +% double application of the \cs{mathaccent} primitive. The standard +% definition of \cs{hat} is \verb'\mathaccent"705E', so +% \verb'\hat{\hat{F}}' expands to +%\begin{verbatim} +%\mathaccent"705E{\mathaccent"705E{F}} +%\end{verbatim} +% The result of this operation is +%\begin{verbatim} +%\vbox(12.11111+0.0)x7.81946 +%.\hbox(6.94444+0.0)x0.0, shifted 1.40973 +%..\OT1/cmr/m/n/10 ^ +%.\kern-4.30554 +%.\vbox(9.47221+0.0)x7.81946 +%..\hbox(6.94444+0.0)x0.0, shifted 2.24309 +%...\OT1/cmr/m/n/10 ^ +%..\kern-4.30554 +%..\hbox(6.83331+0.0)x7.81946 +%...\OML/cmm/m/it/10 F +%\end{verbatim} +% \tex/ starts by constructing a vbox with the hat character on top +% of the F. Then it puts another hat character on top of the vbox; +% but without skew information, because that is only applied by +% \cs{mathaccent} when the base object is a simple symbol. So the +% first accent is skewed to the correct position but all later +% accents are not. By the way, the actual width of the F in the above +% example is less than 7.81946; the box in which it is packed was +% automatically lengthened by the width of the F's italic correction +% (without actually putting in a kern for it). +% +% To get the second accent shifted farther to the right we +% artificially increase the width of the innermost box and add +% a compensating kern afterward. Furthermore, to get proper placement +% of a following subscript or superscript, we take the base symbol +% out, leaving a phantom in its place, and print it by itself +% following the kern. We then need to increase the kern amount to +% move the base character backward under the accents again. +% Here is what the results look like: +%\begin{verbatim} +%\vbox(12.11111+0.0)x9.48618 +%.\hbox(6.94444+0.0)x0.0, shifted 2.24309 +%..\OT1/cmr/m/n/10 ^ +%.\kern-4.30554 +%.\vbox(9.47221+0.0)x9.48618 +%..\hbox(6.94444+0.0)x0.0, shifted 2.24309 +%...\OT1/cmr/m/n/10 ^ +%..\kern-4.30554 +%..\hbox(6.83331+0.0)x9.48618 +%...\hbox(6.83331+0.0)x7.81946 +%...\kern 1.66672 +%\kern -9.48618 +%\OML/cmm/m/it/10 F +%\end{verbatim} +% +% Much of this implementation is based on code from the \pkg{accents} +% package of Javier Bezos. I added the test to revert to a simple +% \cs{mathaccent} when accents are not nested, and some other +% refinements to reduce the number of kerns used (to conserve box +% memory) and the number of cycles through \cs{mathchoice} (to make +% things run a little faster). It was all rather difficult and my +% first two attempts had serious bugs but I hope and believe that +% this version will do better. [mjd,2000/03/15] +% +% The \qq{V} in \cs{mathaccentV} is just an indication that it takes +% five arguments. It is important that the name includes +% \texttt{mathaccent}, otherwise \cs{DeclareMathAccent} will balk at +% redefining one of our accent commands, for example when an +% alternative math font package is loaded. +% \begin{macrocode} +\def\mathaccentV#1#2#3#4#5{% + \ifmmode + \gdef\macc@tmp{\macc@depth\@ne}% + \setbox\z@\hbox{% + \let\mathaccentV\macc@test + \let\use@mathgroup\@gobbletwo \let\select@group\@gobblethree + \frozen@everymath{}$#5$% + }% + \macc@tmp + \ifnum\macc@depth=\@ne + \global\let\macc@nucleus\@empty + \mathaccent"\accentclass@ + \else + \@xp\macc@nested + \fi + #2#3#4{#5}% + \macc@nucleus + \else + \@xp\nonmatherr@\csname#1\endcsname + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def\macc@test#1#2#3#4{\xdef\macc@tmp{\macc@tmp\advance\macc@depth\@ne}} +% \end{macrocode} +% +% \begin{macrocode} +\def\macc@group{-1} +% \end{macrocode} +% +% \begin{macrocode} +\def\macc@nested#1#2#3#4{% + \begingroup + \let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar + \mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}% + \macc@set@skewchar\relax + \let\mathaccentV\macc@nested@a + \macc@nested@a\relax#1#2#3{#4}% + \endgroup +} +% \end{macrocode} +% +% \begin{macrocode} +\let\macc@palette\mathpalette +% \end{macrocode} +% +% \begin{macrocode} +\def\macc@nested@a#1#2#3#4#5{% +% \end{macrocode} +% This test saves some work that would otherwise be always repeated +% fourfold thanks to \cs{mathchoice}. +% \begin{macrocode} + \ifnum\macc@group=\mathgroup + \else \macc@set@skewchar\relax \edef\macc@group{\the\mathgroup}% + \fi + \mathchardef\macc@code "\accentclass@ #2#3#4\relax + \macc@palette\macc@a{#5}% +} +% \end{macrocode} +% +% The reason that \cs{macc@set@skewchar} takes an argument is so that +% it can serve as a direct substitute for \cs{math@egroup}, in +% addition to being used separately. +% +% Setting a skewchar with this method works for symbols of variable +% mathgroup (class 7, letters and numbers) but not necessarily for +% special symbols like \cn{partial} or \cs{xi} whose mathgroup +% doesn't change; fortunately the most commonly used ones come from +% mathgroup one, which is the fall-back mathgroup for skewchar. +% \begin{macrocode} +\def\macc@set@skewchar#1{% + \begingroup + \ifnum\mathgroup=\m@ne \let\@tempa\@ne + \else + \ifnum\skewchar\textfont\mathgroup=\m@ne \let\@tempa\@ne + \else \let\@tempa\mathgroup + \fi + \fi + \count@=\skewchar\textfont\@tempa + \advance\count@"7100 + \edef\@tempa{\endgroup + \mathchardef\noexpand\macc@skewchar=\number\count@\relax}% + \@tempa + #1% +} +% \end{macrocode} +% +% Arg1 is math-style, arg2 is accent base object. We assume that math +% style doesn't change within the nested group of accents; this means +% we can set \cs{macc@style} only once and redefine \cs{macc@palette} +% to use it, in order to run \cs{mathchoice} only once instead of +% multiplying the calls exponentially as the nesting level increases. +% \begin{macrocode} +\def\macc@a#1#2{% + \begingroup + \let\macc@style#1\relax + \def\macc@palette##1{##1\macc@style}% + \advance\macc@depth\m@ne + \ifnum\macc@depth=\z@ + \gdef\macc@nucleus{#2}% +% \end{macrocode} +% Extra \cs{@empty} tokens are to prevent low-level \tex/ errors from +% the potential syntactic error that \cs{acc@check} checks for. +% \begin{macrocode} + \setbox\z@\hbox{$#1#2\@empty{}\macc@skewchar$}% + \setbox\tw@\hbox{$#1#2\@empty\macc@skewchar$}% + \dimen@\tw@\wd\tw@ \advance\dimen@-\tw@\wd\z@ + \xdef\macc@kerna{\the\dimen@\relax}% + \setbox4\hbox{$#1#2\acc@check\@empty$}% + \global\setbox\@ne\hbox to\wd4{}% + \ht\@ne\ht4 \dp\@ne\dp4 + \xdef\macc@kernb{\the\wd4\relax}% + \mathaccent\macc@code{\box\@ne\kern\macc@kerna}% + \else + \mathaccent\macc@code{\let\macc@adjust\@empty #1#2\@empty}% + \macc@adjust + \fi + \endgroup +} +% \end{macrocode} +% +% \begin{macrocode} +\def\macc@adjust{% + \dimen@\macc@kerna\advance\dimen@\macc@kernb + \kern-\dimen@ +} +% \end{macrocode} +% +% The commands \cs{Hat}, \cs{Tilde}, \ldots, are supported as +% synonyms of \cs{hat}, \cs{tilde}, \ldots, for backward +% compatibility. +% \begin{macrocode} +\def\Hat{\hat} +\def\Check{\check} +\def\Tilde{\tilde} +\def\Acute{\acute} +\def\Grave{\grave} +\def\Dot{\dot} +\def\Ddot{\ddot} +\def\Breve{\breve} +\def\Bar{\bar} +\def\Vec{\vec} +% \end{macrocode} +% +% This error message about math mode is used several times so we make +% an abbreviation for it. +% \begin{macrocode} +\def\nonmatherr@#1{\@amsmath@err{\protect + #1 allowed only in math mode}\@ehd} +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Mods, continued fractions, etc.} +% +% \begin{macro}{\bmod} +% \begin{macro}{\pmod} +% \begin{macro}{\pod} +% \begin{macro}{\mod} +% The commands \cn{bmod}, \cn{pmod}, \cn{pod}, \cn{mod} aren't +% currently robust. [mjd, 1994/09/05] +% \begin{macrocode} +\renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin + {\operator@font mod}\penalty900 + \mkern5mu\nonscript\mskip-\medmuskip} +\newcommand{\pod}[1]{\allowbreak + \if@display\mkern18mu\else\mkern8mu\fi(#1)} +\renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}} +\newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu + \else\mkern12mu\fi{\operator@font mod}\,\,#1} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cfrac} +% Continued fractions. The optional arg l or r controls horizontal +% placement of the numerators. The |\kern-\nulldelimiterspace| +% is needed in the definition if we want the right-hand sides of the +% fraction rules to line up. The \cs{strut} keeps the numerator of +% a subsidiary cfrac from coming too close to the fraction rule above +% it. +% \begin{macrocode} +\newcommand{\cfrac}[3][c]{{\displaystyle\frac{% + \strut\ifx r#1\hfill\fi#2\ifx l#1\hfill\fi}{#3}}% + \kern-\nulldelimiterspace} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\overset} +% \begin{macro}{\underset} +% \cn{overset} and \cn{underset} put symbols above, respectively +% below, a symbol that is not a \cs{mathop} and therefore does not +% naturally accept limits. \cs{binrel@@} uses information collected +% by \cs{binrel@} to make the resulting construction be of type +% mathrel or mathbin if the base symbol is either of those types. +% \begin{macrocode} +\newcommand{\overset}[2]{\binrel@{#2}% + \binrel@@{\mathop{\kern\z@#2}\limits^{#1}}} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand{\underset}[2]{\binrel@{#2}% + \binrel@@{\mathop{\kern\z@#2}\limits_{#1}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\overunderset} +% This is the combination of the previous two commands which is +% something that is sometimes needed. +% \changes{v2.17c}{FMi}{New command \cs{overunderset}} +% \begin{macrocode} +\newcommand{\overunderset}[3]{\binrel@{#3}% + \binrel@@{\mathop{\kern\z@#3}\limits^{#1}_{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sideset} +% \cn{sideset} allows placing `adscript' symbols at the four +% corners of a \cs{mathop}, \emph{in addition to} limits. Left-side +% adscripts go into arg \arg{1}, in the form |_{...}^{...}|, and +% right-side adscripts go into arg \arg{2}. +% +% As currently written [mjd, 1995/01/21] this is pretty haphazard. +% In order to really make it work properly in full generality we'd +% have to read and measure the top and bottom limits and use +% mathchoice to always get the right mathstyle for each piece, +% etc., etc. +% \begin{macrocode} +\newcommand{\sideset}[3]{% + \@mathmeasure\z@\displaystyle{#3}% +% \end{macrocode} +% Use a global box assignment here since the depth override is +% implicitly global. Then move the constructed box to a local box +% register (2) to ensure it won't get destroyed during the next two +% mathmeasure statements. This precaution may be more extreme than +% necessary in practice. +% \begin{macrocode} + \global\setbox\@ne\vbox to\ht\z@{}\dp\@ne\dp\z@ + \setbox\tw@\box\@ne + \@mathmeasure4\displaystyle{\copy\tw@#1}% + \@mathmeasure6\displaystyle{#3\nolimits#2}% + \dimen@-\wd6 \advance\dimen@\wd4 \advance\dimen@\wd\z@ + \hbox to\dimen@{}\mathop{\kern-\dimen@\box4\box6}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\smash} +% We add to the \cn{smash} command an optional argument +% denoting the part of the formula to be smashed. +% \changes{v2.17b}{2018/12/01}{Start LR-mode for \cs{smash} +% if necessary (github/49)} +% \begin{macrocode} +\ifx\leavevmode@ifvmode\@undefined +\renewcommand{\smash}[1][tb]{% + \def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% + \edef\finsm@sh{\csname mb@#1\endcsname\z@\z@\box\z@}% + \ifmmode \@xp\mathpalette\@xp\mathsm@sh + \else \@xp\makesm@sh + \fi +} +\else +\renewcommand{\smash}[1][tb]{% + \def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% + \edef\finsm@sh{\csname mb@#1\endcsname\z@\z@ \leavevmode@ifvmode\box\z@}% + \ifmmode \@xp\mathpalette\@xp\mathsm@sh + \else \@xp\makesm@sh + \fi +} +\fi +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Extensible arrows} +% +% The minus sign used in constructing these arrow fills is smashed so +% that superscripts above the arrows won't be too high. This +% primarily affects the \cn{xleftarrow} and \cn{xrightarrow} arrows. +% +% \begin{macrocode} +\mathchardef\std@minus\mathcode`\-\relax +\mathchardef\std@equal\mathcode`\=\relax +% \end{macrocode} +% In case some alternative math fonts are loaded later: +% \begin{macrocode} +\AtBeginDocument{% + \mathchardef\std@minus\mathcode`\-\relax + \mathchardef\std@equal\mathcode`\=\relax +} +% \end{macrocode} +% +% \begin{macro}{\relbar} +% \begin{macro}{\Relbar} +% \begin{macrocode} +\ams@def\relbar{\mathrel{\mathpalette\mathsm@sh\std@minus}} +\ams@def\Relbar{\mathrel\std@equal} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\def\arrowfill@#1#2#3#4{% + $\m@th\thickmuskip0mu\medmuskip\thickmuskip\thinmuskip\thickmuskip + \relax#4#1\mkern-7mu% + \cleaders\hbox{$#4\mkern-2mu#2\mkern-2mu$}\hfill + \mkern-7mu#3$% +} +\def\leftarrowfill@{\arrowfill@\leftarrow\relbar\relbar} +\def\rightarrowfill@{\arrowfill@\relbar\relbar\rightarrow} +\def\leftrightarrowfill@{\arrowfill@\leftarrow\relbar\rightarrow} +\def\Leftarrowfill@{\arrowfill@\Leftarrow\Relbar\Relbar} +\def\Rightarrowfill@{\arrowfill@\Relbar\Relbar\Rightarrow} +\def\Leftrightarrowfill@{\arrowfill@\Leftarrow\Relbar\Rightarrow} +% \end{macrocode} +% +% \begin{macrocode} +\def\overarrow@#1#2#3{\vbox{\ialign{##\crcr#1#2\crcr + \noalign{\nointerlineskip}$\m@th\hfil#2#3\hfil$\crcr}}} +\ams@renewcommand{\overrightarrow}{% + \mathpalette{\overarrow@\rightarrowfill@}} +\ams@renewcommand{\overleftarrow}{% + \mathpalette{\overarrow@\leftarrowfill@}} +\ams@newcommand{\overleftrightarrow}{% + \mathpalette{\overarrow@\leftrightarrowfill@}} +% \end{macrocode} +% +% \begin{macrocode} +\def\underarrow@#1#2#3{% + \vtop{\ialign{##\crcr$\m@th\hfil#2#3\hfil$\crcr + \noalign{\nointerlineskip\kern1.3\ex@}#1#2\crcr}}} +\ams@newcommand{\underrightarrow}{% + \mathpalette{\underarrow@\rightarrowfill@}} +\ams@newcommand{\underleftarrow}{% + \mathpalette{\underarrow@\leftarrowfill@}} +\ams@newcommand{\underleftrightarrow}{% + \mathpalette{\underarrow@\leftrightarrowfill@}} +% \end{macrocode} +% +% \begin{macrocode} +%\newcommand{\xrightarrow}[2][]{\ext@arrow 0359\rightarrowfill@{#1}{#2}} +\def\ext@arrow#1#2#3#4#5#6#7{% + \mathrel{\mathop{% +% \end{macrocode} +% Measure the superscript and subscript. +% \begin{macrocode} + \setbox\z@\hbox{#5\displaystyle}% + \setbox\tw@\vbox{\m@th + \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% + \hbox{$\scriptstyle\mkern#3mu{#7}\mkern#4mu$}% + \copy\z@ + }% + \hbox to\wd\tw@{\unhbox\z@}}% +% \end{macrocode} +% We don't want to place an empty subscript since that will produce +% too much blank space below the arrow. +% \begin{macrocode} + \limits + \@ifnotempty{#7}{^{\if0#1\else\mkern#1mu\fi + #7\if0#2\else\mkern#2mu\fi}}% + \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi + #6\if0#2\else\mkern#2mu\fi}}}% +} +% \end{macrocode} +% +% Some extensible arrows to serve as mathrels and taking +% sub/superscripts. These commands are robust because they take an +% optional argument. +% \begin{macrocode} +\newcommand{\xrightarrow}[2][]{\ext@arrow 0359\rightarrowfill@{#1}{#2}} +\newcommand{\xleftarrow}[2][]{\ext@arrow 3095\leftarrowfill@{#1}{#2}} +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Array-related environments} +% \subsection{Remarks} +% +% Because these environments can be nested within the equation +% structures that allow \cn{tag}, there is some cross-influence in +% the internal workings of the \cn{\\} command. +% +% \subsection{The \env{subarray} environment and \cn{substack} command} +% +% The \cn{substack} command can be used to set subscripts +% and superscripts that consist of several lines. Usage: +% \begin{verbatim} +% X_{\substack{a=1\\b=2}} +% \end{verbatim} +% +% \changes{v2.0}{1999/06/17}{Removed environment definitions: Sb, Sp} +% +% \begin{environment}{subarray} +% The \env{subarray} environment makes a small-size array suitable +% for use in a subscript or superscript. At the moment the supported +% arguments are not the full possibilities of \env{array} but only +% |c| or |l| for centered or left-aligned. And only one column. +% \begin{macrocode} +\newenvironment{subarray}[1]{% +% \end{macrocode} +% Note: The predecessors of \env{subarray} (\env{Sb} and \env{Sp}, +% inherited from \amstex/) used \cs{vbox} instead of \cs{vcenter}. +% But when a multiline subscript is placed in \cs{limits} position +% \cs{vcenter} is no worse than \cs{vbox}, and when it is placed +% in the \cs{nolimits} position (e.g., for an integral), \cs{vcenter} +% provides clearly better positioning than \cs{vbox}. +% \begin{macrocode} + \vcenter\bgroup +% \end{macrocode} +% Use \cs{Let@} to set the proper meaning of the \cn{\\} and \cn{\\*} +% commands. And restore the meaning of \cs{math@cr@@@} to \cs{cr} +% (see above) in case \env{subarray} is used inside one of the more +% complicated alignment macros where the meaning of \cs{math@cr@@@} +% is different. Similarly, call \cs{default@tag} to ensure that a +% line break here doesn't get an equation number! +% \begin{macrocode} + \Let@ \restore@math@cr \default@tag +% \end{macrocode} +% Set the line spacing to be the same as \cs{atop} (when \cs{atop} +% occurs in \cs{textstyle} or smaller), cf \textit{The \tex/book}, +% Appendix G. +% \begin{macrocode} + \baselineskip\fontdimen10 \scriptfont\tw@ + \advance\baselineskip\fontdimen12 \scriptfont\tw@ + \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ + \lineskiplimit\lineskip +% \end{macrocode} +% Start the \cs{vbox} \cs{halign} structure that encloses the +% contents. Notice that we never get \cs{scriptscriptstyle}. That +% would require a \cs{mathchoice} (ugh). +% \begin{macrocode} + \ialign\bgroup\ifx c#1\hfil\fi + $\m@th\scriptstyle##$\hfil\crcr +}{% + \crcr\egroup\egroup +} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\substack} +% The \cn{substack} command is just an abbreviation for the +% most common use of \env{subarray}. +% \begin{macrocode} +\newcommand{\substack}[1]{\subarray{c}#1\endsubarray} +% \end{macrocode} +% \end{macro} +% +% \subsection{Matrices} +% +% \begin{environment}{smallmatrix} +% \env{smallmatrix} is again an alignment, this time in a centered +% box. The opening incantations are basically the same as those in +% \cs{multilimits@}, followed by the alignment itself. A remark: +% the baselineskip (|9\ex@|) used in \amstex/ is too large for +% use in text with the usual baselineskip of $12$ or $13$ points; we +% change it here to |6\ex@| and also adjust the \cs{lineskip} +% and \cs{lineskiplimit} slightly to compensate. (MJD) +% \begin{macrocode} +\newenvironment{smallmatrix}{\null\,\vcenter\bgroup + \Let@\restore@math@cr\default@tag + \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip + \ialign\bgroup\hfil$\m@th\scriptstyle##$\hfil&&\thickspace\hfil + $\m@th\scriptstyle##$\hfil\crcr +}{% + \crcr\egroup\egroup\,% +} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{matrix} +% The \env{matrix} environment is just an \env{array} that provides +% up to ten centered columns, so that users don't have to give the +% col-spec argument explicitly---unless they want some of the columns +% noncentered, that is. The maximum number of columns is actually not +% fixed at ten but given by the counter |MatrixCols|, and can +% therefore be increased by changing that counter. +% +% The extra space of \cn{arraycolsep} that \env{array} adds on each +% side is a waste so we remove it here (perhaps we should instead +% remove it from \env{array} in general, but that's a harder task). +% +% TODO: Think about re-implementing \cn{matrix} to get rid of the +% \cs{c@MatrixCols} limit and have hard-wired preamble that doesn't +% have to be rebuilt each time. +% +% We must use \cn{renewenvironment} for \env{matrix} and +% \env{pmatrix} because \latex/ doesn't kill the definitions found in +% \fn{plain.tex}, even though it probably should because of their +% foreign syntax. +% \begin{macrocode} +\renewenvironment{matrix}{% + \matrix@check\matrix\env@matrix +}{% + \endarray \hskip -\arraycolsep +} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\env@matrix} +% +% \begin{macrocode} +\def\env@matrix{\hskip -\arraycolsep + \let\@ifnextchar\new@ifnextchar + \array{*\c@MaxMatrixCols c}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@MaxMatrixCols} +% \begin{macrocode} +\newcount\c@MaxMatrixCols \c@MaxMatrixCols=10 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\matrix@check} +% For various reasons, authors sometimes use the Plain \TeX{} form of +% \cn{matrix} or \cn{pmatrix} in \LaTeX{} documents. If they later +% add an invocation of the \pkg{amsmath} package to their document, +% the Plain \TeX{} syntax would lead to rather unintelligible error +% messages. The \cs{matrix@check} function does some checking to +% forestall that problem. +% \begin{macrocode} +\def\matrix@check#1{% + \@xp\ifx\csname\@currenvir\endcsname#1% + \else\matrix@error#1% +% \end{macrocode} +% This error recovery is not that good but is better than the +% infinite loop that can result from calling \cs{array} without a +% matching \cs{endarray}. (The array setup leaves \cs{par} empty.) +% \begin{macrocode} + \@xp\@gobble + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\matrix@error} +% +% \begin{macrocode} +\def\matrix@error#1{% + \@amsmath@err{% +Old form `\string#1' should be \string\begin{\@xp\@gobble\string#1}% + }{% +`\string#1{...}' is old Plain-TeX syntax whose use is +ill-advised in LaTeX.% + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\renewenvironment{pmatrix}{% + \left(% + \matrix@check\pmatrix\env@matrix +}{ + \endmatrix\right)% +} +\newenvironment{bmatrix}{\left[\env@matrix}{\endmatrix\right]} +\newenvironment{Bmatrix}{% + \left\lbrace\env@matrix +}{% + \endmatrix\right\rbrace +} +\newenvironment{vmatrix}{\left\lvert\env@matrix}{\endmatrix\right\rvert} +\newenvironment{Vmatrix}{\left\lVert\env@matrix}{\endmatrix\right\rVert} +% \end{macrocode} +% +% \begin{macrocode} +\let\hdots\@ldots +% \end{macrocode} +% +% \begin{macrocode} +\newcommand{\hdotsfor}[1]{% + \ifx[#1\@xp\shdots@for\else\hdots@for\@ne{#1}\fi} +\newmuskip\dotsspace@ +\def\shdots@for#1]{\hdots@for{#1}} +\def\hdots@for#1#2{\multicolumn{#2}c% + {\m@th\dotsspace@1.5mu\mkern-#1\dotsspace@ + \xleaders\hbox{$\m@th\mkern#1\dotsspace@.\mkern#1\dotsspace@$}% + \hfill + \mkern-#1\dotsspace@}% + } +% \end{macrocode} +% +% \begin{environment}{cases} +% The easiest way to produce the \env{cases} environment is to base +% it on the \env{array} environment. We must use +% \cn{renewenvironment} to override the definition of \cn{cases} that +% \latex/ (unwisely) leaves in place from \fn{plain.tex}. +% \begin{macrocode} +\renewenvironment{cases}{% + \matrix@check\cases\env@cases +}{% + \endarray\right.% +} +\def\env@cases{% + \let\@ifnextchar\new@ifnextchar + \left\lbrace + \def\arraystretch{1.2}% + \array{@{}l@{\quad}l@{}}% +} +% \end{macrocode} +% \end{environment} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Equation sub-numbering} +% +% \begin{macrocode} +\newcounter{parentequation}% Counter for ``parent equation''. +% \end{macrocode} +% +% We can't assume \cs{ignorespacesafterend} is defined since it was +% not there in the earliest releases of \latex/ 2e. And we need to +% include the \cs{global} for the same reason. +% \begin{macrocode} +\@ifundefined{ignorespacesafterend}{% + \def\ignorespacesafterend{\global\@ignoretrue}% +}{} +% \end{macrocode} +% +% \begin{environment}{subequations} +% \begin{macrocode} +\newenvironment{subequations}{% +% \end{macrocode} +% Before sending down the `equation' counter to the subordinate +% level, add 1 using standard \cn{refstepcounter}. +% \begin{macrocode} + \refstepcounter{equation}% +% \end{macrocode} +% Define \cn{theparentequation} equivalent to current +% \cn{theequation}. \cn{edef} is necessary to expand the current +% value of the equation counter. This might in rare cases cause +% something to blow up, in which case the user needs to add +% \cn{protect}. +% \begin{macrocode} + \protected@edef\theparentequation{\theequation}% + \setcounter{parentequation}{\value{equation}}% +% \end{macrocode} +% And set the equation counter to 0, so that the normal incrementing +% processes in the various equation environments will produce the +% desired results. +% \begin{macrocode} + \setcounter{equation}{0}% + \def\theequation{\theparentequation\alph{equation}}% + \ignorespaces +}{% + \setcounter{equation}{\value{parentequation}}% + \ignorespacesafterend +} +% \end{macrocode} +% \end{environment} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Equation numbering} +% +% In the multiline equation environments provided here, the task +% of equation numbering is linked to the task of line breaking +% in the sense that it is the \cn{\\} command that marks where an +% equation number for the current line will be processed and added to +% the page. +% +% \begin{macro}{\numberwithin} +% Provide a convenient way to specify that equations should be +% numbered within sections. +% \begin{macrocode} +\newcommand{\numberwithin}[3][\arabic]{% + \@ifundefined{c@#2}{\@nocounterr{#2}}{% + \@ifundefined{c@#3}{\@nocnterr{#3}}{% + \@addtoreset{#2}{#3}% + \@xp\xdef\csname the#2\endcsname{% + \@xp\@nx\csname the#3\endcsname .\@nx#1{#2}}}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\eqref} +% To make references to equation numbers easier, we provide +% \cn{eqref}. We almost don't need \cn{textup}, except that +% \cs{tagform@} doesn't supply the italic correction. +% \begin{macrocode} +\newcommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}} +% \end{macrocode} +% \end{macro} +% +% \subsection{Preliminary macros} +% +% The following macros implement the \latex/ syntax for the +% \cn{\\} command, i.e. the possibility to add an asterisk to +% inhibit a page break, or an optional argument to denote additional +% vertical space. They are modelled more or less after the +% corresponding macros for \latex/'s \env{eqnarray} and \env{array} +% environments. +% +% [We can perhaps use the eqnarray mechanism if we change it so that +% it also uses \cs{openup}.] +% +% \begin{macro}{\dspbrk@lvl} +% We begin by defining the \cs{dspbrk@lvl} counter. This counter +% records the desirability of a break after the current row, as a +% number between $0$ and $4$. Its default value is $-1$ meaning that +% no explicit \cn{displaybreak} command was given, and the default +% \cs{interdisplaylinepenalty} is to be used. +% \begin{macrocode} +\newcount\dspbrk@lvl +\dspbrk@lvl=-1 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\interdisplaylinepenalty} +% We set the \cs{interdisplaylinepenalty} to $10000$. +% \begin{macrocode} +\interdisplaylinepenalty\@M +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\allowdisplaybreaks} +% The \cn{allowdisplaybreaks} command. Since this is intended for use +% outside displayed formulas (typically in the preamble), it does not +% need to use \cs{new@ifnextchar}. +% \begin{macrocode} +\newcommand{\allowdisplaybreaks}[1][4]{% + \interdisplaylinepenalty\getdsp@pen{#1}\relax +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\getdsp@pen} +% Modelled after \latex/'s \cs{@getpen}. We use higher numbers +% than would normally be provided by \cs{@lowpenalty}, +% \cs{@medpenalty}, and \cs{@highpenalty}, since display +% breaks are almost always less desirable. +% \begin{macrocode} +\def\getdsp@pen#1{% + \ifcase #1\@M \or 9999 \or 6999 \or 2999 \or \z@\fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\displaybreak} +% \begin{macro}{\dspbrk@} +% \begin{macro}{\dspbrk@context} +% \begin{macro}{\nogood@displaybreak} +% For breaks in a certain row of a alignment. +% \begin{macrocode} +\newcommand{\displaybreak}{\new@ifnextchar[\dspbrk@{\dspbrk@[4]}} +\chardef\dspbrk@context=\sixt@@n +% \end{macrocode} +% +% \begin{macrocode} +\def\dspbrk@[#1]{% + \ifmeasuring@ + \else + \ifcase\dspbrk@context % case 0 --- OK + \global\dspbrk@lvl #1\relax + \or % case 1 --- inside a box + \nogood@displaybreak + \else % other cases --- outside of a display + \@amsmath@err{\Invalid@@\displaybreak}\@eha + \fi + \fi +} +% \end{macrocode} +% +% This is the value of \cn{displaybreak} when it occurs inside some +% structure where it will not work. +% \begin{macrocode} +\def\nogood@displaybreak{% + \@amsmath@err{\protect +\displaybreak\space cannot be applied here}% +{One of the enclosing environments creates an + unbreakable box\MessageBreak +(e.g., split, aligned, gathered, ...).}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\math@cr} +% The macro \cs{math@cr} ends a row inside one of the equation +% environments, i.e., this is the internal name of the \cn{\\} +% commands in these environments. As usual for this kind of macro +% inside of alignments we insert a special brace into \tex/'s input +% stream. The initial \cs{relax} is needed to trigger entry into the +% \textit{u} template of the current column if the author ended the +% current row with an empty column (i.e., the mathcr was immediately +% preceded by an ampersand). +% \begin{macrocode} +\def\math@cr{\relax\iffalse{\fi\ifnum0=`}\fi +% \end{macrocode} +% The first step is now to check whether an asterisk follows. +% \cs{@eqpen} is used to hold the penalty value to be put on +% the vertical list. +% Then we call up \cs{math@cr@} which performs the next step. +% If an asterisk is read page breaking is inhibited. +% \begin{macrocode} + \@ifstar{\global\@eqpen\@M\math@cr@}% +% \end{macrocode} +% Otherwise we have to check the \cs{dspbrk@lvl} value. +% \begin{macrocode} + {\global\@eqpen + \ifnum\dspbrk@lvl <\z@ \interdisplaylinepenalty + \else -\@getpen\dspbrk@lvl \fi + \math@cr@}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@} +% The purpose of \cs{math@cr@} is to check whether an optional +% argument follows. If not it provides \cs{z@} as default +% value. +% \begin{macrocode} +\def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@@} +% \cs{math@cr@@} closes the special brace opened in +% \cs{math@cr}, and calls \cs{math@cr@@@} which is supposed +% the `real' row ending command. The meaning of this macro depends +% on the environment in which it is used. +% \begin{macrocode} +\def\math@cr@@[#1]{\ifnum0=`{\fi \iffalse}\fi\math@cr@@@ +% \end{macrocode} +% Finally we put the additional space onto the vertical list. +% \begin{macrocode} + \noalign{\vskip#1\relax}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Let@} +% \cs{Let@} is called by all environments where \cn{\\} +% ends a row of an alignment. +% \begin{macrocode} +\def\Let@{\let\\\math@cr} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\restore@math@cr} +% We mentioned already that the exact meaning of \cs{math@cr@@@} +% depends on the current environment. Since it is often a simple +% \cs{cr} we provide \cs{restore@math@cr} to reset it. +% \begin{macrocode} +\def\restore@math@cr{\def\math@cr@@@{\cr}} +% \end{macrocode} +% This is also the default case. +% \begin{macrocode} +\restore@math@cr +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intertext} +% \begin{macro}{\intertext@} +% The \cn{intertext} command is used for inserting text between the +% rows of an alignment. It might better be done as an environment, +% but the \cs{begingroup} from \cn{begin} would cause the +% \cs{noalign} to fail. +% \begin{macrocode} +\newcommand{\intertext}{\@amsmath@err{\Invalid@@\intertext}\@eha} +% \end{macrocode} +% \cs{intertext@} is called by all environments that allow the use of +% the \cn{intertext} command. +% \begin{macrocode} +\def\intertext@{% + \def\intertext##1{% +% \end{macrocode} +% If current mode is not vmode, the most likely reason is that the +% writer forgot the \cn{\\} that is supposed to precede +% \cn{intertext}. All right, then, let's try adding it our ownself. +% But, to be slightly careful: \cn{\\} does a futurelet, and it's +% slightly dangerous to allow a letted token to barge around loose in +% our internal code when it has been let to a conditional token +% like \cs{fi}. So let's interpose something in front of the \cs{fi} +% for the futurelet to take instead. (And careful again: it has to be +% something evanescent, not (e.g.) \cs{relax} which would cause the +% next halign cell to fire up and keep \cs{noalign} from working.) +% \begin{macrocode} + \ifvmode\else\\\@empty\fi + \noalign{% + \penalty\postdisplaypenalty\vskip\belowdisplayskip + \vbox{\normalbaselines +% \end{macrocode} +% We need to do something extra if the outside environment is a list +% environment. I don't see offhand an elegant way to test ``are we +% inside any list environment'' that is both easy and reliable (for +% example, checking for zero \cs{@totalleftmargin} wouldn't catch the +% case where \cs{@totalleftmargin} is zero but \cs{linewidth} is less +% than \cs{columnwidth}), so it seems to me checking \cs{linewidth} +% is the best practical solution. +% \changes{v2.15c}{2016/05/23}{\cs{ignorespaces} at the start of the argument} +% \begin{macrocode} + \ifdim\linewidth=\columnwidth + \else \parshape\@ne \@totalleftmargin \linewidth + \fi + \noindent\ignorespaces##1\par}% + \penalty\predisplaypenalty\vskip\abovedisplayskip% + }% +}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{Implementing tags and labels} +% +% In this section we describe some of the macros needed to make the +% \cn{tag} command work in various places. We start by defining a +% help text to be used when a \cn{tag} command is used somewhere +% it should not appear. +% +% \begin{macro}{\tag@help} +% This is the default error help text provided when \cn{tag} +% generates an error message. +% Note that \cs{newhelp} generates a control sequence name +% from the string given as its argument so that a leading +% backslash is provided automatically. +% \begin{macrocode} +\newhelp\tag@help + {tag cannot be used at this point.\space + If you don't understand why^^Jyou should consult + the documentation.^^JBut don't worry: just continue, and I'll + forget what happened.} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\gobble@tag} +% This macro is to be used when \cn{tag} should silently +% skip its argument. +% It is made to handle the \qc{\*}-form of \cn{tag} as well. +% \begin{macrocode} +\def\gobble@tag{\@ifstar\@gobble\@gobble} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\invalid@tag} +% \cs{invalid@tag} is a macro that should be used whenever +% \cn{tag} appears in an illegal place. +% It sets up \cs{tag@help} (as defined above) as help message, +% prints its argument as error message, and skips \cn{tag}'s +% argument. +% \begin{macrocode} +\def\invalid@tag#1{\@amsmath@err{#1}{\the\tag@help}\gobble@tag} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dft@tag} +% \begin{macro}{\default@tag} +% \cs{dft@tag} provides a convenient way to disallow the +% use of \cn{tag} at certain points. +% One simply has to write +% \begin{verbatim} +%\let\tag\dft@tag +% \end{verbatim} +% and the \cn{tag} command will produce an error message, +% with a suitable error help text, and discard its argument. +% \begin{macrocode} +\def\dft@tag{\invalid@tag{\string\tag\space not allowed here}} +% \end{macrocode} +% Since this is used several times we provide an abbreviation for +% it. +% \begin{macrocode} +\def\default@tag{\let\tag\dft@tag} +% \end{macrocode} +% Since this is also the default, i.e.\ the \cn{tag} command +% should not be used except in special places, we issue a +% \cs{default@tag} command. +% \begin{macrocode} +\default@tag +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Now that we have taken care of the case that \cn{tag} is not +% allowed we will provide some macros to process tags appropriately. +% As the user documentation states, a \cn{tag} command (without +% the asterisk typesets its argument according to the document +% styles' conventions, whereas a \cn{tag*} command typesets its +% argument exactly as given. We define therefore the following +% interface: +% +% \begin{macro}{\maketag@@} +% \begin{macro}{\maketag@@@} +% \begin{macro}{\tagform@} +% \cn{tag} is supposed to call \cs{maketag@@} which checks +% whether an asterisk follows. If this is the case it calls up +% \cs{maketag@@@} which sets its argument `as is'. Otherwise +% \cs{tagform@} is called to do the job. (This macro is to be +% defined appropriately by the document style.) +% \begin{macrocode} +\def\maketag@@{\@ifstar\maketag@@@\tagform@} +% \end{macrocode} +% We define \cs{maketag@@@} to use the normal font of the document +% text (since this is the usual practice for numbering of document +% elements) and to put a box around the tag. Furthermore we use +% \cs{m@th} for exceptional cases where the tag involves a +% superscript or some such math. (Probably from an explicit use of +% \cs{tag*} rather than from the automatic numbering.) +% \begin{macrocode} +\def\maketag@@@#1{\hbox{\m@th\normalfont#1}} +% \end{macrocode} +% We use the following default definition for \cs{tagform@} +% that puts only parentheses around the tag. +% \begin{macrocode} +\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% We need to insinuate \cs{tagform@} into \cs{@eqnnum} in case +% \env{eqnarray} is used (probably in a document that was originally +% written without use of the \pkg{amsmath} package). +% \begin{macrocode} +\iftagsleft@ + \def\@eqnnum{\hbox to1sp{}\rlap{\normalfont\normalcolor + \hskip -\displaywidth\tagform@\theequation}} +\else + \def\@eqnnum{{\normalfont\normalcolor \tagform@\theequation}} +\fi +% \end{macrocode} +% +% \begin{macro}{\thetag} +% Sometimes one needs to set a literal tag according to the rules of +% the document style. To achieve this we provide the \cn{thetag} +% command. It typesets its argument by calling \cs{tagform@} on +% it. +% \begin{macrocode} +\newcommand{\thetag}{\leavevmode\tagform@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\df@tag} +% \begin{macro}{\make@df@tag} +% \begin{macro}{\make@df@tag@@} +% \begin{macro}{\make@df@tag@@@} +% Sometimes it is necessary for a \cn{tag} command to store a tag +% in a safe place and to process it later, e.g., for a tag in a row +% of an alignment where the tag can only be typeset when the +% \cn{\\} at the end of the row was seen. Such a tag is stored in +% the macro \cs{df@tag} (for `deferred tag'). For this purpose we +% provide the \cs{make@df@tag} macro. It is built very similar to +% the \cs{maketag@@} macro above. +% \begin{macrocode} +\let\df@tag\@empty +\def\make@df@tag{\@ifstar\make@df@tag@@\make@df@tag@@@} +% \end{macrocode} +% \cs{make@df@tag} sets \cs{@currentlabel} and defines +% \cs{df@tag} appropriately. +% +% To simplify the task of tracking \cs{tag} and \cs{label} +% commands inside math display environments, we defer \cs{label} +% commands until the tag is typeset, similar to the way that +% \cs{tag}s themselves are deferred. This allows arbitrary +% placement of \cs{label} and \cs{tag} commands and also means we +% only increment the \cs{equation} counter when we really need to, +% thus avoiding the \cs{setb@ck} nonsense that used to be required. +% +% \begin{macrocode} +\def\make@df@tag@@#1{% + \gdef\df@tag{\maketag@@@{#1}\def\@currentlabel{#1}}} +% \end{macrocode} +% Autogenerated number: +% \begin{macrocode} +\def\make@df@tag@@@#1{\gdef\df@tag{\tagform@{#1}% + \toks@\@xp{\p@equation{#1}}\edef\@currentlabel{\the\toks@}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ltx@label} +% \begin{macro}{\label@in@display} +% \begin{macro}{\df@label} +% Next, we store the default definition of \cs{label} in +% \cs{ltx@label} and then define a new version of \cs{label} for use +% in math display environments. \cs{label@in@display} merely issues a +% warning message if there is already a pending label (which will be +% discarded) and then stores the label in \cs{df@label}. +% \begin{macrocode} +\let\ltx@label\label +% +\def\label@in@display{% + \ifx\df@label\@empty\else + \@amsmath@err{Multiple \string\label's: + label '\df@label' will be lost}\@eha + \fi + \gdef\df@label +} +% \end{macrocode} +% In case there is an enumerate inside a minipage inside an equation, +% we need to reset \cn{label} to its normal value: +% \begin{macrocode} +\toks@\@xp{\@arrayparboxrestore \let\label\ltx@label}% +\edef\@arrayboxrestore{\the\toks@} +% \end{macrocode} +% +% \begin{macrocode} +\let\df@label\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\make@display@tag} +% Now we define a macro to process \cs{tag} and \cs{label} commands +% in various display environments. If the |@eqnsw| switch is set, +% then we should supply an equation number; otherwise, if the +% |@tag| switch is set, we should use the tag stored in +% \cs{df@tag}. Finally, we process any pending \cs{label}s. +% +% TODO: Arguably, \cs{make@display@tag} should issue a warning +% message if there is a \cs{label} but neither a tag nor an +% equation number. Also, it would probably be worthwhile to +% explore whether \cs{iftag@} could be done away with and replaced +% by checks to see if \cs{df@tag} is empty or not. +% \begin{macrocode} +\def\make@display@tag{% + \if@eqnsw \incr@eqnum \print@eqnum + \else \iftag@ \df@tag \global\let\df@tag\@empty \fi + \fi +% \end{macrocode} +% Need to check the \cs{ifmeasuring@} flag otherwise the \cs{write} +% node from \cn{label} might be discarded in a temp box and clearing +% \cs{df@label} will keep it from being reiterated on the real +% typesetting pass. +% \begin{macrocode} + \ifmeasuring@ + \else + \ifx\df@label\@empty + \else + \@xp\ltx@label\@xp{\df@label}% + \global\let\df@label\@empty + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% Now we define the special versions of \cn{tag} used within the +% \env{align} environments. +% +% \begin{macro}{\tag@in@align} +% The \cn{tag} command may only appear once in a row of +% an alignment. Therefore we first check the switch |tag@| +% that is set to false at the begin of every row. +% If this switch is true a \cn{tag} was already given in this +% row and we define \cs{next@} to expand to a call to +% \cs{invalid@tag}. +% \begin{macrocode} +\def\tag@in@align{% + \relax + \iftag@ + \DN@{\invalid@tag{Multiple \string\tag}}% + \else +% \end{macrocode} +% Otherwise we set the |tag@| switch. But there is more to +% be done: we must also prevent the automatic generation of a +% tag. Therefore we also reset the |@eqnsw|. +% \begin{macrocode} + \global\tag@true +% \end{macrocode} +% Changed to \cs{nonumber}, since that seems to be all that's +% required.---dmj, 1994/12/21 +% \begin{macrocode} + \nonumber +% \end{macrocode} +% Within a row of an \env{align} environment the \cn{tag} +% command must not typeset the tag immediately since its +% position can be determined only later. +% Therefore we use the \cs{make@df@tag} macro defined +% earlier. +% Finally we call \cs{next@} to process the argument +% that follows. +% \begin{macrocode} + \let\next@\make@df@tag + \fi + \next@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\raisetag} +% Usage: \cn{raisetag} \meta{dimen} +% +% This will modify the vertical placement of the tag of the current +% equation by \meta{dimen}. Note that according to the current uses +% of \cs{raise@tag} in e.g., \cs{place@tag@gather}, no adjustment +% occurs if the tag falls in its normal position; i.e., \cn{raisetag} +% has no effect unless the tag has already been shifted off-line. +% +% \begin{macrocode} +\newcommand{\raisetag}[1]{\skip@#1\relax + \xdef\raise@tag{\vskip\iftagsleft@\else-\fi\the\skip@\relax}% +} +% \end{macrocode} +% \cn{raise@tag} will be reemptied at the beginning of each equation, +% which might occur at a |\begin{xxx}| or \cn{\\}. +% \begin{macrocode} +\let\raise@tag\@empty +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\notag} +% For consistency we provide \cn{notag}, equivalent to +% \cn{nonumber}. The alternative would have been to rename +% \cn{tag} as \cn{number} to go along with \cn{nonumber}, +% but of course \cs{number} is a \tex/ primitive that should not +% be redefined. +% \begin{macrocode} +\newcommand{\notag}{\nonumber} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nonumber} +% Need to add some additional code to \cn{nonumber} to deal with some +% complications related to nested environments. +% \begin{macrocode} +\renewcommand{\nonumber}{% + \if@eqnsw + \ifx\incr@eqnum\@empty \addtocounter{equation}\m@ne \fi + \fi + \let\print@eqnum\@empty \let\incr@eqnum\@empty + \global\@eqnswfalse +} +% \end{macrocode} +% +% \begin{macrocode} +\def\print@eqnum{\tagform@\theequation} +\def\incr@eqnum{\refstepcounter{equation}\let\incr@eqnum\@empty} +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Multiline equation environments} +% +% \subsection{Remarks} +% +% In late 1994 David M. Jones did a thorough overhaul of these +% environments so that the number placement and a few other aspects +% are substantially improved over the original versions that were +% ported essentially unchanged from \fn{amstex.tex} in 1989. Most of +% the commentary in this section is DMJ's, and comments of any +% significance that I added are marked by my initials and date +% [mjd, 1995/01/11]. +% +% \subsection{Preliminaries} +% +% \begin{macro}{\ifinalign@} +% \begin{macro}{\ifingather@} +% We define two switches that are set to true in certain +% alignments: |inalign@| and |ingather@| inside of +% the \env{align} and \env{gather} environments. +% These switches are needed to control certain actions that +% depend on the surrounding conditions, more specifically: +% on the setting already done by the surrounding environments. +% \begin{macrocode} +\newif\ifinalign@ +\newif\ifingather@ +% \end{macrocode} +% \begin{histnote} +% Removed the \cs{ifinany@} test [mjd,1999/06/28] since it was mainly +% used for the purpose now handled by \cs{spread@equation}. +% \changes{v1.2g}{1999/06/28}{Removed ifinany@} +% \end{histnote} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@arrayparboxrestore} +% Here we must reset a few additional parameters. +% \begin{macrocode} +\@xp\def\@xp\@arrayparboxrestore\@xp{\@arrayparboxrestore + \ingather@false\inalign@false \default@tag + \let\spread@equation\@spread@equation + \let\reset@equation\@empty + \def\print@eqnum{\tagform@\theequation}% + \def\incr@eqnum{\refstepcounter{equation}\let\incr@eqnum\@empty}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\iftag@} +% The switch |tag@| is set to false at the beginning of every +% row and set to true by a \cn{tag} command. +% This allows us to check whether there is more than one tag on +% a row. +% \begin{macrocode} +\newif\iftag@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifst@rred} +% The switch |st@rred| is set to true by all starred +% environments +% and set to false by the unstarred versions. +% \begin{macrocode} +\newif\ifst@rred +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifmeasuring@} +% All display environments get typeset twice---once during a +% ``measuring'' phase and then again during a ``production'' phase; +% \cs{ifmeasuring@} will be used to determine which case we're in, +% so we can take appropriate action. +% +% \begin{macrocode} +\newif\ifmeasuring@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifshifttag@} +% \cs{ifshifttag@} is used by \env{gather} to communicate between +% \cs{calc@shift@gather} and \cs{place@tag@gather} whether an +% equation tag should be shifted to a separate line. It's also +% used by \env{multline}. +% \begin{macrocode} +\newif\ifshifttag@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\row@} +% \begin{macrocode} +\newcount\row@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\column@} +% The counter \cs{column@} is used by the alignment macros to +% keep track of the current column. +% +% \begin{macrocode} +\newcount\column@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\column@plus} +% \cs{\column@plus} is a useful abbreviation. +% \begin{macrocode} +\def\column@plus{% + \global\advance\column@\@ne +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\maxfields@} +% \begin{macrocode} +\newcount\maxfields@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\add@amp} +% \begin{macro}{\add@amps} +% \begin{macrocode} +\def\add@amp#1{\if m#1&\@xp\add@amp\fi} +\def\add@amps#1{% + \begingroup + \count@#1\advance\count@-\column@ + \edef\@tempa{\endgroup + \@xp\add@amp\romannumeral\number\count@ 000q}% + \@tempa +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\andhelp@} +% The help text stored in \cs{andhelp@} is used for errors +% generated by too many \qc{\&} characters in a row. +% \begin{macrocode} +\newhelp\andhelp@ +{An extra & here is so disastrous that you should probably exit^^J +and fix things up.} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\eqnshift@} +% \cs{eqnshift@} is used by \env{align} and \env{gather} as the +% indentation of the lines of the environment from the left margin. +% \begin{macrocode} +\newdimen\eqnshift@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\alignsep@} +% \begin{macrocode} +\newdimen\alignsep@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tagshift@} +% \begin{macrocode} +\newdimen\tagshift@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mintagsep} +% \cs{mintagsep} is the minimum allowable separation between an +% equation and its tag. We set it to half a quad in +% \cs{textfont}2, which is \tex/'s built-in value. +% \begin{macrocode} +\newcommand{\mintagsep}{.5\fontdimen6\textfont\tw@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\minalignsep} +% This should probably be a skip register [mjd,1999/06/18] +% \begin{macrocode} +\newcommand{\minalignsep}{10pt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tagwidth@} +% \begin{macrocode} +\newdimen\tagwidth@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\totwidth@} +% \begin{macrocode} +\newdimen\totwidth@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lineht@} +% The dimen register \cs{lineht@} is used to keep track of the +% height (or depth, if tags are on the right) of a row in an +% alignment. +% \begin{macrocode} +\newdimen\lineht@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tag@width} +% \begin{macro}{\savetaglength@} +% \begin{macro}{\shift@tag} +% \begin{macro}{\tag@shifts} +% \begin{macrocode} +\def\tag@width#1{% + \ifcase\@xp#1\tag@lengths\fi +} + +\def\savetaglength@{% + \begingroup + \let\or\relax + \xdef\tag@lengths{\tag@lengths\or \the\wdz@}% + \endgroup +} + +\def\shift@tag#1{% + \ifcase\@xp#1\tag@shifts\fi\relax +} + +\let\tag@shifts\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\saveshift@} +% \begin{macrocode} +\def\saveshift@#1{% + \begingroup + \let\or\relax + \xdef\tag@shifts{\or#1\tag@shifts}% + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\spread@equation} +% This does the line-spacing adjustment that is normally wanted for +% displayed equations. We also call \cs{reset@strutbox@} here because +% otherwise a preceding font size change might leave \cs{strutbox@} +% with wrong contents. This is a less-than-ideal solution but +% probably good enough for now, until the situation can be +% overhauled. +% \begin{macrocode} +\def\spread@equation{\reset@strutbox@ + \openup\jot \let\spread@equation\@empty} +\let\@spread@equation\spread@equation +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\displ@y} +% \begin{macro}{\displ@y@} +% \begin{macro}{\@display@init} +% \cs{displ@y} is from \fn{plain.tex}, with +% \cs{interdisplaylinepenalty} changed to \cs{@eqpen}. Also we +% transplanted most of its internal organs to \cs{@display@init} to +% support \cs{displ@y@} and other possibilities. Don't try to make +% sense of these naming conventions! They are a narrowly calculated +% mishmash of Knuth/Spivak/Lamport/Mittelbach precedents. The reason +% for not cleaning them up and forcing all names to a consistent +% scheme is that then in principle we'd have to do it everywhere else +% too. And we programmers are paranoid about the side effects of name +% changes. +% \begin{macrocode} +\def\displ@y{\@display@init{}} +\def\@display@init#1{% + \global\dt@ptrue \spread@equation + \everycr{% + \noalign{% + #1% + \ifdt@p + \global\dt@pfalse + \vskip-\lineskiplimit + \vskip\normallineskiplimit + \else + \penalty\@eqpen \global\dspbrk@lvl\m@ne + \fi + }% + }% +} +% \end{macrocode} +% \cs{displ@y@} is nearly the same; it additionally sets the |tag@| +% switch and the \cs{column@} and \cs{dspbrk@lvl} counters to their +% default values. The argument is normally a bit of code to empty out +% \cs{raise@tag}, but in \env{multline} we don't want that to happen +% in \cs{everycr}. +% \begin{macrocode} +\def\displ@y@{\@display@init{% + \global\column@\z@ \global\dspbrk@lvl\m@ne + \global\tag@false \global\let\raise@tag\@empty +}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\black@} +% \changes{v2.17a}{2017/09/02}{add fixed width box so overfull warning generated in centred environments in lists} +% This macro is made to produce an overfull box message and +% possibly (depending on the value of \cs{overfullrule}) +% a rule in the margin if the total width of an alignment +% is larger than the value of \cs{displaywidth}. +% \begin{macrocode} +\def\black@#1{% + \noalign{% + \ifdim#1>\displaywidth + \dimen@\prevdepth + \nointerlineskip + \vskip-\ht\strutbox@ + \vskip-\dp\strutbox@ + \vbox{\noindent\hbox to\displaywidth{\hbox to#1{\strut@\hfill}}}% + \prevdepth\dimen@ + \fi + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\savecounters@} +% \begin{macro}{\restorecounters@} +% These are used during the measuring phase of the various display +% math environments to save and restore the values of all \latex/ +% counters. We make these local to a group, so nested environments +% works. +% +% Changed \cn{stepcounter} to |\csname c@...\endcsname| to avoid +% overhead of ifundefined test [mjd, 1995/01/20]. +% \begin{macrocode} +\def\savecounters@{% + \begingroup + \def\@elt##1{% + \global\csname c@##1\endcsname\the\csname c@##1\endcsname}% + \xdef\@gtempa{% + \cl@@ckpt + \let\@nx\restorecounters@\@nx\@empty + }% + \endgroup + \let\restorecounters@\@gtempa +} +% +\let\restorecounters@\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\savealignstate@} +% \begin{macro}{\restorealignstate@} +% These are used to save the values of various parameters that are +% shared by \env{align} and \env{gather} when the former is used +% inside the latter. +% \begin{macrocode} +\def\savealignstate@{% + \begingroup + \let\or\relax + \xdef\@gtempa{% + \global\totwidth@\the\totwidth@ + \global\row@\the\row@ + \gdef\@nx\tag@lengths{\tag@lengths}% + \let\@nx\restorealignstate@\@nx\@empty + }% + \endgroup + \let\restorealignstate@\@gtempa +} + +\let\restorealignstate@\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\savecolumn@} +% \begin{macro}{\restorecolumn@} +% +% \begin{macrocode} +\def\savecolumn@{% + \edef\restorecolumn@{% + \global\column@\number\column@ + \let\@nx\restorecolumn@\@nx\@empty + }% +} +\let\restorecolumn@\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Scanning the environment's body} +% +% Several of the math alignment macros must scan their body twice: +% once to determine how wide the columns are and then to actually +% typeset them. This means that we must collect all text in this body +% before calling the environment macros. +% +% \begin{macro}{\@envbody} +% We start by defining a token register to contain the body. +% \begin{macrocode} +\newtoks\@envbody +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\addto@envbody} +% Then we define a macro to add something (i.e.\ its argument) to the +% token register \cs{@envbody}. +% \begin{macrocode} +\def\addto@envbody#1{\global\@envbody\@xp{\the\@envbody#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\collect@body} +% The macro \cs{collect@body} starts the scan for the |\end{...}| +% command of the current environment. It takes a macro name as +% argument. This macro is supposed to take the whole body of the +% environment as its argument. For example, |\begin{align}| would +% call |\collect@body\@align| if |@align#1{...}| is the macro that +% sets the alignment with body \arg{1}. +% +% \begin{macrocode} +\def\collect@body#1{% + \@envbody{\@xp#1\@xp{\the\@envbody}}% + \edef\process@envbody{\the\@envbody\@nx\end{\@currenvir}}% + \@envbody\@emptytoks \def\begin@stack{b}% +% \end{macrocode} +% +% If we simply called \cs{collect@@body} directly, +% the error message for a \cn{par} token (usually from a blank line) +% would be +% \begin{verbatim} +% ! Paragraph ended before \collect@@body was complete. +% \end{verbatim} +% But we use a little finesse to get a more intelligible error +% message: +% \begin{verbatim} +% ! Paragraph ended before \multline* was complete. +% \end{verbatim} +% In order to avoid using up csnames unnecessarily we use the actual +% environment name as the name of the temporary function that is +% \cs{let} to \cs{collect@@body}; but then in order to preserve the +% theoretical possibility of nesting for environments that use +% \cs{collect@body} (not currently required by any \pkg{amsmath} +% environment [mjd,1999/06/23]), we do the \cs{let} inside a group. +% \begin{macrocode} + \begingroup + \@xp\let\csname\@currenvir\endcsname\collect@@body +% \end{macrocode} +% This small twist eliminates the need for \cs{expandafter}'s in +% \cs{collect@@body}. +% \begin{macrocode} + \edef\process@envbody{\@xp\@nx\csname\@currenvir\endcsname}% + \process@envbody +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\push@begins} +% When adding a piece of the current environment's contents to +% \cs{@envbody}, we scan it to check for additional \cn{begin} +% tokens, and add a `b' to the stack for any that we find. +% \begin{macrocode} +\def\push@begins#1\begin#2{% + \ifx\end#2\else b\@xp\push@begins\fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\collect@@body} +% \cs{collect@@body} takes two arguments: the first will consist of +% all text up to the next \cn{end} command, the second will be the +% \cn{end} command's argument. If there are any extra \cn{begin} +% commands in the body text, a marker is pushed onto a stack by the +% \cs{push@begins} function. Empty state for this stack means that we +% have reached the \cn{end} that matches our original \cn{begin}. +% Otherwise we need to include the \cn{end} and its argument in the +% material that we are adding to our environment body accumulator. +% +% \begin{histnote} +% In a former implementation, the error messages resulting from a +% typo in the environment name were unsatisfactory, because it was +% matching of the environment name that was used to determine the end +% of our environment body, instead of counting begin-end pairs. +% Thanks to Lars Hellstr\"{o}m for a suggestion that led to this +% improvement. [mjd,1999/06/23] +% \end{histnote} +% \begin{macrocode} +\def\collect@@body#1\end#2{% + \edef\begin@stack{\push@begins#1\begin\end \@xp\@gobble\begin@stack}% + \ifx\@empty\begin@stack + \endgroup + \@checkend{#2}% + \addto@envbody{#1}% + \else + \addto@envbody{#1\end{#2}}% + \fi + \process@envbody % A little tricky! Note the grouping +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Simple aligning environments} +% +% \begin{macro}{\math@cr@@@aligned} +% From tabskip we get an extra space of minalignsep after every +% second column; but when this falls at the right edge of the whole +% aligned structure, we need to cancel that space. +% \begin{macrocode} +\def\math@cr@@@aligned{% + \ifodd\column@ \let\next@\@empty + \else \def\next@{&\kern-\alignsep@}% + \fi + \next@ \cr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\start@aligned} +% The \env{aligned} and \env{alignedat} environments are identical +% except that the latter takes a mandatory argument to specify the +% number of align structures, while the former allows any number of +% align structures automatically (the use of \env{alignedat} is +% deprecated). So, they will be defined in terms of +% \cs{start@aligned}, which will take two arguments. The first +% argument specifies the placement of the environments; it is +% either |c|, |t|, or |b|. The second is the number of align +% structures; a value of~$-1$ means that an arbitrary number are +% allowed. +% \begin{macrocode} +\newcommand{\start@aligned}[2]{% + \RIfM@\else + \nonmatherr@{\begin{\@currenvir}}% + \fi + \savecolumn@ % Assumption: called inside a group +% \end{macrocode} +% The \cs{null} here is to keep the \cs{,} glue from causing the +% invocation of the clause in \tex/'s built-in tag placement +% algorithm that can cause an equation to be shifted all the way over +% to the margin. +% \begin{macrocode} + \alignedspace@left + \if #1t\vtop \else \if#1b \vbox \else \vcenter \fi \fi \bgroup + \maxfields@#2\relax + \ifnum\maxfields@>\m@ne + \multiply\maxfields@\tw@ +% \end{macrocode} +% Introduced new \cs{math@cr@@@} so we can provide standard error +% message for too many \qc{\&}'s in \env{alignedat}. +% \begin{macrocode} + \let\math@cr@@@\math@cr@@@alignedat + \alignsep@\z@skip + \else + \let\math@cr@@@\math@cr@@@aligned + \alignsep@\minalignsep + \fi +% \end{macrocode} +% Reset the meaning of \cn{\\}. +% \begin{macrocode} + \Let@ \chardef\dspbrk@context\@ne +% \end{macrocode} +% Restore the default definition of \cn{tag} (error message), in +% case \env{aligned} is used inside, e.g., a \env{gather} +% environment that accepts \cn{tag}. +% \begin{macrocode} + \default@tag + \spread@equation % no-op if already called +% \end{macrocode} +% Finally we start the alignment itself. For \env{aligned} we add +% \cs{minalignsep} after every second column to mimic the +% behavior of \env{align}. For \env{alignedat} the user has to +% specify interalign space explicitly. +% \begin{macrocode} + \global\column@\z@ + \ialign\bgroup + &\column@plus + \hfil + \strut@ + $\m@th\displaystyle{##}$% + \tabskip\z@skip + &\column@plus + $\m@th\displaystyle{{}##}$% + \hfil + \tabskip\alignsep@ + \crcr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@@@alignedat} +% \cs{math@cr@@@alignedat} checks to make sure the user hasn't put in +% too many \qc{\&}s in \env{alignedat}. Since \env{alignedat} +% doesn't use \cs{displ@y@}, we also reset \cs{column@} here. Note +% than in \env{aligned}, \cs{column@} will increase without bound, +% since it never gets reset, but this is harmless. +% \begin{macrocode} +\def\math@cr@@@alignedat{% + \ifnum\column@>\maxfields@ + \begingroup + \measuring@false + \@amsmath@err{Extra & on this line}% + {\the\andhelp@}% "An extra & here is disastrous" + \endgroup + \fi + \global\column@\z@ + \cr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\alignsafe@testopt} +% Testing for an optional argument can be really, really tricky in +% certain complicated contexts. This we discovered by getting some +% bug reports for uses of \env{aligned}. So here is a safer +% form of \latex/'s \cs{@testopt} function. +% \begin{macrocode} +\def\alignsafe@testopt#1#2{% + \relax\iffalse{\fi\ifnum`}=0\fi + \@ifnextchar[% + {\let\@let@token\relax \ifnum`{=\z@\fi\iffalse}\fi#1}% + {\let\@let@token\relax \ifnum`{=\z@\fi\iffalse}\fi#1[#2]}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{aligned} +% The \env{aligned} environment takes an optional argument that +% indicates its vertical position in relation to surrounding +% material: |t|, |c|, or |b| for top, center, or bottom. +% \begin{macrocode} +\newenvironment{aligned}{% + \let\@testopt\alignsafe@testopt + \aligned@a +}{% + \crcr\egroup + \restorecolumn@ + \egroup +} +\newcommand{\aligned@a}[1][c]{\start@aligned{#1}\m@ne} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{alignedat} +% To get a top or bottom positioned \env{alignedat} structure, you +% would write something like +% \begin{verbatim} +% \begin{alignedat}[t]{3} +% \end{verbatim} +% +% \begin{macrocode} +\newenvironment{alignedat}{% + \let\@testopt\alignsafe@testopt + \alignedat@a +}{% + \endaligned +} +\newcommand{\alignedat@a}[1][c]{\start@aligned{#1}} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{gathered} +% The \env{gathered} environment is for several lines that are +% centered independently. +% \begin{macrocode} +\newenvironment{gathered}[1][c]{% + \RIfM@\else + \nonmatherr@{\begin{gathered}}% + \fi + \alignedspace@left + \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi \bgroup + \Let@ \chardef\dspbrk@context\@ne \restore@math@cr + \spread@equation + \ialign\bgroup + \hfil\strut@$\m@th\displaystyle##$\hfil + \crcr +}{% + \endaligned +} +% \end{macrocode} +% \end{environment} +% +% +% \subsection{The \env{gather} environment} +% +% \begin{macro}{\start@gather} +% \begin{macrocode} +\def\start@gather#1{% + \RIfM@ + \nomath@env + \DN@{\@namedef{end\@currenvir}{}\@gobble}% + \else + $$% + #1% + \ifst@rred \else \global\@eqnswtrue \fi + \let\next@\gather@ + \fi + \collect@body\next@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{gather} +% \begin{environment}{gather*} +% \begin{macrocode} +\newenvironment{gather}{% + \start@gather\st@rredfalse +}{% + \math@cr \black@\totwidth@ \egroup + $$\ignorespacesafterend +} + +\newenvironment{gather*}{% + \start@gather\st@rredtrue +}{% + \endgather +} +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \begin{macro}{\gather@} +% \begin{macrocode} +\def\gather@#1{% + \ingather@true \let\split\insplit@ + \let\tag\tag@in@align \let\label\label@in@display + \chardef\dspbrk@context\z@ + \intertext@ \displ@y@ \Let@ + \let\math@cr@@@\math@cr@@@gather + \gmeasure@{#1}% + \global\shifttag@false + \tabskip\z@skip + \global\row@\@ne + \halign to\displaywidth\bgroup + \strut@ + \setboxz@h{$\m@th\displaystyle{##}$}% + \calc@shift@gather + \set@gather@field + \tabskip\@centering + &\setboxz@h{\strut@{##}}% + \place@tag@gather + \tabskip \iftagsleft@ \gdisplaywidth@ \else \z@skip \span\fi + \crcr + #1% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\gmeasure@} +% \begin{macrocode} +\def\gmeasure@#1{% + \begingroup + \measuring@true + \totwidth@\z@ + \global\let\tag@lengths\@empty + \savecounters@ + \setbox\@ne\vbox{% + \everycr{\noalign{\global\tag@false + \global\let\raise@tag\@empty \global\column@\z@}}% + \let\label\@gobble + \halign{% + \setboxz@h{$\m@th\displaystyle{##}$}% + \ifdim\wdz@>\totwidth@ + \global\totwidth@\wdz@ + \fi + &\setboxz@h{\strut@{##}}% + \savetaglength@ + \crcr + #1% + \math@cr@@@ + }% + }% + \restorecounters@ + \if@fleqn + \global\advance\totwidth@\@mathmargin + \fi + \iftagsleft@ + \ifdim\totwidth@>\displaywidth + \global\let\gdisplaywidth@\totwidth@ + \else + \global\let\gdisplaywidth@\displaywidth + \fi + \fi + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@@@gather} +% Modified \cs{math@cr@@@gather} so that it always puts in the +% final field, which needs to be done under the new method for +% determining tag placement. This is probably more efficient +% anyway. +% +% \begin{macrocode} +\def\math@cr@@@gather{% + \ifst@rred\nonumber\fi + &\relax + \make@display@tag + \ifst@rred\else\global\@eqnswtrue\fi +% \end{macrocode} +% We advance \cs{row@} here, rather than at the beginning of the +% preamble, because otherwise the \env{split} environment will +% cause \cs{row@} to be advanced twice instead of once. +% \begin{macrocode} + \global\advance\row@\@ne + \cr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\calc@shift@gather} +% \cs{calc@shift@gather} has must make two decisions: (1) whether the +% equation tag for the current line should be put on a separate +% line and (2) what the distance between the equation and the +% equation tag should be. We implement \tex/'s built-in +% tag-placement as well as possible, with one improvement: the +% minimum separation between tag and equation is now a +% user-settable parameter. +% +% [1995/01/17] Added a check to make sure that the width of the tag +% on the current line is $>0$ before testing to see if tagwidth + +% linewidth + mintagsep $>$ displaywidth. Since an imbedded align +% shows up as line with width \cn{displaywidth}, and even lines +% without a tag get processed as if an empty tag were present, the +% result was that the empty tag assigned to the line containing the +% align was being shifted downwards, creating extra space after the +% align. +% \begin{macrocode} +\def\calc@shift@gather{% + \dimen@\mintagsep\relax + \tagwidth@\tag@width\row@\relax +% \end{macrocode} +% If we're in \opt{fleqn} mode, there is no flexibility about +% placement of the equation, so all we can do is see if there's +% room for the tag in the given margin. +% \begin{macrocode} + \if@fleqn + \global\eqnshift@\@mathmargin + \ifdim\tagwidth@>\z@ + \advance\dimen@\tagwidth@ + \iftagsleft@ + \ifdim\dimen@>\@mathmargin + \global\shifttag@true + \fi + \else + \advance\dimen@\@mathmargin + \advance\dimen@\wdz@ + \ifdim\dimen@>\displaywidth + \global\shifttag@true + \fi + \fi + \fi + \else + \global\eqnshift@\displaywidth + \global\advance\eqnshift@-\wdz@ + \ifdim\tagwidth@>\z@ + \multiply\dimen@\tw@ + \advance\dimen@\wdz@ + \advance\dimen@\tagwidth@ + \ifdim\dimen@>\displaywidth + \global\shifttag@true + \else + \ifdim\eqnshift@<4\tagwidth@ + \global\advance\eqnshift@-\tagwidth@ + \fi + \fi + \fi + \global\divide\eqnshift@\tw@ + \iftagsleft@ + \global\eqnshift@-\eqnshift@ + \global\advance\eqnshift@\displaywidth + \global\advance\eqnshift@-\wdz@ + \fi + \ifdim\eqnshift@<\z@ + \global\eqnshift@\z@ + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\place@tag@gather} +% \begin{macro}{\set@gather@field} +% \begin{macrocode} +\def\place@tag@gather{% + \iftagsleft@ + \kern-\gdisplaywidth@ + \ifshifttag@ + \rlap{\vbox{% + \normalbaselines + \boxz@ + \vbox to\lineht@{}% + \raise@tag + }}% + \global\shifttag@false + \else + \rlap{\boxz@}% + \fi + \else + \ifdim\totwidth@>\displaywidth + \dimen@\totwidth@ + \advance\dimen@-\displaywidth + \kern-\dimen@ + \fi + \ifshifttag@ + \llap{\vtop{% + \raise@tag + \normalbaselines + \setbox\@ne\null + \dp\@ne\lineht@ + \box\@ne + \boxz@ + }}% + \global\shifttag@false + \else + \llap{\boxz@}% + \fi + \fi +} +% +\def\set@gather@field{% + \iftagsleft@ + \global\lineht@\ht\z@ + \else + \global\lineht@\dp\z@ + \fi + \kern\eqnshift@ + \boxz@ + \hfil +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{The \env{align} family of environments} +% +% The \env{align}, \env{flalign}, \env{alignat}, \env{xalignat}, +% and \env{xxalignat} environments are virtually +% identical, and thus will share much code. We'll refer to the +% environments generically as ``\env{align}'' and will +% distinguish between them explicitly +% only when necessary. +% +% \begin{macro}{\ifxxat@} +% \begin{macro}{\ifcheckat@} +% \begin{macro}{\xatlevel@} +% The \cs{xatlevel@} macro will be used, informally speaking, to +% distinguish between the \env{alignat} and \env{xalignat}, and +% \env{xxalignat} environments. +% +% \begin{macrocode} +\newif\ifxxat@ + +\newif\ifcheckat@ + +\let\xatlevel@\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\start@align} +% \cs{start@align} will be called by all of the \env{align}-like +% environments. The first argument will be the \cs{xatlevel@}, +% i.e., 0, 1, or~2; the second argument will be either +% \cs{st@rredtrue} or \cs{st@rredfalse}. The third argument will +% be the number of aligned +% structures in the environment (either as supplied by the user, or +% $-1$ to indicate that checking shouldn't be done). After +% performing the appropriate error detection and initialization, +% \cs{start@align} calls \cs{align@}. +% +% Note that the \cs{equation} counter is no longer stepped at the +% beginning of these environments. +% +% TODO: Implement \cs{shoveleft} and \cs{shoveright} for +% \env{align}. +% \begin{macrocode} +\def\start@align#1#2#3{% + \let\xatlevel@#1% always \z@, \@ne, or \tw@ + \maxfields@#3\relax + \ifnum\maxfields@>\m@ne + \checkat@true + \ifnum\xatlevel@=\tw@ + \xxat@true + \fi + \multiply\maxfields@\tw@ + \else + \checkat@false + \fi + \ifingather@ + \iffalse{\fi\ifnum0=`}\fi + \DN@{\vcenter\bgroup\savealignstate@\align@#2}% + \else + \ifmmode + \if@display + \DN@{\align@recover}% + \else + \nomath@env + \DN@{\@namedef{end\@currenvir}{}\@gobble}% + \fi + \else + $$% + \let\split\insplit@ + \DN@{\align@#2}% + \fi + \fi + \collect@body\next@ +} +% \end{macrocode} +% +% With version 1.2 of \pkg{amsmath}, it was possible to use +% \env{align*} and relatives in certain wrong contexts without +% getting an error, e.g. +% \begin{verbatim} +% \begin{equation*} +% \begin{align*} +% ... +% \end{align*} +% \end{equation*} +% \end{verbatim} +% +% For backward compatibility we therefore give only a warning for +% this condition instead of a full error, and try to recover using +% the \env{aligned} environment. The alignment of the material may be +% adversely affected but it will at least remain readable. +% \begin{macrocode} +\def\align@recover#1#2#3{% + \endgroup + \@amsmath@err{% +Erroneous nesting of equation structures;\MessageBreak +trying to recover with `aligned'% + }\@ehc + \begin{aligned}\relax#1\end{aligned}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{align} +% \begin{environment}{align*} +% \begin{environment}{flalign} +% \begin{environment}{flalign*} +% \begin{environment}{alignat} +% \begin{environment}{alignat*} +% \begin{environment}{xalignat} +% \begin{environment}{xalignat*} +% \begin{environment}{xxalignat} +% The definitions of the various \env{align} environments are quite +% straight-forward. +% +% \begin{macrocode} +\newenvironment{alignat}{% + \start@align\z@\st@rredfalse +}{% + \endalign +} +\newenvironment{alignat*}{% + \start@align\z@\st@rredtrue +}{% + \endalign +} +\newenvironment{xalignat}{% + \start@align\@ne\st@rredfalse +}{% + \endalign +} +\newenvironment{xalignat*}{% + \start@align\@ne\st@rredtrue +}{% + \endalign +} +\newenvironment{xxalignat}{% + \start@align\tw@\st@rredtrue +}{% + \endalign +} +\newenvironment{align}{% + \start@align\@ne\st@rredfalse\m@ne +}{% + \math@cr \black@\totwidth@ + \egroup + \ifingather@ + \restorealignstate@ + \egroup + \nonumber + \ifnum0=`{\fi\iffalse}\fi + \else + $$% + \fi + \ignorespacesafterend +} +\newenvironment{align*}{% + \start@align\@ne\st@rredtrue\m@ne +}{% + \endalign +} +\newenvironment{flalign}{% + \start@align\tw@\st@rredfalse\m@ne +}{% + \endalign +} +\newenvironment{flalign*}{% + \start@align\tw@\st@rredtrue\m@ne +}{% + \endalign +} +% \end{macrocode} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% +% +% \begin{macro}{\align@} +% TODO: Some of these sets of initializations show up in multiple +% places. It might be worth making an abbreviation for them. +% +% \begin{macrocode} +\def\align@#1#2{% + \inalign@true \intertext@ \Let@ \chardef\dspbrk@context\z@ + \ifingather@\else\displ@y@\fi + \let\math@cr@@@\math@cr@@@align + \ifxxat@\else \let\tag\tag@in@align \fi + \let\label\label@in@display + #1% set st@r + \ifst@rred\else \global\@eqnswtrue \fi + \measure@{#2}% + \global\row@\z@ + \tabskip\eqnshift@ + \halign\bgroup + \span\align@preamble\crcr + #2% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@@@align} +% \begin{macrocode} +\def\math@cr@@@align{% + \ifst@rred\nonumber\fi + \if@eqnsw \global\tag@true \fi + \global\advance\row@\@ne + \add@amps\maxfields@ + \omit + \kern-\alignsep@ + \iftag@ + \setboxz@h{\@lign\strut@{\make@display@tag}}% + \place@tag + \fi + \ifst@rred\else\global\@eqnswtrue\fi + \global\lineht@\z@ + \cr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@@@align@measure} +% \begin{macrocode} +\def\math@cr@@@align@measure{% + &\omit + \global\advance\row@\@ne + \ifst@rred\nonumber\fi + \if@eqnsw \global\tag@true \fi + \ifnum\column@>\maxfields@ + \ifcheckat@ + \begingroup + \measuring@false + \@amsmath@err{Extra & on this line}% + {\the\andhelp@}% "An extra & here is disastrous" + \endgroup + \else + \global\maxfields@\column@ + \fi + \fi + \setboxz@h{\@lign\strut@{% + \if@eqnsw + \stepcounter{equation}% + \tagform@\theequation + \else + \iftag@\df@tag\fi + \fi + }}% + \savetaglength@ + \ifst@rred\else\global\@eqnswtrue\fi + \cr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\field@lengths} +% \begin{macro}{\savefieldlength@} +% \begin{macro}{\fieldlengths@} +% \begin{macrocode} +\let\field@lengths\@empty + +\def\savefieldlength@{% + \begingroup + \let\or\relax + \xdef\field@lengths{% + \field@lengths + \ifnum\column@=0 + \or + \else + ,% + \fi + \the\wdz@ + }% + \endgroup +} + +\def\fieldlengths@#1{% + \ifcase\@xp#1\field@lengths\fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\maxcolumn@widths} +% \cs{maxcolumn@widths} will be used to hold the widths of the +% fields of the \env{alignat} environment. The widths will be +% separated by the token \cn{or}, making it easy to extract a given +% width using \cn{ifcase}. +% \begin{macrocode} +\let\maxcolumn@widths\@empty +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\maxcol@width} +% \cs{maxcol@width} $n$ = maximum width of $n$th column of the current +% \env{alignat} (i.e., the $n$th field of \cs{maxcolumn@widths}.) +% It expands to a \<dimen>, so it can be used as the right-hand +% side of a \<variable assignment> or \<arithmetic> statement. +% It's argument can be any \<number>, \<integer variable> or macro +% that expands to one of these. [Check to make sure this is true.] +% +% This is subtler than it looks. +% \begin{macrocode} +\def\maxcol@width#1{% + \ifcase\@xp#1\maxcolumn@widths\fi\relax +} +% \end{macrocode} +% \end{macro} +% +% Now comes the real fun. A typical \env{align} environments looks +% something like this, where the vertical bars mark the edges of +% the fields of the underlying \cs{halign}: +% \[ +% \makeatletter\tabskip\@centering\offinterlineskip +% \halign to\displaywidth{%^^A +% &$\strut$\vrule\hfil$\m@th\displaystyle{\@lign#}$\vrule +% \tabskip1pt&\vrule$\m@th\displaystyle{\@lign#}$\hfil\vrule +% \tabskip\@centering\cr +% \omit\small\hfil 1\hfil &\omit\small\hfil 2 &\omit\small\hfil +% 3\hfil &\omit\small\hfil 4\hfil & \omit\small\hfil 5\hfil +% &\omit\small\hfil 6\hfil\cr +% \noalign{\vskip8pt\relax} +% V_i + q_i v_j & =v_i , & X_i & = x_i - q_i x_j, +% & U_i & = u_i,\qquad +% \hbox{for $i\ne j$;} %&\omit\hfill \llap{(3)} +% \cr +% V_j & = v_j, & X_j & = x_j, +% & U_j & = u_j + \sum_{i\ne j} q_i u_i. %&\omit\hfill \llap{(4)} +% \cr} +% \] +% Note that each align structure consists of two fields, with no +% space between them (a small space has been added here to +% highlight the boundaries). Furthermore, the text inside the +% odd-numbered fields is flushright, while the text inside the +% even-numbered fields is flushleft. The equation tags (shown on +% the right here) can be on either the right or the left. If there +% is not room (in a sense to be defined shortly) for the tag on the +% same line as the equation, the tag will be shifted to a separate +% line. +% +% Each environment also has a certain number of ``flexible +% spaces,'' meaning spaces whose width we are allowed to adjust to +% take up the amount of ``free space'' in the line, meaning the +% space not taken up by the equation tag and the fields of the +% underlying \cs{halign}. +% +% The flexible spaces come in two flavors: interalign spaces and +% margin spaces. If there are $n$ align structures ($n=3$ in the +% illustration above), there are $n-1$ interalign spaces, unless we +% are in an \env{alignat} environment, in which case there are no +% flexible interalign spaces. +% +% The number of margin spaces is a little more complicated: +% Normally, there are two, but if we're in \opt{fleqn} mode, there +% is only one. Furthermore, if we're in an \env{xxalignat} or +% \env{flalign} environment (corresponding to $\cs{xatlevel@} = 2$, +% then there are no flexible margin spaces. +% +% Calculating the interalign and margin spaces is done in two +% stages. +% +% First, the total amount of free space is divided uniformly among +% all the flexible spaces, without regard for the lengths of the tags +% on the various lines. For the non-\opt{fleqn} case, this +% corresponds to centering the align structures between the margins. +% Note that in \opt{fleqn} mode, the right margin is still allowed to +% be larger than \cs{@mathmargin}. This introduces an element of +% asymmetry into the appearance of the environment, but it has the +% advantage of leaving more space for equation tags in the right +% margin. If the right margin were constrained to be equal to the +% left margin in this case, tags would need to be shifted to a +% separate line more often than would be desirable. +% +% Ordinarily, all flexible spaces will be given the same width. +% However, this is not invariably true, since the interalign spaces +% are constrained to be at least \cs{minalignsep} wide, while---in +% the absence of equation tags, at least---the margin spaces are +% allowed to shrink to zero. As we shall see in a minute, if there +% are tags in the environment, then the margins are also bounded +% below by \cs{mintagsep}. +% +% Next, we examine each line of the environment that has a tag to +% see if there is a gap of at least \cs{mintagsep} between the +% equation and its tag. If there isn't, we attempt to center the +% equation between the tag and the opposite margin, leaving a gap +% of at least \cs{mintagsep} on either side, in order to preserve +% some symmetry, i.e., we want the equation to \emph{look} like +% it's centered between the margin and the tag, so we don't want +% the margin space to be less than the gap between the tag and the +% equation. (Arguably, it would be better to allow the margin +% space to shrink to zero in this case in order to avoid shifting +% the tag to a separate line at any cost, but that would require +% all of our calculations to be a little more complicated and hence +% a little slower.) Finally, if no values of the interalign spaces +% and the margins (with the constraints outlined above) will +% produce an acceptable distance between the equation and its tag, +% then the tag will be shifted to a separate line. +% +% \begin{macro}{\measure@} +% \cs{measure@} collects the various bits of information that we'll +% need to perform the calculations outlined above, namely, the +% number of align structures in the environment, the natural +% lengths of the fields on each row, the maximum widths of each +% column, and the widths of the equation tags on each line. It +% also calculates the number of flexible interalign and margin +% spaces and computes the initial values of the parameters +% \cs{eqnshift@} and \cs{alignsep@}, which correspond to the widths +% of the margins and the interalign spaces, respectively. +% \begin{macrocode} +\def\measure@#1{% + \begingroup + \measuring@true + \global\eqnshift@\z@ + \global\alignsep@\z@ + \global\let\tag@lengths\@empty + \global\let\field@lengths\@empty + \savecounters@ + \global\setbox0\vbox{% + \let\math@cr@@@\math@cr@@@align@measure + \everycr{\noalign{\global\tag@false + \global\let\raise@tag\@empty \global\column@\z@}}% + \let\label\@gobble + \global\row@\z@ + \tabskip\z@ + \halign{\span\align@preamble\crcr + #1% + \math@cr@@@ + \global\column@\z@ + \add@amps\maxfields@\cr + }% + }% + \restorecounters@ +% \end{macrocode} +% It's convenient to have \cs{maxfields@} rounded up to the nearest +% even number, so that \cs{maxfields@} is precisely twice the +% number of align structures. +% \begin{macrocode} + \ifodd\maxfields@ + \global\advance\maxfields@\@ne + \fi +% \end{macrocode} +% It doesn't make sense to have a single align structure in either +% \env{flalign} or \env{xxalignat}. So, we check for that case now +% and, if necessary, switch to an \env{align} or \env{alignat}. +% Arguably, we should issue a warning message, but why bother? +% \begin{macrocode} + \ifnum\xatlevel@=\tw@ + \ifnum\maxfields@<\thr@@ + \let\xatlevel@\z@ + \fi + \fi +% \end{macrocode} +% |\box0| now contains the lines of the \cs{halign}. After the +% following maneuver, |\box1| will contain the last line of the +% \cs{halign}, which is what we're interested in. (Incidentally, +% the penalty we're removing is the \cs{@eqpen} inserted by +% \cs{math@cr}. Normally, this is \cs{interdisplaylinepenalty}, +% unless the user has overridden that with a \cs{displaybreak} +% command.) +% \begin{macrocode} + \setbox\z@\vbox{% + \unvbox\z@ \unpenalty \global\setbox\@ne\lastbox + }% +% \end{macrocode} +% |\box1| begins with \cs{tabskip} glue and contains alternating +% \cs{hbox}es (the fields whose widths we're trying to get) and +% \cs{tabskip} glue [need better diagram]: +% \begin{verbatim} +% \hbox{\tabskip\hbox\tabskip...\hbox\tabskip}\end{verbatim} +% In fact, all the \cs{tabskip} glue will be 0pt, because all the +% \cs{tabskip}s in an \env{alignat} environment have a natural +% width of 0pt, and the \cs{halign} has been set in its natural +% width. +% +% One nice result of this is that we can read \cs{totwidth@} off +% immediately, since it is just the width of |\box1|, plus +% \cs{@mathmargin} if we're in \opt{fleqn} mode. (Actually, we +% also have to take \cs{minalignsep} into account, but we'll do +% that later): +% \begin{macrocode} + \global\totwidth@\wd\@ne + \if@fleqn \global\advance\totwidth@\@mathmargin \fi +% \end{macrocode} +% Now we initialize \cs{align@lengths} and start peeling the boxes +% off, one by one, and adding their widths to \cs{align@lengths}. +% We stop when we run out of boxes, i.e., when \cs{lastbox} returns +% a void box. We're going to build a list using \cs{or} as a +% delimiter, so we want to disable it temporarily. +% \begin{macrocode} + \global\let\maxcolumn@widths\@empty + \begingroup + \let\or\relax + \loop + \global\setbox\@ne\hbox{% + \unhbox\@ne \unskip \global\setbox\thr@@\lastbox + }% + \ifhbox\thr@@ + \xdef\maxcolumn@widths{ \or \the\wd\thr@@ \maxcolumn@widths}% + \repeat + \endgroup +% \end{macrocode} +% Now we calculate the number of flexible spaces and the initial +% values of \cs{eqnshift@} and \cs{alignsep@}. +% We start by calculating $\cs{displaywidth}-\cs{totwidth@}$, +% which gives us the total amount of ``free space'' in a row. +% \begin{macrocode} + \dimen@\displaywidth + \advance\dimen@-\totwidth@ +% \end{macrocode} +% Next we calculate the number of columns of flexible spaces in the +% display, which depends on whether we're in \opt{fleqn} mode and +% in which particular environment we are in. +% +% We use \cs{@tempcnta} to store the total number of flexible spaces +% in the align and \cs{@tempcntb} for the number of interalign +% spaces. +% \begin{macrocode} + \ifcase\xatlevel@ +% \end{macrocode} +% In \env{alignat}, the interalign spaces are under user control, +% not ours. So, we set \cs{alignsep@} and \cs{minalignsep} both +% equal to 0pt. Later, when calculating a new value for +% \cs{alignsep@}, we will only save the new value if it is less +% than the current value of \cs{alignsep@} (i.e., \cs{alignsep@} +% will never increase). Since the values we calculate will never +% be negative, this will ensure that \cs{alignsep@} remains zero in +% \env{alignat}. +% \begin{macrocode} + \global\alignsep@\z@ + \let\minalignsep\z@ + \@tempcntb\z@ +% \end{macrocode} +% In \opt{fleqn} mode, the left margin---and hence the right margin +% in this case---is fixed. Otherwise, we divide the free space +% equally between the two margins. +% \begin{macrocode} + \if@fleqn + \@tempcnta\@ne + \global\eqnshift@\@mathmargin + \else + \@tempcnta\tw@ + \global\eqnshift@\dimen@ + \global\divide\eqnshift@\@tempcnta + \fi + \or +% \end{macrocode} +% In an \env{align} or \env{xalignat} environment with $n$ aligned +% structures, there are $n-1$ interalign spaces and either 1 or~2 +% flexible margins, depending on whether we're in \opt{fleqn} mode +% or not. +% \begin{macrocode} + \@tempcntb\maxfields@ + \divide\@tempcntb\tw@ + \@tempcnta\@tempcntb + \advance\@tempcntb\m@ne +% \end{macrocode} +% If we are in \opt{fleqn} mode, we fix the left margin and divide +% the free space equally among the interalign spaces and the right +% margin. +% \begin{macrocode} + \if@fleqn + \global\eqnshift@\@mathmargin + \global\alignsep@\dimen@ + \global\divide\alignsep@\@tempcnta + \else +% \end{macrocode} +% Otherwise, we divide the free space equally among the interalign +% spaces and both margins. +% \begin{macrocode} + \global\advance\@tempcnta\@ne + \global\eqnshift@\dimen@ + \global\divide\eqnshift@\@tempcnta + \global\alignsep@\eqnshift@ + \fi + \or +% \end{macrocode} +% Finally, if we're in an \env{flalign} or \env{xxalignat} +% environment, there are no flexible margins and $n-1$ flexible +% interalign spaces. +% \begin{macrocode} + \@tempcntb\maxfields@ + \divide\@tempcntb\tw@ + \global\advance\@tempcntb\m@ne + \global\@tempcnta\@tempcntb + \global\eqnshift@\z@ + \global\alignsep@\dimen@ +% \end{macrocode} +% If we're in \opt{fleqn} mode, we need to add back the +% \cs{@mathmargin} that was removed when \cs{dimen@} was originally +% calculated above. +% \begin{macrocode} + \if@fleqn + \global\advance\alignsep@\@mathmargin\relax + \fi + \global\divide\alignsep@\@tempcntb + \fi +% \end{macrocode} +% Now we make sure \cs{alignsep@} isn't too small. +% \begin{macrocode} + \ifdim\alignsep@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \ifdim\eqnshift@>\z@ + \if@fleqn\else + \global\eqnshift@\displaywidth + \global\advance\eqnshift@-\totwidth@ + \global\advance\eqnshift@-\@tempcntb\alignsep@ + \global\divide\eqnshift@\tw@ + \fi + \fi + \fi + \ifdim\eqnshift@<\z@ + \global\eqnshift@\z@ + \fi + \calc@shift@align +% \end{macrocode} +% Next, we calculate the value of \cs{tagshift@}. This is the glue +% that will be inserted in front of the equation tag to make sure +% it lines up flush against the appropriate margin. +% \begin{macrocode} + \global\tagshift@\totwidth@ + \global\advance\tagshift@\@tempcntb\alignsep@ + \if@fleqn + \ifnum\xatlevel@=\tw@ + \global\advance\tagshift@-\@mathmargin\relax + \fi + \else + \global\advance\tagshift@\eqnshift@ + \fi + \iftagsleft@ \else + \global\advance\tagshift@-\displaywidth + \fi +% \end{macrocode} +% Finally, we increase \cs{totwidth@} by an appropriate multiple of +% \cs{minalignsep}. If the result is greater than +% \cs{displaywidth}, it means that at least one line in the +% \env{align} is overfull and we will issue an appropriate warning +% message (via \cs{bl@ck}) at the end of the environment. +% \begin{macrocode} + \dimen@\minalignsep\relax + \global\advance\totwidth@\@tempcntb\dimen@ + \ifdim\totwidth@>\displaywidth + \global\let\displaywidth@\totwidth@ + \else + \global\let\displaywidth@\displaywidth + \fi + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% The code for calculating the appropriate placement of equation +% tags in the \env{align} environments is quite complicated and +% varies wildly depending on the settings of the |tagsleft@| and +% |@fleqn| switches. To minimize memory and hash space usage, we +% only define the variant appropriate for the current setting of +% those switches. +% +% It would be worthwhile to examine this code more closely someday +% and see if it could be optimized any. +% +% \paragraph{Tag placement when \cs{tagsleft@true}, +% \cs{@fleqntrue}.} +% +% We begin with the version of \cs{calc@shift@align} appropriate +% for flush-left equations with tags on the left. +% +% \begin{macro}{\calc@shift@align} +% This is the simplest case. Since the left margin is fixed, in +% general the only thing to do is check whether there is room for +% the tag in the left margin. The only exception is that if +% $\cs{eqnshift@} = 0\,\mathrm{pt}$---meaning that we're in a +% \env{flalign} environment and this is the first line with a tag +% that we've encountered---then we set $\cs{eqnshift@} = +% \cs{@mathmargin}$ and recalculate \cs{alignsep@}. This is done +% by \cs{x@calc@shift@lf}. +% \begin{macrocode} +\iftagsleft@\if@fleqn + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup +% \end{macrocode} +% \cs{@tempdima} is initialized to $\cs{@mathmargin} - +% \cs{mintagsep}$, which yields the maximum size of a tag that will +% not be shifted to another line. +% \begin{macrocode} + \@tempdima\@mathmargin\relax + \advance\@tempdima-\mintagsep\relax +% \end{macrocode} +% Now we examine each row in turn. If the width of the tag on the +% line is non-positive---meaning either that there is no tag or +% else that the user has forced it to have zero width---we mark the +% tag to remain unshifted. Otherwise, we call \cs{x@calc@shift@lf} +% to determine whether any adjustments need to be made to +% \cs{eqnshift@} and \cs{alignsep@}. Note the difference in +% treatment of zero-width tags between this code and \tex/'s +% built-in algorithm: here, a width of zero prohibits the tag from +% being shifted, while in \tex/'s built-in algorithm, a width of +% zero forces the tag to be shifted. +% \begin{macrocode} + \loop + \ifnum\row@>0 + \ifdim\tag@width\row@>\z@ + \x@calc@shift@lf + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@calc@shift@lf} +% As mentioned above, \cs{x@calc@shift@lf} first checks to see if +% the current left margin is set to 0 and, if so, resets it to +% \cs{@mathmargin} and recalculates \cs{alignsep@}. Next, it +% checks whether the length of the current tag exceeds the +% previously calculated limit and, if so, marks the tag to be +% shifted to a separate line. +% \begin{macrocode} + \def\x@calc@shift@lf{% + \ifdim\eqnshift@=\z@ + \global\eqnshift@\@mathmargin\relax + \alignsep@\displaywidth + \advance\alignsep@-\totwidth@ + \global\divide\alignsep@\@tempcntb + \ifdim\alignsep@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \fi + \fi + \ifdim\tag@width\row@>\@tempdima + \saveshift@1% + \else + \saveshift@0% + \fi + } +\fi\fi +% \end{macrocode} +% \end{macro} +% +% \paragraph{Tag placement when \cs{tagsleft@false}, +% \cs{@fleqntrue}.} +% +% Next we consider the case when equations are flush-left, but tags +% are on the right. This case is somewhat more complicated than +% the previous one, since we can adjust the right margin by varying +% the inter-align separatin. Thus, when a tag is found to be too +% close to its equation, we first attempt to decrease +% \cs{alignsep@} enough to move the equation off to an acceptable +% distance. Only if that would require a value of \cs{alignsep@} +% less than \cs{minalignsep} do we move the tag to a separate line. +% +% \begin{macro}{\calc@shift@align} +% This version of \cs{calc@shift@align} differs from the previous +% version only in calling \cs{x@calc@shift@rf} rather than +% \cs{x@calc@shift@lf}. +% \begin{macrocode} +\iftagsleft@\else\if@fleqn + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup + \loop + \ifnum\row@>0 + \ifdim\tag@width\row@>\z@ + \x@calc@shift@rf + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@calc@shift@rf} +% To start, we need to know two quantities: the number of align +% structures in the current row and the ``effective length'' of the +% row, defined as the distance from the left margin to the +% right edge of the text assuming that \cs{eqnshift@} and +% \cs{alignsep@} are both~0. To get the number of align +% structures, we first count the number of columns by counting the +% number of entries in the \cs{fieldlengths@} for the current row. +% The effective length is calcuated by \cs{x@rcalc@width} and put +% in the temporary register \cs{@tempdimc}, using \cs{@tempdimb} as +% an auxiliary variable. +% \begin{macrocode} + \def\x@calc@shift@rf{% + \column@\z@ + \@tempdimb\z@ + \@tempdimc\z@ + \edef\@tempb{\fieldlengths@\row@}% + \@for\@tempa:=\@tempb\do{% + \advance\column@\@ne + \x@rcalc@width + }% + \begingroup +% \end{macrocode} +% If there are $n$ columns in the current row, then there are +% $\lfloor (n+1)/2 \rfloor$ align structures and $\lfloor (n-1)/2 +% \rfloor$ interalign spaces. +% \begin{macrocode} + \advance\column@\m@ne + \divide\column@\tw@ +% \end{macrocode} +% If this is smaller than the maximum number of interalign spaces +% in the environment, then we need to reduce \cs{@tempcnta} (the +% total number of flexible spaces in the current line) by +% $\cs{@tempcntb} - \cs{column@}$ and reset \cs{@tempcntb} to +% \cs{column@}. +% \begin{macrocode} + \ifnum\@tempcntb>\column@ + \advance\@tempcnta-\@tempcntb + \advance\@tempcnta\column@ + \@tempcntb\column@ + \fi +% \end{macrocode} +% Next, we add the width of the tag and the (fixed) left margin to +% the effective length calculated above. This can be used to +% calculate how much ``free space'' there is in the current line +% and thus how much leeway we have to increase the amount of space +% between the tag and the equation. +% \begin{macrocode} + \tagwidth@\tag@width\row@\relax + \@tempdima\eqnshift@ + \advance\@tempdima\@tempdimc\relax + \advance\@tempdima\tagwidth@ +% \end{macrocode} +% The first thing to check is whether the tag should be shifted to +% a separate line. To do this, we add the minimum interalign +% separation and the \cs{mintagsep} to the value of \cs{@tempdima} +% just calculated. This yields the minimum acceptable length of +% the current line. If that is greater than \cs{displaywidth}, we +% mark the tag to be calculated. Otherwise, we mark the tag to be +% kept on the same line and then check to see if the \cs{alignsep@} +% needs to be reduced to make room for the tag. +% \begin{macrocode} + \dimen@\minalignsep\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\mintagsep\relax + \advance\dimen@\@tempdima + \ifdim\dimen@>\displaywidth + \saveshift@1% + \else + \saveshift@0% +% \end{macrocode} +% Now we perform essentially the same calculation, but using the +% current value of \cs{alignsep@} instead of \cs{minalignsep}. +% This gives the current length of the line. If this is greater +% than \cs{displaywidth}, we recalculate \cs{alignsep@} to make +% room for the tag. +% \begin{macrocode} + \dimen@\alignsep@\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\@tempdima + \advance\dimen@\tagwidth@ + \ifdim\dimen@>\displaywidth + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \ifnum\xatlevel@=\tw@ + \advance\dimen@-\mintagsep\relax + \fi + \divide\dimen@\@tempcnta + \ifdim\dimen@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \else + \global\alignsep@\dimen@ + \fi + \fi + \fi + \endgroup + } +\fi\fi +% \end{macrocode} +% \end{macro} +% +% \paragraph{Tag placement when \cs{tagsleft@false}, +% \cs{@fleqnfalse}.} +% +% This is similar to the previous case, except for the added +% complication that both \cs{alignsep@} and \cs{eqnshift@} can +% vary, which makes the computations correspondingly more +% complicated. +% +% \begin{macro}{\calc@shift@align} +% \begin{macrocode} +\iftagsleft@\else\if@fleqn\else + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup + \loop + \ifnum\row@>0 + \ifdim\tag@width\row@>\z@ + \x@calc@shift@rc + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@calc@shift@rc} +% \begin{macrocode} + \def\x@calc@shift@rc{% + \column@\z@ + \@tempdimb\z@ + \@tempdimc\z@ + \edef\@tempb{\fieldlengths@\row@}% + \@for\@tempa:=\@tempb\do{% + \advance\column@\@ne + \x@rcalc@width + }% + \begingroup + \advance\column@\m@ne + \divide\column@\tw@ + \ifnum\@tempcntb>\column@ + \advance\@tempcnta-\@tempcntb + \advance\@tempcnta\column@ + \@tempcntb\column@ + \fi + \tagwidth@\tag@width\row@\relax + \@tempdima\@tempdimc + \advance\@tempdima\tagwidth@ + \dimen@\minalignsep\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\mintagsep\relax + \ifnum\xatlevel@=\tw@ \else + \advance\dimen@\mintagsep\relax + \fi + \advance\dimen@\@tempdima + \ifdim\dimen@>\displaywidth + \saveshift@1% + \else + \saveshift@0% + \dimen@\eqnshift@ + \advance\dimen@\@tempdima + \advance\dimen@\@tempcntb\alignsep@ + \advance\dimen@\tagwidth@ + \ifdim\dimen@>\displaywidth + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \ifnum\xatlevel@=\tw@ + \advance\dimen@-\mintagsep\relax + \fi + \divide\dimen@\@tempcnta + \ifdim\dimen@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \eqnshift@\displaywidth + \advance\eqnshift@-\@tempdima + \advance\eqnshift@-\@tempcntb\alignsep@ + \global\divide\eqnshift@\tw@ + \else + \ifdim\dimen@<\eqnshift@ + \ifdim\dimen@<\z@ + \global\eqnshift@\z@ + \else + \global\eqnshift@\dimen@ + \fi + \fi + \ifdim\dimen@<\alignsep@ + \global\alignsep@\dimen@ + \fi + \fi + \fi + \fi + \endgroup + } +\fi\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@rcalc@width} +% \begin{macrocode} +\iftagsleft@\else + \def\x@rcalc@width{% + \ifdim\@tempa > \z@ + \advance\@tempdimc\@tempdimb + \ifodd\column@ + \advance\@tempdimc\maxcol@width\column@ + \@tempdimb\z@ + \else + \advance\@tempdimc\@tempa\relax + \@tempdimb\maxcol@width\column@ + \advance\@tempdimb-\@tempa\relax + \fi + \else + \advance\@tempdimb\maxcol@width\column@\relax + \fi + } +\fi +% \end{macrocode} +% \end{macro} +% +% \paragraph{Tag placement when \cs{tagsleft@true}, +% \cs{@fleqnfalse}.} +% +% \begin{macro}{\calc@shift@align} +% \begin{macrocode} +\iftagsleft@\if@fleqn\else + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup + \loop + \ifnum\row@>\z@ + \ifdim\tag@width\row@>\z@ + \x@calc@shift@lc + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@calc@shift@lc} +% \begin{macrocode} + \def\x@calc@shift@lc{% + \column@\z@ +% \end{macrocode} +% \cs{@tempdima} will (eventually) be set to the effective width of +% the current row, defined as the distance from the leftmost point +% of the current line to the end of the last field of the +% \cs{halign}, ignoring any intervening \cs{tabskip}s, plus the +% width of the current tag. That is, it will be the width of the +% first non-empty field plus the sum of the maximum widths of all +% following fields, plus the tag width. +% +% \cs{@tempdimb} will be the ``indentation'' of leftmost end of +% text, ignoring the \cs{tabskip} glue, i.e., it will be the sum of +% the maximum widths of any fields to the left of the first +% non-empty field, plus whatever empty space there is at the +% beginning of the first non-empty field. +% \begin{macrocode} + \@tempdima\z@ % ``width of equation'' + \@tempdimb\z@ % ``indent of equation'' + \edef\@tempb{\fieldlengths@\row@}% + \@for\@tempa:=\@tempb\do{% + \advance\column@\@ne + \x@lcalc@width + }% + \begingroup + \tagwidth@\tag@width\row@\relax +% \end{macrocode} +% \cs{@tempdima} is now easy to calculate, since it is just +% $\cs{totwidth@} - \cs{@tempdimb} + \cs{tagwidth@}$. +% \begin{macrocode} + \@tempdima\totwidth@ + \advance\@tempdima-\@tempdimb + \advance\@tempdima\tagwidth@ +% \end{macrocode} +% Next, we check to see whether there is room for both the equation +% and the tag on the same line, by calculating the minimum +% acceptable length of the current row and comparing that to +% \cs{displaywidth}. Note that here we use \cs{@tempcntb}, i.e., +% the number of interalign spaces after the first non-empty align +% structure. +% \begin{macrocode} + \dimen@\minalignsep\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\mintagsep\relax + \ifnum\xatlevel@=\tw@ \else + \advance\dimen@\mintagsep\relax + \fi + \advance\dimen@\@tempdima +% \end{macrocode} +% If the minimum acceptable width of the current line is greater +% than \cs{displaywidth}, we mark the current tag to be shifted to +% a separate line. +% \begin{macrocode} + \ifdim\dimen@>\displaywidth + \saveshift@1% + \else +% \end{macrocode} +% Otherwise, the tag can stay on the same line as the equation, but +% we need to check whether it is too close to the equation. So, we +% calculate the distance between the left margin and the left side +% of the equation, using the current values of \cs{eqnshift@} and +% \cs{alignsep@}. Note that we use \cs{count@} here, not +% \cs{@tempcntb}, as above. +% \begin{macrocode} + \saveshift@0% + \dimen@\alignsep@ + \multiply\dimen@\count@ + \advance\dimen@\eqnshift@ + \advance\dimen@\@tempdimb +% \end{macrocode} +% If the left margin is less than twice the tag width, we calculate +% new values of \cs{eqnshift@} and \cs{alignsep@} to move the +% equation further away from the tag. In particular, we center the +% current line between its tag and the right margin. Note that +% although we later will need to transform \cs{dimen@} into a value +% suitable for use as \cs{eqnshift@}, for the time being it is more +% useful to think of it as the space separating the tag from the +% equation. +% \begin{macrocode} + \ifdim\dimen@<2\tagwidth@ + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \ifnum\xatlevel@=\tw@ + \advance\dimen@-\mintagsep\relax + \fi +% \end{macrocode} +% In certain circumstances we will get a divide-by-zero error here +% unless we guard against it. Use of \cs{@tempcnta} is complicated, +% sometimes it is assigned globally, sometimes locally. Need to sort +% it out one of these days [mjd,2000/06/02]. +% \begin{macrocode} + \ifnum\@tempcnta>\z@ + \divide\dimen@\@tempcnta + \else \dimen@\z@ + \fi +% \end{macrocode} +% As usual, we check to make sure we don't set \cs{alignsep@} +% smaller than \cs{minalignsep} and, in any case, that we don't +% replace \cs{alignsep@} by a larger value. +% \begin{macrocode} + \ifdim\dimen@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \advance\dimen@-\@tempcntb\alignsep@ + \global\divide\dimen@\tw@ + \else + \ifdim\dimen@<\alignsep@ + \global\alignsep@\dimen@ + \fi + \fi +% \end{macrocode} +% Next, we calculate an appropriate value of \cs{eqnshift@}, +% assuming that \cs{dimen@} is the desired separation between the +% tag and equation of the current line. This means that we first +% need to adjust \cs{dimen@} if we're in an \env{flalign} +% environment. +% \begin{macrocode} + \ifnum\xatlevel@=\tw@ + \dimen@\mintagsep\relax + \fi +% \end{macrocode} +% Now we calculate the value of \cs{eqnshift@} needed to produce a +% separation of \cs{dimen@} between the equation tag and the +% beginning of the equation. To do this, we need the following +% equation to hold: +% \[ +% \cs{eqnshift@} + n\cs{alignsep@} + \cs{@tempdimb} +% = \cs{tagwidth@} + \cs{dimen@} +% \] +% where $n = \cs{count@}$ is the number of interalign spaces before +% the first non-empty field of the current line. +% \begin{macrocode} + \advance\dimen@\tagwidth@ + \advance\dimen@-\@tempdimb + \advance\dimen@-\count@\alignsep@ +% \end{macrocode} +% The value of \cs{eqnshift@} just calculated is the minimum +% acceptable value; thus, we save it only if it is larger than the +% current value. +% \begin{macrocode} + \ifdim\dimen@>\eqnshift@ + \global\eqnshift@\dimen@ + \fi + \fi + \fi + \endgroup + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@lcalc@width} +% This macro calculates the ``indentation'' of the current row, as +% defined above under the description of \cs{x@calc@shift@lc}. +% This macro is called for each field of the current line, with +% \cs{@tempa} set to the width of the current field. Ideally, the +% loop enclosing \cs{x@lcalc@width} would terminate as soon as +% \cs{@tempa} is non-zero, but that would be a bit tricky to +% arrange. Instead, we use \cs{@tempdima} as a flag to signal when +% we've encountered the first non-empty field. +% +% \begin{macrocode} + \def\x@lcalc@width{% + \ifdim\@tempdima = \z@ +% \end{macrocode} +% If the current field is empty (i.e., $\cs{@tempa} = +% \mathrm{0\,pt}$, then we increment \cs{@tempdimb} by the width of +% the current field). Otherwise, we set $\cs{@tempdima} = +% \mathrm{1\,pt}$ as a signal value and increment \cs{@tempdimb} by +% the width of whatever empty space there might be at the left of +% the current field. +% \begin{macrocode} + \ifdim\@tempa > \z@ + \@tempdima\p@ + \ifodd\column@ + \advance\@tempdimb \maxcol@width\column@ + \advance\@tempdimb-\@tempa + \fi +% \end{macrocode} +% In addition, we need to adjust the values of \cs{@tempcnta} and +% \cs{@tempcntb} to account for any empty align structures that +% might occur at the beginning of the current line. More +% specifically, we first set \cs{count@} equal to the number of +% interalign spaces preceding the current field (namely, $\lfloor +% (\cs{\column@}-1)/2 \rfloor$), and then subtract \cs{count@} from +% both \cs{@tempcnta} and \cs{@tempcntb}. The rationale is that +% for the purposes of adjusting the spacing between the tag and the +% equation, the only flexible interalign spaces are those after +% the first non-empty align structure, so we need to treat those +% different from the ones before the first non-empty align +% structure. +% \begin{macrocode} + \count@\column@ + \advance\count@\m@ne + \divide\count@\tw@ + \advance\@tempcnta-\count@ + \advance\@tempcntb-\count@ + \else + \advance\@tempdimb \maxcol@width\column@\relax + \fi + \fi + } +\fi\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\place@tag} +% \cs{place@tag} takes care of the placment of tags in the +% \env{align} environments. +% \begin{macrocode} +\def\place@tag{% + \iftagsleft@ + \kern-\tagshift@ + \if1\shift@tag\row@\relax + \rlap{\vbox{% + \normalbaselines + \boxz@ + \vbox to\lineht@{}% + \raise@tag + }}% + \else + \rlap{\boxz@}% + \fi + \kern\displaywidth@ + \else + \kern-\tagshift@ + \if1\shift@tag\row@\relax +% \end{macrocode} +% Added depth to correct vertical spacing of shifted +% equation tags.---dmj, 1994/12/29 +% \begin{macrocode} + \llap{\vtop{% + \raise@tag + \normalbaselines + \setbox\@ne\null + \dp\@ne\lineht@ + \box\@ne + \boxz@ + }}% + \else + \llap{\boxz@}% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\align@preamble} +% \begin{macrocode} +\def\align@preamble{% + &\hfil + \strut@ + \setboxz@h{\@lign$\m@th\displaystyle{##}$}% + \ifmeasuring@\savefieldlength@\fi + \set@field + \tabskip\z@skip + &\setboxz@h{\@lign$\m@th\displaystyle{{}##}$}% + \ifmeasuring@\savefieldlength@\fi + \set@field + \hfil + \tabskip\alignsep@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\set@field} +% \cs{set@field} increments the column counter, tracks the value of +% \cs{lineht@} and finally inserts the box containing the contents +% of the current field. +% \begin{macrocode} +\def\set@field{% + \column@plus + \iftagsleft@ + \ifdim\ht\z@>\lineht@ + \global\lineht@\ht\z@ + \fi + \else + \ifdim\dp\z@>\lineht@ + \global\lineht@\dp\z@ + \fi + \fi + \boxz@ +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection {The \env{split} environment} +% +% \begin{macro}{\split@err} +% A special error function for \env{split} to conserve main mem (at a +% cost of string pool/hash size. +% \begin{macrocode} +\edef\split@err#1{% + \@nx\@amsmath@err{% + \string\begin{split} won't work here% + }{% + \@xp\@nx\csname + Did you forget a preceding \string\begin{equation}?^^J% + If not, perhaps the `aligned' environment is what + you want.\endcsname}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{split} +% If the \env{split} environment occurs inside \env{align} or +% \env{gather}, it can make use of the enclosing halign; if it is +% called inside a simple equation, we add an implicit `gather' +% container. +% +% \begin{macrocode} +\newenvironment{split}{% + \if@display + \ifinner + \@xp\@xp\@xp\split@aligned + \else + \ifst@rred \else \global\@eqnswtrue \fi + \fi + \else \let\endsplit\@empty \@xp\collect@body\@xp\split@err + \fi + \collect@body\gather@split +}{% + \crcr + \egroup + \egroup + \iftagsleft@ \@xp\lendsplit@ \else \@xp\rendsplit@ \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\let\split@tag\relax % init +% \end{macrocode} +% +% \begin{macrocode} +\def\gather@split#1#2#3{% + \@xp\endgroup \reset@equation % math@cr will handle equation numbering + \iftag@ + \toks@\@xp{\df@tag}% + \edef\split@tag{% + \gdef\@nx\df@tag{\the\toks@}% + \global\@nx\tag@true \@nx\nonumber + }% + \else \let\split@tag\@empty + \fi + \spread@equation +% \end{macrocode} +% The extra vcenter wrapper here is not really a good thing but +% without it there are compatibility problems with old documents that +% throw in some extra material between \verb'\begin{equation}' and +% \verb'\begin{split}' (for example, \verb'\hspace{-1pc}' or +% \verb'\left\{'). [mjd,1999/09/20] +% \begin{macrocode} + \vcenter\bgroup + \gather@{\split@tag \begin{split}#1\end{split}}% + \def\endmathdisplay@a{% + \math@cr \black@ \totwidth@ \egroup + \egroup + }% +} +% \end{macrocode} +% +% \end{environment} +% +% \begin{macro}{\insplit@} +% \begin{macrocode} +\def\insplit@{% + \global\setbox\z@\vbox\bgroup + \Let@ \chardef\dspbrk@context\@ne \restore@math@cr + \default@tag % disallow use of \tag here + \ialign\bgroup + \hfil + \strut@ + $\m@th\displaystyle{##}$% + &$\m@th\displaystyle{{}##}$% + \hfill % Why not \hfil?---dmj, 1994/12/28 + \crcr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rendsplit@} +% Moved the box maneuvers inside the \cs{ifinalign@}, since that is +% the only place they are needed.---dmj, 1994/12/28 +% +% TODO: Explore interaction of tag-placement algorithm with +% \env{split}. Is there any way for \env{split} to pass the +% relevant information out to the enclosing \env{gather} or +% \env{align}? +% \begin{macrocode} +\def\rendsplit@{% + \ifinalign@ +% \end{macrocode} +% Changed |\box9| into a \cs{vtop} here for better spacing. +% \begin{macrocode} + \global\setbox9 \vtop{% + \unvcopy\z@ + \global\setbox8 \lastbox + \unskip + }% + \setbox\@ne\hbox{% + \unhcopy8 + \unskip + \global\setbox\tw@\lastbox + \unskip + \global\setbox\thr@@\lastbox + }% + \ifctagsplit@ + \gdef\split@{% + \hbox to\wd\thr@@{}% + &\vcenter{\vbox{\moveleft\wd\thr@@\boxz@}}% + }% + \else + \global\setbox7 \hbox{\unhbox\tw@\unskip}% +% \end{macrocode} +% Added \cs{add@amps} to make sure we put the last line of the +% \env{split} into the proper column of an \env{align} environment +% with multiple align structures.---dmj, 1994/12/28 +% +% Special care has to be taken in this case because the \env{split} +% turns into two lines of the \env{align} instead of just one. So, +% we have to make sure that the first line produced by the +% \env{split} doesn't upset our bookkeeping, hence we call +% \cs{savetaglength@} to insert 0\,pt as the tag for this +% pseudo-line, and we advance the \cs{row@} counter and reset +% \cs{lineht@} afterwards. It would be nice if we could just +% replace the \cs{crcr} by \cs{math@cr@@@}, but that would cause +% problems with the tag processing. +% \begin{macrocode} + \gdef\split@{% + \global\@tempcnta\column@ + &\setboxz@h{}% + \savetaglength@ + \global\advance\row@\@ne + \vbox{\moveleft\wd\thr@@\box9}% + \crcr + \noalign{\global\lineht@\z@}% + \add@amps\@tempcnta + \box\thr@@ + &\box7 + }% + \fi + \else + \ifctagsplit@ + \gdef\split@{\vcenter{\boxz@}}% + \else +% \end{macrocode} +% Changed to just \cs{boxz@}, otherwise last line gets centered +% rather than aligned properly with respect to the rest of the +% lines. But this means that we can't see inside of the last line +% to decide whether the tag needs to be moved. Will have to think +% about this.---dmj, 1994/12/28 +% \begin{macrocode} + \gdef\split@{% + \boxz@ +% \box9 +% \crcr +% \hbox{\box\thr@@\box7}% + }% + \fi + \fi + \aftergroup\split@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lendsplit@} +% \begin{macrocode} +\def\lendsplit@{% + \global\setbox9\vtop{\unvcopy\z@}% + \ifinalign@ +% \end{macrocode} +% Moved following two boxes inside the \cs{ifinalign@}, since they +% are only used in that case. In fact, if we just kept track of +% the width of the first column, we could dispense with this +% entirely. Surely that would be more efficient than all these box +% copies.---dmj, 1994/12/28 +% \begin{macrocode} + \setbox\@ne\vbox{% + \unvcopy\z@ + \global\setbox8\lastbox + }% + \setbox\@ne\hbox{% + \unhcopy8% + \unskip + \setbox\tw@\lastbox + \unskip + \global\setbox\thr@@\lastbox + }% + \ifctagsplit@ + \gdef\split@{% + \hbox to\wd\thr@@{}% + &\vcenter{\vbox{\moveleft\wd\thr@@\box9}}% + }% + \else + \gdef\split@{% + \hbox to\wd\thr@@{}% + &\vbox{\moveleft\wd\thr@@\box9}% + }% + \fi + \else + \ifctagsplit@ + \gdef\split@{\vcenter{\box9}}% + \else + \gdef\split@{\box9}% + \fi + \fi + \aftergroup\split@ +} +% \end{macrocode} +% \end{macro} +% +% With \pkg{amsmath} 1.2 it was possible to put things like +% \verb'\left\{' between \verb'\begin{equation}' and +% \verb'\begin{split}' without getting any error message. For +% backward compatibility we try to avoid a fatal error in this case +% and instead attempt recovery with \env{aligned}. +% \begin{macrocode} +\def\split@aligned#1#2{% + \iffalse{\fi\ifnum0=`}\fi + \collect@body\split@al@a} +% \end{macrocode} +% +% \begin{macrocode} +\def\split@al@a#1#2#3{% + \split@warning + \endgroup +% \end{macrocode} +% If the \opt{fleqn} and \opt{tbtags} options are both in effect then +% we will need to add an optional argument on the \env{aligned} +% environment. +% \begin{macrocode} + \toks@{\begin{aligned}}% + \if@fleqn \split@al@tagcheck \fi +% \end{macrocode} +% The \cs{relax} here is to prevent \cs{@let@token} from being left +% equal to an ampersand if that happens to be the first thing in the body. +% \begin{macrocode} + \the\toks@\relax#1\end{aligned}% + \ifnum0=`{\fi\iffalse}\fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def\split@al@tagcheck{% + \ifctagsplit@ + \else + \iftagsleft@ \toks@\@xp{\the\toks@ [t]}% + \else \toks@\@xp{\the\toks@ [b]}% + \fi + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def\split@warning{% + \PackageWarning{amsmath}{% +Cannot use `split' here;\MessageBreak trying to recover with `aligned'}% +} +% \end{macrocode} +% +% \subsection{The \env{multline} environment} +% +% In the original \amstex/, \cn{multlinegap} is a macro with an +% argument that resets an internal dimension (one with an \qc{\@} +% character in its name). Here, to save control sequence names, we +% define \cn{multlinegap} to be the dimension itself and the +% documentation instructs users to use \cn{setlength} if they +% need to change it. +% \begin{macro}{\multlinegap} +% \begin{macro}{\multlinetaggap} +% Changed \cs{multlinegap} and \cs{multlinetaggap} to skip +% registers. Also changed name to \cs{multlinetaggap} from +% \cs{multlinetaggap@}. +% \begin{macrocode} +\newskip\multlinegap +\multlinegap10pt +\newskip\multlinetaggap +\multlinetaggap10pt +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\start@multline} +% \begin{macrocode} +\def\start@multline#1{% + \RIfM@ + \nomath@env + \DN@{\@namedef{end\@currenvir}{}\@gobble}% + \else + $$% + #1% + \ifst@rred + \nonumber + \else + \global\@eqnswtrue + \fi + \let\next@\multline@ + \fi + \collect@body\next@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{multline} +% \begin{environment}{multline*} +% \begin{macrocode} +\newenvironment{multline}{% + \start@multline\st@rredfalse +}{% + \iftagsleft@ \@xp\lendmultline@ \else \@xp\rendmultline@ \fi + \ignorespacesafterend +} +% \end{macrocode} +% +% \begin{macrocode} +\newenvironment{multline*}{\start@multline\st@rredtrue}{\endmultline} +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \begin{macro}{\multline@} +% \begin{macrocode} +\def\multline@#1{% + \Let@ +% \end{macrocode} +% +% For multline neither \cs{displ@y} no \cs{displ@y@} is quite right; +% we want to advance the row number and (I suppose?) the +% display-pagebreak level, but we only want to do tag-related stuff +% once before the first line, not repeat it for every line. (Recall +% that the arg of \cs{@display@init} goes into \cs{everycr}.) +% \begin{macrocode} + \@display@init{\global\advance\row@\@ne \global\dspbrk@lvl\m@ne}% + \chardef\dspbrk@context\z@ + \restore@math@cr +% \end{macrocode} +% The \env{multline} environment is somewhat unusual, in that +% \cs{tag} and \cs{label} are enabled only during the measuring +% phase and disabled during the production phase. +% Here we disable \cs{tag} and \cs{label}; \cs{mmeasure@} will +% re-enable them temporarily. +% \begin{macrocode} + \let\tag\tag@in@align + \global\tag@false \global\let\raise@tag\@empty + \mmeasure@{#1}% + \let\tag\gobble@tag \let\label\@gobble + \tabskip \if@fleqn \@mathmargin \else \z@skip \fi + \totwidth@\displaywidth + \if@fleqn + \advance\totwidth@-\@mathmargin + \fi + \halign\bgroup + \hbox to\totwidth@{% +% \end{macrocode} +% In order to get the spacing of the last line right in fleqn +% mode, we need to play a little game here. Normally the +% stretchability of the \cs{hskip} here will be suppressed by the +% \cs{hfil} at the end of the template, except inside the last line, +% when that \cs{hfil} will be removed by the \cs{hfilneg} in +% \cs{lendmultline@}. +% \begin{macrocode} + \if@fleqn + \hskip \@centering \relax + \else + \hfil + \fi + \strut@ + $\m@th\displaystyle{}##\endmultline@math + \hfil + }% + \crcr +% \end{macrocode} +% In \opt{fleqn} mode, it's the \cs{tabskip} of \cs{@mathmargin} +% that needs to be removed in the first line, not the \cs{hfil} at +% the beginning of the template. +% \begin{macrocode} + \if@fleqn + \hskip-\@mathmargin + \def\multline@indent{\hskip\@mathmargin}% put it back + \else + \hfilneg + \def\multline@indent{\hskip\multlinegap}% + \fi + \iftagsleft@ + \iftag@ + \begingroup + \ifshifttag@ + \rlap{\vbox{% + \normalbaselines + \hbox{% + \strut@ + \make@display@tag + }% + \vbox to\lineht@{}% + \raise@tag + }}% +% \end{macrocode} +% If the equation tag doesn't fit on the same line with the first +% line of the display, we'll indent the first line by +% \cn{multlinegap}. This is a change from \pkg{amstex}, where the +% first line would have been flush against the left margin in this +% case. A corresponding change will be made in \cs{rendmultline@}. +% \begin{macrocode} + \multline@indent + \else + \setbox\z@\hbox{\make@display@tag}% + \dimen@\@mathmargin \advance\dimen@-\wd\z@ + \ifdim\dimen@<\multlinetaggap + \dimen@\multlinetaggap + \fi + \box\z@ \hskip\dimen@\relax + \fi + \endgroup + \else + \multline@indent + \fi + \else + \multline@indent + \fi + #1% +} +% \end{macrocode} +% +% An extra level of indirection for the closing \verb'$' in multline +% allows us to avoid getting an extra thinmuskip from a final +% mathpunct in the equation contents, when equation numbers are on +% the right. If we did not use this workaround, the sequence of +% elements for a final comma would be, e.g., +% \begin{verbatim} +% ... ,<hskip><box containing equation number> +% \end{verbatim} +% which is equivalent to a sequence \verb'<mathpunct><mathord>' as +% far as the automatic math spacing is concerned. +% \begin{macrocode} +\def\endmultline@math{$} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lendmultline@} +% Bug fix: changed \cs{crcr} to \cs{math@cr} so that \cs{@eqpen} +% gets reset properly if \cs{displaybreak} is used on the +% penultimate line of an \env{align}. +% \begin{macrocode} +\def\lendmultline@{% + \hfilneg + \hskip\multlinegap + \math@cr + \egroup + $$% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rendmultline@} +% \begin{macrocode} +\def\rendmultline@{% + \iftag@ + $\let\endmultline@math\relax + \ifshifttag@ + \hskip\multlinegap +% \end{macrocode} +% Added depth to correct vertical spacing of shifted equation +% tags.---dmj, 1994/12/29 +% \begin{macrocode} + \llap{\vtop{% + \raise@tag + \normalbaselines + \setbox\@ne\null + \dp\@ne\lineht@ + \box\@ne + \hbox{\strut@\make@display@tag}% + }}% + \else + \hskip\multlinetaggap + \make@display@tag + \fi + \else + \hskip\multlinegap + \fi + \hfilneg +% \end{macrocode} +% Use \cs{math@cr} rather than just \cs{crcr} so that \cs{@eqpen} +% gets reset properly if \cs{displaybreak} is used. +% \begin{macrocode} + \math@cr + \egroup$$% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mmeasure@} +% \begin{macrocode} +\def\mmeasure@#1{% + \begingroup + \measuring@true +% \end{macrocode} +% We use \cs{begin/endgroup} rather than |{}| in this definition of +% \cn{label} because the latter would create an extra (wasteful of +% main mem) null box in the current math list. [mjd, 1995/01/17] +% \begin{macrocode} + \def\label##1{% + \begingroup\measuring@false\label@in@display{##1}\endgroup}% + \def\math@cr@@@{\cr}% + \let\shoveleft\@iden \let\shoveright\@iden + \savecounters@ + \global\row@\z@ + \setbox\@ne\vbox{% + \global\let\df@tag\@empty + \halign{% + \setboxz@h{\@lign$\m@th\displaystyle{}##$}% + \iftagsleft@ + \ifnum\row@=\@ne + \global\totwidth@\wdz@ + \global\lineht@\ht\z@ + \fi + \else + \global\totwidth@\wdz@ + \global\lineht@\dp\z@ + \fi + \crcr + #1% + \crcr + }% + }% + \ifx\df@tag\@empty\else\global\tag@true\fi + \if@eqnsw\global\tag@true\fi + \iftag@ + \setboxz@h{% + \if@eqnsw + \stepcounter{equation}% + \tagform@\theequation + \else + \df@tag + \fi + }% + \global\tagwidth@\wdz@ + \dimen@\totwidth@ + \advance\dimen@\tagwidth@ + \advance\dimen@\multlinetaggap + \iftagsleft@\else + \if@fleqn + \advance\dimen@\@mathmargin + \fi + \fi + \ifdim\dimen@>\displaywidth + \global\shifttag@true + \else + \global\shifttag@false + \fi + \fi + \restorecounters@ + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\shoveleft} +% \begin{macro}{\shoveright} +% \cs{shoveleft} and \cs{shoveright} need to do slightly different +% things depending on whether tags are on the left or the right and +% whether we're in \opt{fleqn} mode. For compactness of code, we +% make the appropriate decisions at ``compile'' time rather than at +% load time. +% +% TODO: Investigate making \cs{shoveright} behave ``properly''(?) if +% used on the first line of a \env{multline} and make \cs{shoveleft} +% behave properly if used on the last line of a \env{multline}. But +% in his \fn{amstex.doc} Spivak indicates those commands should never +% be used on a first or last line. Perhaps better to leave the +% question open unless/until real-life examples turn up. +% \begin{macrocode} +\iftagsleft@ + \def\shoveright#1{% + #1% + \hfilneg + \hskip\multlinegap + } +\else + \def\shoveright#1{% + #1% + \hfilneg + \iftag@ + \ifshifttag@ + \hskip\multlinegap + \else + \hskip\tagwidth@ + \hskip\multlinetaggap + \fi + \else + \hskip\multlinegap + \fi + } +\fi + +\if@fleqn + \def\shoveleft#1{#1}% +\else + \iftagsleft@ + \def\shoveleft#1{% + \setboxz@h{$\m@th\displaystyle{}#1$}% + \setbox\@ne\hbox{$\m@th\displaystyle#1$}% + \hfilneg + \iftag@ + \ifshifttag@ + \hskip\multlinegap + \else + \hskip\tagwidth@ + \hskip\multlinetaggap + \fi + \else + \hskip\multlinegap + \fi + \hskip.5\wd\@ne + \hskip-.5\wdz@ + #1% + } + \else + \def\shoveleft#1{% + \setboxz@h{$\m@th\displaystyle{}#1$}% + \setbox\@ne\hbox{$\m@th\displaystyle#1$}% + \hfilneg + \hskip\multlinegap + \hskip.5\wd\@ne + \hskip-.5\wdz@ + #1% + } + \fi +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{The \env{equation} environment} +% +% Rewritten from the ground up for version 2.0 to fix no-shrink and +% no-shortskips bugs [mjd,2000/01/06]. +% +% Standard \latex/ provides three environments for one-line equations: +% \cn{[}\cn{]}, \env{equation}, and \env{displaymath}. We add +% \env{equation*} as a synonym for \env{displaymath}. +% \begin{macrocode} +\@saveprimitive\leqno\@@leqno +\@saveprimitive\eqno\@@eqno +\def\eqno{\@@eqno\let\eqno\relax\let\leqno\relax} +\def\leqno{\@@leqno\let\leqno\relax\let\eqno\relax} +% +\let\veqno=\@@eqno +\iftagsleft@ \let\veqno=\@@leqno \fi +% \end{macrocode} +% +% Support for the \pkg{showkeys} package: provide no-op definitions +% for a couple of SK functions, if they are not already defined. Then +% we can just call them directly in our code without any extra fuss. +% If the \pkg{showkeys} package is loaded later, our trivial +% definitions will get overridden and everything works fine. +% \begin{macrocode} +\@ifundefined{SK@@label}{% + \let\SK@@label\relax \let\SK@equationtrue\relax +}{} +% \end{macrocode} +% +% \begin{macrocode} +\let\reset@equation\@empty +% \end{macrocode} +% +% Cf \cs{tag@in@align}. This is a bit of a mess though. Could use +% some work. [mjd,1999/12/21] +% \begin{macrocode} +\let\alt@tag\@empty +\def\tag@in@display#1#{\relax\tag@in@display@a{#1}} +\def\tag@in@display@a#1#2{% + \iftag@ + \invalid@tag{Multiple \string\tag}\relax + \else + \global\tag@true \nonumber \reset@equation \st@rredtrue + \if *\string#1% + \gdef\alt@tag{\def\SK@tagform@{#2\@gobble}% + \ifx\SK@@label\relax \let\tagform@\SK@tagform@ \fi + }% + \make@df@tag@@{#2}% + \else + \make@df@tag@@@{#2}% + \fi + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\let\restore@hfuzz\@empty +% \end{macrocode} +% +% \begin{macrocode} +\def\mathdisplay#1{% + \ifmmode \@badmath + \else + $$\def\@currenvir{#1}% +% \end{macrocode} +% Allow use of \cn{displaybreak}. +% \begin{macrocode} + \let\dspbrk@context\z@ +% \end{macrocode} +% Although in some cases simpler label handling would seem to be +% sufficient, always using \cs{label@in@display} makes it easier to +% support the \pkg{showkeys} package. +% \begin{macrocode} + \let\tag\tag@in@display \let\label\label@in@display \SK@equationtrue + \global\let\df@label\@empty \global\let\df@tag\@empty + \global\tag@false + \let\mathdisplay@push\mathdisplay@@push + \let\mathdisplay@pop\mathdisplay@@pop + \if@fleqn +% \end{macrocode} +% Turn off overfull box messages temporarily\mdash otherwise there +% would be unwanted extra ones emitted during our measuring +% operations. +% \begin{macrocode} + \edef\restore@hfuzz{\hfuzz\the\hfuzz\relax}% + \hfuzz\maxdimen +% \end{macrocode} +% Initially set the equation body in a box of displaywidth. Then if +% the box is not overfull, as we find by checking \cs{badness}, we +% have acquired useful information for the subsequent processing. +% \begin{macrocode} + \setbox\z@\hbox to\displaywidth\bgroup + \let\split@warning\relax \restore@hfuzz + \everymath\@emptytoks \m@th $\displaystyle + \fi + \fi +} +% \end{macrocode} +% +% Arg 1 is not currently used. I thought it might come in handy for +% error messages. +% \begin{macrocode} +\def\endmathdisplay#1{% + \ifmmode \else \@badmath \fi + \endmathdisplay@a + $$% +% \end{macrocode} +% I guess the following code means this structure is non-reentrant. +% But there is plenty of scope for tricky bugs here; suppressing them +% by brute force at least makes it possible to get things working +% correctly for normal use. [mjd,2000/01/06] +% \begin{macrocode} + \global\let\df@label\@empty \global\let\df@tag\@empty + \global\tag@false \global\let\alt@tag\@empty + \global\@eqnswfalse +} +% \end{macrocode} +% +% \begin{macrocode} +\def\endmathdisplay@a{% + \if@eqnsw \gdef\df@tag{\tagform@\theequation}\fi + \if@fleqn \@xp\endmathdisplay@fleqn + \else \ifx\df@tag\@empty \else \veqno \alt@tag \df@tag \fi + \ifx\df@label\@empty \else \@xp\ltx@label\@xp{\df@label}\fi + \fi + \ifnum\dspbrk@lvl>\m@ne + \postdisplaypenalty -\@getpen\dspbrk@lvl + \global\dspbrk@lvl\m@ne + \fi +} +% \end{macrocode} +% +% A boolean variable: Was that last box overfull or not? A value of 0 +% means yes, it was overfull. +% \begin{macrocode} +\let\too@wide\@ne +% \end{macrocode} +% +% Special handling is needed for flush-left equations. We need to +% measure the equation body (found in box 0 after we close it with +% the \cs{egroup}). Then after a fairly normal test to see if it fits +% within the available space, we need to consider overlapping into +% the displayindent area if displayindent is nonzero (as in an +% indented list). If there is an equation number we may have to shift +% it by hand to a separate line when there is not enough room; +% we can no longer take advantage of the automatic shifting provided +% by the \cn{leqno}, \cn{eqno} primitives. +% +% We initially add \cs{@mathmargin} glue at the end of box 0 to get +% an accurate overfull test. If \cs{@mathmargin} contains any shrink +% then we cannot reliably tell whether the box will be overfull or +% not simply by doing hand calculations from the actual width of the +% equation body. We have to actually set the box and find out what +% happens. +% +% On the other hand if we put the \cs{@mathmargin} glue at the +% beginning of the box it's awkward to remove it afterwards. So we +% first put it in at the end and later we will move it to the +% beginning as needed. +% +% \begin{macrocode} +\def\endmathdisplay@fleqn{% + $\hfil\hskip\@mathmargin\egroup +% \end{macrocode} +% We need to save the information about whether box 0 was overfull in +% a variable, otherwise it will disappear in the next setbox +% operation. And we couldn't set the equation number box earlier than +% now, because the body of the equation might have contained a +% \cs{tag} command (well, it could have been done, but this way +% we can reuse the tag-handling code from elsewhere). +% \begin{macrocode} + \ifnum\badness<\inf@bad \let\too@wide\@ne \else \let\too@wide\z@ \fi + \ifx\@empty\df@tag + \else + \setbox4\hbox{\df@tag + \ifx\df@label\@empty \else \@xp\ltx@label\@xp{\df@label}\fi + }% + \fi + \csname emdf@% + \ifx\df@tag\@empty U\else \iftagsleft@ L\else R\fi\fi + \endcsname +} +% \end{macrocode} +% +% For an unnumbered flush-left equation we hope first that the +% the contents fit within displaywidth. If not we need to fall back +% on a more complicated reboxing operation. +% \begin{macrocode} +\def\emdf@U{% + \restore@hfuzz + \ifodd\too@wide % not too wide: just need to swap the glue around + \hbox to\displaywidth{\hskip\@mathmargin\unhbox\z@\unskip}% + \else % M+B > displaywidth + \emdf@Ua + \fi +} +% \end{macrocode} +% +% Some notation: $M$ \cs{@mathmargin}, $B$ the width of the equation +% body, $I$ \cs{displayindent}, $D$ \cs{displaywidth}, $N$ the width +% of the equation number (aka the tag), $S$ \cs{mintagsep}, $C$ +% \cs{columnwidth}. If $M+B > \mbox{displaywidth}$, and if we assume +% $M$ contains shrink, then the only solution left is to encroach +% into the displayindent space. +% \begin{macrocode} +\def\emdf@Ua{% + \hbox to\columnwidth{% + \ifdim\displayindent>\z@ + \hskip\displayindent minus\displayindent + \fi + \hskip\@mathmargin \unhbox\z@ \unskip + }% + \displayindent\z@ \displaywidth\columnwidth +} +% \end{macrocode} +% +% Find out first if the tag fits in ideal position. If so we can just +% plunk down box 2. Otherwise we need to do something more complicated. +% \begin{macrocode} +\def\emdf@R{% + \setbox\tw@\hbox to\displaywidth{% + \hskip\@mathmargin \unhcopy\z@\unskip\hfil\hskip\mintagsep\copy4 + }% + \restore@hfuzz + \ifnum\badness<\inf@bad \box\tw@ \else \emdf@Ra \fi +} +% \end{macrocode} +% +% We shift the equation number to line 2 if it does not fit within +% \cs{displaywidth}. Note that we do not first attempt to let the +% equation body shift leftward into the \cs{displayindent} space. If +% that is desired it will have to be done by hand by adding negative +% space at the beginning of the equation body. I don't expect this to +% arise very often in practice since most of the time +% \cs{displayindent} is zero anyway. +% \begin{macrocode} +\def\emdf@Ra{% + \skip@\displayindent minus\displayindent + \displayindent\z@ \displaywidth\columnwidth + \spread@equation \everycr{}\tabskip\z@skip + \halign{\hbox to\displaywidth{##}\cr + \relax + \ifdim\skip@>\z@ \hskip\skip@ \fi + \hskip\@mathmargin\unhbox\z@\unskip\hfil\cr + \noalign{\raise@tag}% + \hfil\box4 \cr}% +} +% \end{macrocode} +% +% Find out first if the tag fits in ideal position. If so we can just +% plunk down box 2. Otherwise we need to do something more +% complicated. +% \begin{macrocode} +\def\emdf@L{% +% \end{macrocode} +% Calculate the difference between $M$ and $N+S$. If the latter is +% greater, we don't want to add any extra glue between the number and +% the equation body. Otherwise the amount that we want to add is +% \verb'x minus x' where $x=M-(N+S)$. I.e., the distribution of +% spaces across the line is $N,S,x minus x,B,hfil$. +% \begin{macrocode} + \@tempdima\@mathmargin + \advance\@tempdima-\wd4 \advance\@tempdima-\mintagsep + \skip@\@tempdima minus\@tempdima + \setbox\tw@\hbox to\displaywidth{% + \copy4\hskip\mintagsep + \ifdim\skip@>\z@ \hskip\skip@\fi + \unhcopy\z@\unskip + }% + \restore@hfuzz + \ifnum\badness<\inf@bad \box\tw@ \else \emdf@La \fi +} +% \end{macrocode} +% +% If the equation body and equation number will not fit on the same +% line, we put the number on line 1 and the body on line 2, with the +% body positioned as for an unnumbered equation. +% \begin{macrocode} +\def\emdf@La{% + \spread@equation \everycr{}\tabskip\z@skip + \halign{\hbox to\displaywidth{##}\cr + \box4 \hfil \cr + \noalign{\raise@tag}% + \hskip\@mathmargin\unhbox\z@\unskip\hfil\cr}% +} +% \end{macrocode} +% +% If someone has \verb'\[ \]' nested inside a minipage environment +% nested inside a numbered equation, the mathdisplay variables that +% are global will get out of whack unless we take extra care. So we +% make a stack and push all the variables before entering mathdisplay +% and pop them afterwards. But we can save a little work by not doing +% this at the top level, only at inner levels. +% \begin{macrocode} +\newtoks\mathdisplay@stack +\let\mathdisplay@push\@empty +\def\mathdisplay@@push{% + \begingroup + \toks@\@xp{\df@label}\@temptokena\@xp{\df@tag}% + \toks8\@xp{\alt@tag}% + \edef\@tempa{% + \global\if@eqnsw\@nx\@eqnswtrue\else\@nx\@eqnswfalse\fi + \global\iftag@\@nx\tag@false\else\@nx\tag@true\fi + \gdef\@nx\df@label{\the\toks@}\gdef\@nx\df@tag{\the\@temptokena}% + \gdef\@nx\alt@tag{\the\toks8}% + \global\mathdisplay@stack{\the\mathdisplay@stack}% + }% + \global\mathdisplay@stack\@xp{\@tempa} + \endgroup +} +% \end{macrocode} +% +% \begin{macrocode} +\let\mathdisplay@pop\@empty +\def\mathdisplay@@pop{\the\mathdisplay@stack} +% \end{macrocode} +% +% \begin{macrocode} +\renewenvironment{equation}{% + \incr@eqnum + \mathdisplay@push + \st@rredfalse \global\@eqnswtrue + \mathdisplay{equation}% +}{% + \endmathdisplay{equation}% + \mathdisplay@pop + \ignorespacesafterend +} +% \end{macrocode} +% +% \begin{macrocode} +\newenvironment{equation*}{% + \mathdisplay@push + \st@rredtrue \global\@eqnswfalse + \mathdisplay{equation*}% +}{% + \endmathdisplay{equation*}% + \mathdisplay@pop + \ignorespacesafterend +} +% \end{macrocode} +% +% Note: \latex/ defines the \env{displaymath} environment in +% terms of \cn{[} and \cn{]}. +% \begin{macrocode} +\DeclareRobustCommand{\[}{\begin{equation*}} +\DeclareRobustCommand{\]}{\end{equation*}} +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \section{Credits} +% +% Much of the code for the \pkg{amsmath} package had its orgin in +% \fn{amstex.tex}, written by Michael Spivak. The initial work of +% porting \fn{amstex.tex} to \fn{amstex.sty} was done in 1988--1989 +% by Frank Mittelbach and Rainer Sch\"opf. In 1994 David M. Jones +% added the support for the \opt{fleqn} option and did extensive +% improvements to the \env{align[at]} family of environments and to +% the equation number handling in general. Michael Downes at the AMS +% served as coordinator for the efforts of Mittelbach, Sch\"opf, and +% Jones, and has contributed various bug fixes and additional +% refinements over time. +% +% Versions 1.0 and 1.1 of the package carried the name \pkg{amstex} +% instead of \pkg{amsmath}, to indicate its origins; the name was +% changed in 1994 to make it user-oriented rather than +% history-oriented. +% +\endinput diff --git a/macros/latex-dev/required/amsmath/amsmath.ins b/macros/latex-dev/required/amsmath/amsmath.ins new file mode 100644 index 0000000000..7a6a087359 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsmath.ins @@ -0,0 +1,50 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999, 2000, 2013 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amsmath.sty}{\from{amsmath.dtx}{}} +} + +\endbatchfile diff --git a/macros/latex-dev/required/amsmath/amsmath.pdf b/macros/latex-dev/required/amsmath/amsmath.pdf Binary files differnew file mode 100644 index 0000000000..94a460afa4 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsmath.pdf diff --git a/macros/latex-dev/required/amsmath/amsopn.dtx b/macros/latex-dev/required/amsmath/amsopn.dtx new file mode 100644 index 0000000000..b7047377f3 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsopn.dtx @@ -0,0 +1,263 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +%\iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\let\savedarg\arg +\usepackage{amsopn} +\let\arg\savedarg +\GetFileInfo{amsopn.sty} +\begin{document} +\title{The \pkg{amsopn} package} +\author{Michael Downes} +\date{Version \fileversion, \filedate} +\DocInput{amsopn.dtx} +\end{document} +%</driver> +%\fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% +% The \pkg{amsopn} package provides a command +% \cn{DeclareMathOperator} for defining new `math operator names' +% similar to the standard function names \cn{sin}, \cn{lim}, +% \cn{max}, etc. +% +% \StopEventually{} +% +% Standard file identification. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesPackage{amsopn}[2016/03/08 v2.02 operator names] +% \end{macrocode} +% +% What \cs{nolimits@} does is keep a \cn{limits} typed by the user +% from having any effect. This is used for operatornames whose +% standard usage is never to have limits. +% \begin{macrocode} +\def\nolimits@{\@ifnextchar\limits{\nolimits\@gobble}{\nolimits}} +% \end{macrocode} +% +% In operator names, it is sometimes desired to have text-mode +% punctuation characters such as |*-/:'|. +% Because the body of an +% operator name is set in math mode, these few punctuation +% characters will not come out right (wrong symbol/and or wrong +% spacing). The purpose of \cs{newmcodes@} is to make them act like +% their normal text versions. +% +% Where practical, we use decimal numbers to cut down main mem +% usage (\qc{\"} not needed). +% use |\Umathcodedefnum| with xetex and LuaTeX to avoid problems +% using |\mathcode| if |-| has already been defined using |\Umathcode|. +% \changes{v2.02}{2016/03/08}{Unicode TeX version of \cs{newmcodes@}} +% \begin{macrocode} +\begingroup \catcode`\"=12 +\ifx\Umathcode\@undefined +\gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\."613A% +% \end{macrocode} +% Define \cs{std@minus} for \cs{relbar} use; otherwise there are +% problems with arrows constructed with relbar. +% \begin{macrocode} + \ifnum\mathcode`\-=45 \else + \mathchardef\std@minus\mathcode`\-\relax + \fi + \mathcode`\-45\mathcode`\/47\mathcode`\:"603A\relax} +% \end{macrocode} +% \begin{macrocode} +\else +% \end{macrocode} +% \begin{macrocode} +\gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\."613A% + \ifnum\Umathcodenum`\-=45 \else + \Umathcharnumdef\std@minus\Umathcodenum`\-\relax + \fi + \mathcode`\-45\mathcode`\/47\mathcode`\:"603A\relax} +% \end{macrocode} +% \begin{macrocode} +\fi +\endgroup +% \end{macrocode} +% +% The command \cs{operatorname} prints its argument as a `math +% operator' like \cs{sin} or \cs{det}, with proper font and spacing. +% \begin{macrocode} +\DeclareRobustCommand{\operatorname}{% + \@ifstar{\qopname\newmcodes@ m}% + {\qopname\newmcodes@ o}}% +% \end{macrocode} +% In the interior of the \cs{mathop} we need a null object (we choose +% a zero kern for minimum waste of main mem) in order to guard +% against the case where \arg{3} is a single letter; \tex/ will seize +% it and center it on the math axis if there is nothing else inside +% the \cs{mathop} atom. +% \begin{macrocode} +\DeclareRobustCommand{\qopname}[3]{% + \mathop{#1\kern\z@\operator@font#3}% + \csname n#2limits@\endcsname} +% \end{macrocode} +% +% \begin{macro}{\DeclareMathOperator} +% The command \cn{DeclareMathOperator} defines the first argument to +% be an operator name whose text is the second argument. The star +% form means that the operator name should take limits (like \cn{max} +% or \cn{lim}). +% \begin{macrocode} +\newcommand{\DeclareMathOperator}{% + \@ifstar{\@declmathop m}{\@declmathop o}} +% \end{macrocode} +% \end{macro} +% +% In the basic set of operator names (below) we did not use +% \cn{DeclareRobustCommand} because of the hash table cost. But we +% use it here to minimize the chances of trouble, since we are +% producing a user-defined command. +% \begin{macrocode} +\long\def\@declmathop#1#2#3{% + \@ifdefinable{#2}{% + \DeclareRobustCommand{#2}{\qopname\newmcodes@#1{#3}}}} +% +\@onlypreamble\DeclareMathOperator +\@onlypreamble\@declmathop +% \end{macrocode} +% +% \begin{macrocode} +\def\arccos{\qopname\relax o{arccos}} +\def\arcsin{\qopname\relax o{arcsin}} +\def\arctan{\qopname\relax o{arctan}} +\def\arg{\qopname\relax o{arg}} +\def\cos{\qopname\relax o{cos}} +\def\cosh{\qopname\relax o{cosh}} +\def\cot{\qopname\relax o{cot}} +\def\coth{\qopname\relax o{coth}} +\def\csc{\qopname\relax o{csc}} +\def\deg{\qopname\relax o{deg}} +\def\det{\qopname\relax m{det}} +\def\dim{\qopname\relax o{dim}} +\def\exp{\qopname\relax o{exp}} +\def\gcd{\qopname\relax m{gcd}} +\def\hom{\qopname\relax o{hom}} +\def\inf{\qopname\relax m{inf}} +\def\injlim{\qopname\relax m{inj\,lim}} +\def\ker{\qopname\relax o{ker}} +\def\lg{\qopname\relax o{lg}} +\def\lim{\qopname\relax m{lim}} +\def\liminf{\qopname\relax m{lim\,inf}} +\def\limsup{\qopname\relax m{lim\,sup}} +\def\ln{\qopname\relax o{ln}} +\def\log{\qopname\relax o{log}} +\def\max{\qopname\relax m{max}} +\def\min{\qopname\relax m{min}} +\def\Pr{\qopname\relax m{Pr}} +\def\projlim{\qopname\relax m{proj\,lim}} +\def\sec{\qopname\relax o{sec}} +\def\sin{\qopname\relax o{sin}} +\def\sinh{\qopname\relax o{sinh}} +\def\sup{\qopname\relax m{sup}} +\def\tan{\qopname\relax o{tan}} +\def\tanh{\qopname\relax o{tanh}} +% \end{macrocode} +% +% \begin{macro}{\operator@font} +% \begin{macro}{\operatorfont} +% This command is provided to allow the document styles to decide in +% which way math operators like `max' or `log' are typeset. The +% default is to set them in \meta{math group} zero of the current +% math version. The original name was \cs{operator@font}, retained +% for compatibility; the second name was added to make it +% more accessible so that users can call this font for use in special +% constructs that are not ordinary operator names but conceptually +% related. +% \begin{macrocode} +\def\operator@font{\mathgroup\symoperators} +\def\operatorfont{\operator@font} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% For backwards compatibility we keep this old command name for the +% time being: +% \begin{macrocode} +\def\operatornamewithlimits{\operatorname*} +% \end{macrocode} +% +% These macros use \cs{mathpalette}s so that they will change size +% in script and scriptscript styles, though it's hard to imagine they +% will ever be used there (the arrows, particularly, look bad in +% subscript sizes). Notice that the use of \cs{ex@} means that the +% vertical spacing may not be optimal in script and scriptscript +% sizes. Unfortunately \tex/ provides no easy way to do math mode +% vertical spacing that varies with current math style like mu units. +% \begin{macrocode} +\def\varlim@#1#2{% + \vtop{\m@th\ialign{##\cr + \hfil$#1\operator@font lim$\hfil\cr + \noalign{\nointerlineskip\kern1.5\ex@}#2\cr + \noalign{\nointerlineskip\kern-\ex@}\cr}}% +} +\def\varinjlim{% + \mathop{\mathpalette\varlim@{\rightarrowfill@\textstyle}}\nmlimits@ +} +\def\varprojlim{% + \mathop{\mathpalette\varlim@{\leftarrowfill@\textstyle}}\nmlimits@ +} +\def\varliminf{\mathop{\mathpalette\varliminf@{}}\nmlimits@} +\def\varliminf@#1{\@@underline{\vrule\@depth.2\ex@\@width\z@ + \hbox{$#1\m@th\operator@font lim$}}} +\def\varlimsup{\mathop{\mathpalette\varlimsup@{}}\nmlimits@} +\def\varlimsup@#1{\@@overline{\hbox{$#1\m@th\operator@font lim$}}} +% \end{macrocode} +% +% \begin{macrocode} +\let\nmlimits@\displaylimits +\DeclareOption{namelimits}{\let\nmlimits@\displaylimits} +\DeclareOption{nonamelimits}{\let\nmlimits@\nolimits} +\ProcessOptions\relax +% \end{macrocode} +% +% If we don't load the \pkg{amsgen} package then the use of \cs{ex@} +% in \cs{varlim@} will lead to trouble. +% \begin{macrocode} +\RequirePackage{amsgen}\relax +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \changes{v1.2a}{1995/02/20}{Fixed operatorname +% (shouldn't have same limits behavior as operatorname*)} +% +% \Finale diff --git a/macros/latex-dev/required/amsmath/amsopn.ins b/macros/latex-dev/required/amsmath/amsopn.ins new file mode 100644 index 0000000000..8c977446cc --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsopn.ins @@ -0,0 +1,50 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amsopn.sty}{\from{amsopn.dtx}{}} +} + +\endbatchfile diff --git a/macros/latex-dev/required/amsmath/amsopn.pdf b/macros/latex-dev/required/amsmath/amsopn.pdf Binary files differnew file mode 100644 index 0000000000..f854a4246b --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsopn.pdf diff --git a/macros/latex-dev/required/amsmath/amstex.sty b/macros/latex-dev/required/amsmath/amstex.sty new file mode 100644 index 0000000000..edb57c1214 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amstex.sty @@ -0,0 +1,2025 @@ +% +% \iffalse meta-comment +% +% Copyright 1995, 1999 American Mathematical Society. +% Copyright 2016 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +% This file was generated from version 1.2beta of amstex.dtx and then +% underwent additional hand-editing. +\if@compatibility \else \catcode`\%=9 \fi +%\PackageError{amstex}{% +%Package `amstex' is obsolete, substituting `amsmath'}{You +%should use \string\usepackage{amsmath} instead. If +%that does not give satisfactory results, rename your previous copy +%of amstex.sty to amstex12beta.sty and call it with +%\string\usepackage{amstex12beta}.} +%\catcode`\%=14 \relax \input{amsmath.sty}\endinput +% +\ProvidesPackage{amstex}[1999/11/15 v1.2f AMS extra math features] +\let\@amsfonts=T +\DeclareOption{noamsfonts}{\let\@amsfonts=F} +\DeclareOption{psamsfonts}{\let\@amsfonts=P} +\DeclareOption{intlimits}{\let\ilimits@\displaylimits} +\DeclareOption{nointlimits}{\let\ilimits@\nolimits} +\DeclareOption{sumlimits}{\let\slimits@\displaylimits} +\DeclareOption{nosumlimits}{\let\slimits@\nolimits} +\DeclareOption{namelimits}{\let\nlimits@\displaylimits} +\DeclareOption{nonamelimits}{\let\nlimits@\nolimits} +\newif\ifctagsplit@ +\newif\iftagsleft@ +\DeclareOption{leqno}{\tagsleft@true} +\DeclareOption{reqno}{\tagsleft@false} +\DeclareOption{centertags}{\ctagsplit@true} +\DeclareOption{tbtags}{\ctagsplit@false} +\newif\if@fleqn +\newskip\@mathmargin +\@mathmargin\@centering +\DeclareOption{fleqn}{% + \@fleqntrue + \@mathmargin\m@ne sp + \AtBeginDocument{% + \ifdim\@mathmargin=\m@ne sp + \@mathmargin\leftmargini + \fi + }% +} +\DeclareOption{righttag}{\tagsleft@false} +\DeclareOption{ctagsplt}{\ctagsplit@true} +\DeclareOption{intlim}{\let\ilimits@\displaylimits} +\DeclareOption{nosumlim}{\let\slimits@\nolimits} +\DeclareOption{nonamelm}{\let\nlimits@\nolimits} +\ExecuteOptions{nointlimits,sumlimits,namelimits,centertags} +\ProcessOptions +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% In this section \RequirePackage statements were replaced with the +%% contents of the referenced files. +%%% filename = "amsgen.dtx", +%%% version = "1.2beta", +%%% date = "1994/12/13", +\providecommand{\@saveprimitive}[2]{\begingroup\escapechar`\\\relax + \edef\@tempa{\string#1}\edef\@tempb{\meaning#1}% + \ifx\@tempa\@tempb \global\let#2#1% + \else + \edef\@tempb{\meaning#2}% + \ifx\@tempa\@tempb + \else + \@latex@error{Unable to properly define \string#2; primitive + \noexpand#1no longer primitive}\@eha + \fi + \fi + \endgroup} +\let\@xp=\expandafter +\let\@nx=\noexpand +\newtoks\@emptytoks +\def\@oparg#1[#2]{\@ifnextchar[{#1}{#1[#2]}} +\def\@ifempty#1{\@xifempty#1@@..\@nil} +\long\def\@xifempty#1#2@#3#4#5\@nil{% + \ifx#3#4\@xp\@firstoftwo\else\@xp\@secondoftwo\fi} +\long\def\@ifnotempty#1{\@ifempty{#1}{}} +\def\FN@{\futurelet\@let@token} +\def\DN@{\def\next@} +\def\RIfM@{\relax\ifmmode} +\def\setboxz@h{\setbox\z@\hbox} +\def\wdz@{\wd\z@} +\def\boxz@{\box\z@} +\def\relaxnext@{\let\@let@token\relax} +\def\new@ifnextchar#1#2#3{% + \let\@tempe #1\def\@tempa{#2}\def\@tempb{#3}\futurelet + \@tempc\new@ifnch} +\def\new@ifnch{\ifx\@tempc \@tempe \let\@tempd\@tempa + \else\let\@tempd\@tempb\fi\@tempd} +\def\new@ifstar#1#2{\new@ifnextchar *{\def\@tempa*{#1}\@tempa}{#2}} +\@ifundefined{every@math@size}{% +\let\every@math@size=\every@size +\def\glb@settings{% + \expandafter\ifx\csname S@\f@size\endcsname\relax + \calculate@math@sizes + \fi + \csname S@\f@size\endcsname + \ifmath@fonts + \begingroup + \escapechar\m@ne + \csname mv@\math@version \endcsname + \globaldefs\@ne + \let \glb@currsize \f@size + \math@fonts + \endgroup + \the\every@math@size + \else + \fi +} +\def\set@fontsize#1#2#3{% + \@defaultunits\@tempdimb#2pt\relax\@nnil + \edef\f@size{\strip@pt\@tempdimb}% + \@defaultunits\@tempskipa#3pt\relax\@nnil + \edef\f@baselineskip{\the\@tempskipa}% + \edef\f@linespread{#1}% + \let\baselinestretch\f@linespread + \def\size@update{% + \baselineskip\f@baselineskip\relax + \baselineskip\f@linespread\baselineskip + \normalbaselineskip\baselineskip + \setbox\strutbox\hbox{% + \vrule\@height.7\baselineskip + \@depth.3\baselineskip + \@width\z@}% +%%% \the\every@size + \let\size@update\relax}% + } +}{}% end \@ifundefined test +\newdimen\ex@ +\addto@hook\every@math@size{\compute@ex@} +\def\compute@ex@{% + \begingroup + \dimen@-\f@size\p@ + \ifdim\dimen@<-20\p@ + \global\ex@ 1.5\p@ + \else + \advance\dimen@10\p@ \multiply\dimen@\tw@ + \edef\@tempa{\ifdim\dimen@>\z@ -\fi}% + \dimen@ \ifdim\dimen@<\z@ -\fi \dimen@ + \advance\dimen@-\@m sp % fudge factor + \vfuzz\p@ + \def\do{\ifdim\dimen@>\z@ + \vfuzz=.97\vfuzz + \advance\dimen@ -\p@ + \@xp\do \fi}% + \do + \dimen@\p@ \advance\dimen@-\vfuzz + \global\ex@\p@ + \global\advance\ex@ \@tempa\dimen@ + \fi + \endgroup +} +\def\@addpunct#1{\ifnum\spacefactor>\@m \else#1\fi} +\def\frenchspacing{\sfcode`\.1006\sfcode`\?1005\sfcode`\!1004% + \sfcode`\:1003\sfcode`\;1002\sfcode`\,1001 } +\def\@mathmeasure#1#2#3{\setbox#1\hbox{\frozen@everymath\@emptytoks + \m@th$#2#3$}} +\def\nomath@env{\PackageError{amstex}{% + \string\begin{\@currenvir} allowed only in paragraph mode% +}\@ehb% "You've lost some text" +} +\def\Invalid@@{Invalid use of \string} +\def\nonmatherr@#1{\PackageError{amsfonts}% + {\noexpand#1allowed only in math mode}\@ehd} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% filename = "amstext.dtx", +%%% version = "1.2beta", +%%% date = "1994/12/13", +\DeclareRobustCommand{\text}{% + \ifmmode\expandafter\text@\else\expandafter\mbox\fi} +\let\nfss@text\text +\def\text@#1{\mathchoice + {\textdef@\displaystyle\f@size{#1}}% + {\textdef@\textstyle\tf@size{\firstchoice@false #1}}% + {\textdef@\textstyle\sf@size{\firstchoice@false #1}}% + {\textdef@\textstyle \ssf@size{\firstchoice@false #1}}% + \check@mathfonts +} +\def\textdef@#1#2#3{\hbox{{% + \everymath{#1}% + \let\f@size#2\selectfont + #3}}} +\newif\iffirstchoice@ +\firstchoice@true +\def\stepcounter#1{% + \iffirstchoice@ + \global\expandafter\advance\csname c@#1\endcsname \@ne + \begingroup + \let\@elt\@stpelt + \csname cl@#1\endcsname + \endgroup + \fi} +\toks@{\iffirstchoice@\else\@xp\@gobblefour\fi\protect} +\edef\GenericInfo{\the\toks@ + \@xp\@nx\csname GenericInfo \endcsname} +\edef\GenericWarning{\the\toks@ + \@xp\@nx\csname GenericWarning \endcsname} +\toks@{\iffirstchoice@\else + \@xp\@xp\@xp\@gobblefour + \@xp\@gobbletwo\fi\protect} +\edef\GenericError{\the\toks@ + \@xp\@nx\csname GenericError \endcsname} +\def\label#1{\@bsphack\iffirstchoice@\if@filesw {\let\thepage\relax + \def\protect{\noexpand\noexpand\noexpand}% +\xdef\@gtempa{\write\@auxout{\string + \newlabel{#1}{{\@currentlabel}{\thepage}}}}}\@gtempa + \if@nobreak \ifvmode\nobreak\fi\fi\fi\fi\@esphack} +\begingroup \catcode`\"=12 +\gdef\mathhexbox#1#2#3{\text{$\m@th\mathchar"#1#2#3$}} +\endgroup +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% filename = "amsfonts.dtx", +%%% version = "1.2beta", +%%% date = "1994/12/13", +\newbox\Mathstrutbox@ +\setbox\Mathstrutbox@=\hbox{} +\def\Mathstrut@{\copy\Mathstrutbox@} +\addto@hook\every@math@size{\setbox\z@\hbox{\normalfont(}% + \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@} +\newbox\strutbox@ +\def\strut@{\copy\strutbox@} +\addto@hook\every@math@size{% + \global\setbox\strutbox@\hbox{\lower.5\normallineskiplimit + \vbox{\kern-\normallineskiplimit\copy\strutbox}}} +\def\big{\bBigg@\@ne} +\def\Big{\bBigg@{1.5}} +\def\bigg{\bBigg@\tw@} +\def\Bigg{\bBigg@{2.5}} +\def\bBigg@#1#2{% + {% + \hbox{$\left#2\vcenter to#1\big@size{}\right.% + \n@space + $}}} +\addto@hook\every@math@size{% + \global\big@size 1.2\ht\Mathstrutbox@ + \global\advance\big@size 1.2\dp\Mathstrutbox@ } +\newdimen\big@size +%% msam, msbm, eufm fonts dealt with at end of file +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% filename = "amsbsy.dtx", +%%% version = "1.2beta", +%%% date = "1994/10/27", +\DeclareRobustCommand{\boldsymbol}[1]{% + \begingroup + \let\@nomath\@gobble \mathversion{bold}% + \math@atom{#1}{% + \mathchoice% + {\hbox{$\m@th\displaystyle#1$}}% + {\hbox{$\m@th\textstyle#1$}}% + {\hbox{$\m@th\scriptstyle#1$}}% + {\hbox{$\m@th\scriptscriptstyle#1$}}}% + \endgroup} +\def\math@atom#1#2{% + \binrel@{#1}\binrel@@{#2}} +\DeclareRobustCommand{\pmb}{% + \ifmmode\else \expandafter\pmb@@\fi\mathpalette\pmb@} +\def\pmb@@#1#2#3{\leavevmode\setboxz@h{#3}% + \dimen@-\wdz@ + \kern-.5\ex@\copy\z@ + \kern\dimen@\kern.25\ex@\raise.4\ex@\copy\z@ + \kern\dimen@\kern.25\ex@\box\z@ +} +\newdimen\pmbraise@ +\def\pmb@#1#2{\setbox8\hbox{$\m@th#1{#2}$}% + \setboxz@h{$\m@th#1\mkern.5mu$}\pmbraise@\wdz@ + \binrel@{#2}% + \dimen@-\wd8 % + \binrel@@{% + \mkern-.8mu\copy8 % + \kern\dimen@\mkern.4mu\raise\pmbraise@\copy8 % + \kern\dimen@\mkern.4mu\box8 }% +} +\def\binrel@#1{\begingroup + \setboxz@h{\thinmuskip0mu + \medmuskip\m@ne mu\thickmuskip\@ne mu + \setbox\tw@\hbox{$#1\m@th$}\kern-\wd\tw@ + ${}#1{}\m@th$}% + \edef\@tempa{\endgroup\let\noexpand\binrel@@ + \ifdim\wdz@<\z@ \mathbin + \else\ifdim\wdz@>\z@ \mathrel + \else \relax\fi\fi}% + \@tempa +} +\let\binrel@@\relax +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\AmSTeX{\protect\AmS-\protect\TeX{}} +\def\AmS{{\protect\AmSfont + A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}} +\def\AmSfont{% + \usefont{OMS}{cmsy}{\if\@xp\@car\f@series\@nil bb\else m\fi}{n}} +\def\prim@s{\prime\futurelet\@let@token\pr@m@s} +\def\pr@m@s{% + \ifx\@let@token'\DN@##1{\prim@s}\else\let\next@\egroup\fi\next@} +\let\@prime=\prime +\renewcommand{\prime}{{\kern\z@\@prime}} +\DeclareRobustCommand{\mspace}[3]{% + \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} +\renewcommand{\,}{\mspace+\thinmuskip{.1667em}} +\let\thinspace\, +\renewcommand{\!}{\mspace-\thinmuskip{.1667em}} +\let\negthinspace\! +\renewcommand{\:}{\mspace+\medmuskip{.2222em}} +\let\medspace\: +\newcommand{\negmedspace}{\mspace-\medmuskip{.2222em}} +\renewcommand{\;}{\mspace+\thickmuskip{.2777em}} +\let\thickspace\; +\newcommand{\negthickspace}{\mspace-\thickmuskip{.2777em}} +\def\implies{\DOTSB\;\Longrightarrow\;} +\def\impliedby{\DOTSB\;\Longleftarrow\;} +\begingroup \catcode`\"=12 % in case activated by a preceding package +\gdef\And{\DOTSB\;\mathchar"3026 \;} +\gdef\lvert{\delimiter"426A30C } +\gdef\rvert{\delimiter"526A30C } +\gdef\lVert{\delimiter"426B30D } +\gdef\rVert{\delimiter"526B30D } +\endgroup % restore " +\DeclareRobustCommand{\frac}{\new@ifnextchar[{\frfrac{}}{\frfrac{}[]}} +\def\frfrac#1[#2]#3#4{\def\next@{#2}% + \ifx\next@\@empty \def\next@{#1{#3\over#4}}% + \else \def\next@{{#1{#3\above#2\relax#4}}}% + \fi + \next@} +\def\dfrac{\protect\frfrac\displaystyle[]} +\def\tfrac{\protect\frfrac\textstyle[]} +\DeclareRobustCommand{\binom}{\frbinom{}} +\def\frbinom#1#2#3{{#1{#2\atopwithdelims()#3}}} +\def\dbinom{\protect\frbinom\displaystyle} +\def\tbinom{\protect\frbinom\textstyle} +\def\colon{\nobreak\mskip2mu\mathpunct{}\nonscript + \mkern-\thinmuskip{:}\mskip6muplus1mu\relax} +\begingroup \catcode`\"=12 +\DeclareMathSymbol{\coprod@}{\mathop}{largesymbols}{"60} +\gdef\coprod{\DOTSB\coprod@\slimits@} +\DeclareMathSymbol{\bigvee@}{\mathop}{largesymbols}{"57} +\gdef\bigvee{\DOTSB\bigvee@\slimits@} +\DeclareMathSymbol{\bigwedge@}{\mathop}{largesymbols}{"56} +\gdef\bigwedge{\DOTSB\bigwedge@\slimits@} +\DeclareMathSymbol{\biguplus@}{\mathop}{largesymbols}{"55} +\gdef\biguplus{\DOTSB\biguplus@\slimits@} +\DeclareMathSymbol{\bigcap@}{\mathop}{largesymbols}{"54} +\gdef\bigcap{\DOTSB\bigcap@\slimits@} +\DeclareMathSymbol{\bigcup@}{\mathop}{largesymbols}{"53} +\gdef\bigcup{\DOTSB\bigcup@\slimits@} +\DeclareMathSymbol{\prod@}{\mathop}{largesymbols}{"51} +\gdef\prod{\DOTSB\prod@\slimits@} +\DeclareMathSymbol{\sum@}{\mathop}{largesymbols}{"50} +\gdef\sum{\DOTSB\sum@\slimits@} +\DeclareMathSymbol{\bigotimes@}{\mathop}{largesymbols}{"4E} +\gdef\bigotimes{\DOTSB\bigotimes@\slimits@} +\DeclareMathSymbol{\bigoplus@}{\mathop}{largesymbols}{"4C} +\gdef\bigoplus{\DOTSB\bigoplus@\slimits@} +\DeclareMathSymbol{\bigodot@}{\mathop}{largesymbols}{"4A} +\gdef\bigodot{\DOTSB\bigodot@\slimits@} +\DeclareMathSymbol{\bigsqcup@}{\mathop}{largesymbols}{"46} +\gdef\bigsqcup{\DOTSB\bigsqcup@\slimits@} +\endgroup +\def\dddot#1{{\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@ + \hbox{\normalfont ...}\vss}}}} +\def\ddddot#1{{\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@ + \hbox{\normalfont....}\vss}}}} +\def~{\nobreakspace} +\DeclareRobustCommand{\nobreakspace}{\unskip\nobreak\ \ignorespaces} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\if@display +\everydisplay\expandafter{\the\everydisplay \@displaytrue} +\def\int{\DOTSI\intop\ilimits@} +\def\oint{\DOTSI\ointop\ilimits@} +\def\intkern@{\mkern-6mu\mathchoice{\mkern-3mu}{}{}{}} +\def\intdots@{\mathchoice{\@cdots}% + {{\cdotp}\mkern1.5mu{\cdotp}\mkern1.5mu{\cdotp}}% + {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}% + {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}} + +\def\iint{\DOTSI\protect\ints@\tw@} +\def\iiint{\DOTSI\protect\ints@\thr@@} +\def\iiiint{\DOTSI\protect\ints@{4}} +\def\idotsint{\DOTSI\protect\ints@\z@} + +\def\ints@#1{% + \mkern-7mu\mathchoice{\mkern-2mu}{}{}{}% + \mathop{\mkern7mu\mathchoice{\mkern2mu}{}{}{}% + \intop\ifnum#1=\z@\intdots@ + \else\intkern@\fi + \ifnum#1>\tw@\intop\intkern@\fi + \ifnum#1>\thr@@\intop\intkern@\fi + \intop + }\ilimits@ +} +\def\nolimits@{% + \DN@{\nolimits\ifx\@let@token\limits\expandafter\@gobble\fi}% + \FN@\next@} +\begingroup \catcode`\"=12 +\gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\."613A% + \mathcode`\-45\mathcode`\/47\mathcode`\:"603A\relax} +\endgroup +\DeclareRobustCommand{\operatorname}{% + \@ifstar{\qopname\newmcodes@ n}% + {\qopname\newmcodes@{no}}}% +\DeclareRobustCommand{\qopname}[3]{\mathop{#1\kern\z@\operator@font#3}% + \csname #2limits@\endcsname} +\def\arccos{\qopname\relax{no}{arccos}} +\def\arcsin{\qopname\relax{no}{arcsin}} +\def\arctan{\qopname\relax{no}{arctan}} +\def\arg{\qopname\relax{no}{arg}} +\def\cos{\qopname\relax{no}{cos}} +\def\cosh{\qopname\relax{no}{cosh}} +\def\cot{\qopname\relax{no}{cot}} +\def\coth{\qopname\relax{no}{coth}} +\def\csc{\qopname\relax{no}{csc}} +\def\deg{\qopname\relax{no}{deg}} +\def\det{\qopname\relax n{det}} +\def\dim{\qopname\relax{no}{dim}} +\def\exp{\qopname\relax{no}{exp}} +\def\gcd{\qopname\relax n{gcd}} +\def\hom{\qopname\relax{no}{hom}} +\def\inf{\qopname\relax n{inf}} +\def\injlim{\qopname\relax n{inj\,lim}} +\def\ker{\qopname\relax{no}{ker}} +\def\lg{\qopname\relax{no}{lg}} +\def\lim{\qopname\relax n{lim}} +\def\liminf{\qopname\relax n{lim\,inf}} +\def\limsup{\qopname\relax n{lim\,sup}} +\def\ln{\qopname\relax{no}{ln}} +\def\log{\qopname\relax{no}{log}} +\def\max{\qopname\relax n{max}} +\def\min{\qopname\relax n{min}} +\def\Pr{\qopname\relax n{Pr}} +\def\projlim{\qopname\relax n{proj\,lim}} +\def\sec{\qopname\relax{no}{sec}} +\def\sin{\qopname\relax{no}{sin}} +\def\sinh{\qopname\relax{no}{sinh}} +\def\sup{\qopname\relax n{sup}} +\def\tan{\qopname\relax{no}{tan}} +\def\tanh{\qopname\relax{no}{tanh}} +\def\operator@font{\mathgroup\symoperators} +\def\operatornamewithlimits{\operatorname*} +\def\varlim@#1#2{\mathop{\vtop{\ialign{##\crcr + \hfil$#1\m@th\operator@font lim$\hfil\crcr + \noalign{\nointerlineskip\kern\ex@}#2#1\crcr + \noalign{\nointerlineskip\kern-\ex@}\crcr}}}} +\def\varinjlim{\mathpalette\varlim@\rightarrowfill@} +\def\varprojlim{\mathpalette\varlim@\leftarrowfill@} +\def\varliminf{\mathpalette\varliminf@{}} +\def\varliminf@#1{\mathop{\@@underline{\vrule\@depth.2\ex@\@width\z@ + \hbox{$#1\m@th\operator@font lim$}}}} +\def\varlimsup{\mathpalette\varlimsup@{}} +\def\varlimsup@#1{\mathop{\@@overline + {\hbox{$#1\m@th\operator@font lim$}}}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\numberwithin#1#2{\@ifundefined{c@#1}{\@nocounterr{#1}}{% + \@ifundefined{c@#2}{\@nocnterr{#2}}{% + \@addtoreset{#1}{#2}% + \toks@\expandafter\expandafter\expandafter{\csname the#1\endcsname}% + \expandafter\xdef\csname the#1\endcsname + {\expandafter\noexpand\csname the#2\endcsname + .\the\toks@}}}} +\def\eqref#1{\textup{\tagform@{\ref{#1}}}} +\def\bmod{\mskip-\medmuskip\mkern5mu\mathbin + {\operator@font mod}\penalty900 + \mkern5mu\mskip-\medmuskip} +\def\pod#1{\allowbreak\if@display\mkern18mu\else\mkern8mu\fi(#1)} +\def\pmod#1{\pod{{\operator@font mod}\mkern6mu#1}} +\def\mod#1{\allowbreak\if@display\mkern18mu + \else\mkern12mu\fi{\operator@font mod}\,\,#1} +\newcommand{\cfrac}[3][c]{{\displaystyle\frac{% + \strut\ifx r#1\hfill\fi#2\ifx l#1\hfill\fi}{#3}}% + \kern-\nulldelimiterspace} +\def\lcfrac{\cfrac[l]} +\def\rcfrac{\cfrac[r]} +\def\overset#1#2{\binrel@{#2}% + \binrel@@{\mathop{\kern\z@#2}\limits^{#1}}} +\def\underset#1#2{\binrel@{#2}% + \binrel@@{\mathop{\kern\z@#2}\limits_{#1}}} +\def\sideset#1#2#3{% + \setbox\z@\hbox{$\displaystyle{\vphantom{#3}}#1{#3}\m@th$}% + \setbox\tw@\hbox{$\displaystyle{#3}#2\m@th$}% + \hskip\wd\z@\hskip-\wd\tw@\mathop{\hskip\wd\tw@\hskip-\wd\z@ + {\vphantom{#3}}#1{#3}#2}} +\renewcommand{\smash}[2][tb]{% + \def\smash@{#1}% + \ifmmode\expandafter\mathpalette\expandafter\mathsm@sh\else + \expandafter\makesm@sh\fi{#2}} +\def\finsm@sh{\def\mb@t{\ht\z@\z@}\def\mb@b{\dp\z@\z@}% + \def\mb@tb{\mb@t\mb@b}% + {\csname mb@\smash@\endcsname}% + \leavevmode\boxz@} +\def\rightarrowfill@#1{\m@th\setboxz@h{$#1\relbar$}\ht\z@\z@ + $#1\copy\z@\mkern-6mu\cleaders + \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill + \mkern-6mu\mathord\rightarrow$} +\def\leftarrowfill@#1{\m@th\setboxz@h{$#1\relbar$}\ht\z@\z@ + $#1\mathord\leftarrow\mkern-6mu\cleaders + \hbox{$#1\mkern-2mu\copy\z@\mkern-2mu$}\hfill + \mkern-6mu\box\z@$} +\def\leftrightarrowfill@#1{\m@th\setboxz@h{$#1\relbar$}\ht\z@\z@ + $#1\mathord\leftarrow\mkern-6mu\cleaders + \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill + \mkern-6mu\mathord\rightarrow$} +\def\overarrow@#1#2#3{\vbox{\ialign{##\crcr#1#2\crcr + \noalign{\kern-\ex@\nointerlineskip}$\m@th\hfil#2#3\hfil$\crcr}}} +\def\overrightarrow{\mathpalette{\overarrow@\rightarrowfill@}} +\def\overleftarrow{\mathpalette{\overarrow@\leftarrowfill@}} +\def\overleftrightarrow{\mathpalette{\overarrow@\leftrightarrowfill@}} +\def\underarrow@#1#2#3{% + \vtop{\ialign{##\crcr$\m@th\hfil#2#3\hfil$\crcr + \noalign{\nointerlineskip\kern-.5\ex@}#1#2\crcr}}} +\def\underrightarrow{\mathpalette{\underarrow@\rightarrowfill@}} +\def\underleftarrow{\mathpalette{\underarrow@\leftarrowfill@}} +\def\underleftrightarrow{\mathpalette{\underarrow@\leftrightarrowfill@}} +\let\ifgtest@\iffalse % initial value +\def\gtest@true{\global\let\ifgtest@\iftrue} +\def\gtest@false{\global\let\ifgtest@\iffalse} +\let\DOTSI\relax +\let\DOTSB\relax +\let\DOTSX\relax +{\uccode`7=`\\ \uccode`8=`m \uccode`9=`a \uccode`0=`t \uccode`!=`h + \uppercase{% + \gdef\math@#1#2#3#4#5#6\math@{\gtest@false\ifx 7#1\ifx 8#2% + \ifx 9#3\ifx 0#4\ifx !#5\xdef\meaning@{#6}\gtest@true + \fi\fi\fi\fi\fi}}} +{\uccode`7=`c \uccode`8=`h \uccode`9=`\" + \uppercase{\gdef\mathch@#1#2#3#4#5#6\mathch@{\gtest@false + \ifx 7#1\ifx 8#2\ifx 9#5\gtest@true\xdef\meaning@{9#6}\fi\fi\fi}}} +\newcount\classnum@ +\def\getmathch@#1.#2\getmathch@{\classnum@#1 \divide\classnum@4096 + \ifcase\number\classnum@\or\or\gdef\thedots@{\dotsb@}\or + \gdef\thedots@{\dotsb@}\fi} +{\uccode`4=`b \uccode`5=`i \uccode`6=`n + \uppercase{\gdef\mathbin@#1#2#3{\relaxnext@ + \def\nextii@##1\mathbin@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\mathbin@{}% + \ifx 4#1\ifx 5#2\ifx 6#3\DN@{\FN@\nextii@}\fi\fi\fi\next@}}} +{\uccode`4=`r \uccode`5=`e \uccode`6=`l + \uppercase{\gdef\mathrel@#1#2#3{\relaxnext@ + \def\nextii@##1\mathrel@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\mathrel@{}% + \ifx 4#1\ifx 5#2\ifx 6#3\DN@{\FN@\nextii@}\fi\fi\fi\next@}}} +{\uccode`5=`m \uccode`6=`a \uccode`7=`c + \uppercase{\gdef\macro@#1#2#3#4\macro@{\gtest@false + \ifx 5#1\ifx 6#2\ifx 7#3\gtest@true + \xdef\meaning@{\macro@@#4\macro@@}\fi\fi\fi}}} +\def\macro@@#1->#2\macro@@{#2} +\newcount\DOTSCASE@ +{\uccode`6=`\\ \uccode`7=`D \uccode`8=`O \uccode`9=`T \uccode`0=`S + \uppercase{\gdef\DOTS@#1#2#3#4#5{\gtest@false\DN@##1\DOTS@{}% + \ifx 6#1\ifx 7#2\ifx 8#3\ifx 9#4\ifx 0#5\let\next@\DOTS@@ + \fi\fi\fi\fi\fi + \next@}}} +{\uccode`3=`B \uccode`4=`I \uccode`5=`X + \uppercase{\gdef\DOTS@@#1{\relaxnext@ + \def\nextii@##1\DOTS@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \DN@{\FN@\nextii@}% + \ifx 3#1\global\DOTSCASE@\z@\else + \ifx 4#1\global\DOTSCASE@\@ne\else + \ifx 5#1\global\DOTSCASE@\tw@\else\DN@##1\DOTS@{}% + \fi\fi\fi\next@}}} +{\uccode`5=`\\ \uccode`6=`n \uccode`7=`o \uccode`8=`t + \uppercase{\gdef\not@#1#2#3#4{\relaxnext@ + \def\nextii@##1\not@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\not@{}% + \ifx 5#1\ifx 6#2\ifx 7#3\ifx 8#4\DN@{\FN@\nextii@}\fi\fi\fi + \fi\next@}}} +\def\keybin@{\gtest@true + \ifx\@let@token+\else\ifx\@let@token=\else\ifx\@let@token<% + \else\ifx\@let@token>\else\ifx\@let@token-\else\ifx\@let@token*% + \else\ifx\@let@token:\else\gtest@false\fi\fi\fi\fi\fi\fi\fi} +\@ifundefined{@ldots}{\def\@ldots{\mathellipsis}}{} +\DeclareRobustCommand{\dots}{\relax + \csname\ifmmode m\else t\fi dots@\endcsname} +\def\tdots@{\leavevmode\unskip\relaxnext@ + \DN@{$\m@th\@ldots\, + \ifx\@let@token,\,$\else\ifx\@let@token.\,$\else\ifx\@let@token;\,$% + \else\ifx\@let@token:\,$\else\ifx\@let@token?\,$% + \else\ifx\@let@token!\,$\else$ \fi\fi\fi\fi\fi\fi}% + \ \FN@\next@} +\def\mdots@{\FN@\mdots@@} +\def\mdots@@{\gdef\thedots@{\dotso@}% + \ifx\@let@token\boldsymbol\gdef\thedots@\boldsymbol{\boldsymboldots@}% + \else\ifx,\@let@token\gdef\thedots@{\dotsc}% + \else\ifx\not\@let@token\gdef\thedots@{\dotsb@}% + \else\keybin@ + \ifgtest@\gdef\thedots@{\dotsb@}% + \else\xdef\meaning@{\meaning\@let@token..........}% + \xdef\meaning@@{\meaning@}% + \expandafter\math@\meaning@\math@ + \ifgtest@ + \expandafter\mathch@\meaning@\mathch@ + \ifgtest@\expandafter\getmathch@\meaning@\getmathch@\fi + \else\expandafter\macro@\meaning@@\macro@ + \ifgtest@ + \expandafter\not@\meaning@\not@\ifgtest@\gdef\thedots@{\dotsb@}% + \else\expandafter\DOTS@\meaning@\DOTS@ + \ifgtest@ + \ifcase\number\DOTSCASE@\gdef\thedots@{\dotsb@}% + \or\gdef\thedots@{\dotsi}\else\fi + \else\expandafter\math@\meaning@\math@ + \ifgtest@\expandafter\mathbin@\meaning@\mathbin@ + \ifgtest@\gdef\thedots@{\dotsb@}% + \else\expandafter\mathrel@\meaning@\mathrel@ + \ifgtest@\gdef\thedots@{\dotsb@}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \thedots@} +\def\boldsymboldots@#1{% + \bold@true\let\@let@token=#1\let\delayed@=#1\mdots@@ + \boldsymbol#1\bold@false} +\def\@cdots{\mathinner{\cdotp\cdotp\cdotp}} +\def\dotsi{\!\@cdots} +\let\dotsb@\@cdots +\def\rightdelim@{\gtest@true + \ifx\@let@token)\else + \ifx\@let@token]\else + \ifx\@let@token\rbrack\else + \ifx\@let@token\}\else + \ifx\@let@token\rbrace\else + \ifx\@let@token\rangle\else + \ifx\@let@token\rceil\else + \ifx\@let@token\rfloor\else + \ifx\@let@token\rgroup\else + \ifx\@let@token\rmoustache\else + \ifx\@let@token\right\else + \ifx\@let@token\bigr\else + \ifx\@let@token\biggr\else + \ifx\@let@token\Bigr\else + \ifx\@let@token\Biggr\else\gtest@false + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} +\def\extra@{% + \rightdelim@\ifgtest@ + \else\ifx\@let@token$\gtest@true + \else\xdef\meaning@{\meaning\@let@token..........}% + \expandafter\macro@\meaning@\macro@\ifgtest@ + \expandafter\DOTS@\meaning@\DOTS@ + \ifgtest@ + \ifnum\DOTSCASE@=\tw@\gtest@true\else\gtest@false + \fi\fi\fi\fi\fi} +\newif\ifbold@ +\def\dotso@{\relaxnext@ + \ifbold@ + \let\@let@token\delayed@ + \def\nextii@{\extra@\@ldots\ifgtest@\,\fi}% + \else + \def\nextii@{\DN@{\extra@\@ldots\ifgtest@\,\fi}\FN@\next@}% + \fi + \nextii@} +\def\extrap@#1{% + \DN@{#1\,}% + \ifx\@let@token,\else + \ifx\@let@token;\else + \ifx\@let@token.\else\extra@ + \ifgtest@\else + \let\next@#1\fi\fi\fi\fi\next@} +\DeclareRobustCommand{\ldots}{\relax + \ifmmode \DN@{\extrap@\@ldots}% + \else \let\next@\tdots@\fi + \FN@\next@} +\DeclareRobustCommand{\cdots}{\DN@{\extrap@\@cdots}\FN@\next@} +\let\dotso\ldots +\let\dotsb\cdots +\let\dotsm\dotsb +\DeclareRobustCommand{\dotsc}{% + \DN@{\ifx\@let@token;\@ldots\,% + \else \ifx\@let@token.\@ldots\,% + \else \extra@\@ldots \ifgtest@\,\fi + \fi\fi}% + \FN@\next@} +\def\longrightarrow{\DOTSB\relbar\joinrel\rightarrow} +\def\Longrightarrow{\DOTSB\Relbar\joinrel\Rightarrow} +\def\longleftarrow{\DOTSB\leftarrow\joinrel\relbar} +\def\Longleftarrow{\DOTSB\Leftarrow\joinrel\Relbar} +\def\longleftrightarrow{\DOTSB\leftarrow\joinrel\rightarrow} +\def\Longleftrightarrow{\DOTSB\Leftarrow\joinrel\Rightarrow} +\def\mapsto{\DOTSB\mapstochar\rightarrow} +\def\longmapsto{\DOTSB\mapstochar\longrightarrow} +\def\hookrightarrow{\DOTSB\lhook\joinrel\rightarrow} +\def\hookleftarrow{\DOTSB\leftarrow\joinrel\rhook} +\def\doteq{\DOTSB\buildrel\textstyle.\over=} +\def\iff{\DOTSB\;\Longleftrightarrow\;} +\begingroup \catcode`\"=12 +\mathchardef\@tempa="7000 +\ifx\@tempa\Gamma + \DeclareMathSymbol{\Gamma}{\mathord}{operators}{"00} + \DeclareMathSymbol{\Delta}{\mathord}{operators}{"01} + \DeclareMathSymbol{\Theta}{\mathord}{operators}{"02} + \DeclareMathSymbol{\Lambda}{\mathord}{operators}{"03} + \DeclareMathSymbol{\Xi}{\mathord}{operators}{"04} + \DeclareMathSymbol{\Pi}{\mathord}{operators}{"05} + \DeclareMathSymbol{\Sigma}{\mathord}{operators}{"06} + \DeclareMathSymbol{\Upsilon}{\mathord}{operators}{"07} + \DeclareMathSymbol{\Phi}{\mathord}{operators}{"08} + \DeclareMathSymbol{\Psi}{\mathord}{operators}{"09} + \DeclareMathSymbol{\Omega}{\mathord}{operators}{"0A} + \DeclareMathSymbol{\varGamma}{\mathord}{letters}{"00} + \DeclareMathSymbol{\varDelta}{\mathord}{letters}{"01} + \DeclareMathSymbol{\varTheta}{\mathord}{letters}{"02} + \DeclareMathSymbol{\varLambda}{\mathord}{letters}{"03} + \DeclareMathSymbol{\varXi}{\mathord}{letters}{"04} + \DeclareMathSymbol{\varPi}{\mathord}{letters}{"05} + \DeclareMathSymbol{\varSigma}{\mathord}{letters}{"06} + \DeclareMathSymbol{\varUpsilon}{\mathord}{letters}{"07} + \DeclareMathSymbol{\varPhi}{\mathord}{letters}{"08} + \DeclareMathSymbol{\varPsi}{\mathord}{letters}{"09} + \DeclareMathSymbol{\varOmega}{\mathord}{letters}{"0A} +\fi +\endgroup +\def\accentclass@{7} +\def\noaccents@{\def\accentclass@{0}} +\DeclareFontEncoding{OML}{}{\noaccents@} +\DeclareFontEncoding{OMS}{}{\noaccents@} +\edef\@tempa#1#2{\def#1{\mathaccent\string"\noexpand\accentclass@#2 }} +\@tempa\hat{05E}\@tempa\check{014}\@tempa\tilde{07E}\@tempa\acute{013} +\@tempa\grave{012}\@tempa\dot{05F}\@tempa\ddot{07F}\@tempa\breve{015} +\@tempa\bar{016} +\newcount\skewcharcount@ +\newcount\familycount@ +\def\theskewchar@{\familycount@\@ne + \global\skewcharcount@\the\skewchar\textfont\@ne + \ifnum\mathgroup>\m@ne\ifnum\mathgroup<16 + \global\familycount@\the\mathgroup\relax + \global\skewcharcount@\the\skewchar\textfont\the\mathgroup\relax\fi\fi + \ifnum\skewcharcount@>\m@ne + \ifnum\skewcharcount@<128 + \multiply\familycount@256 + \global\advance\skewcharcount@\familycount@ + \global\advance\skewcharcount@28672 + \mathchar\skewcharcount@\else + \global\skewcharcount@\m@ne\fi\else + \global\skewcharcount@\m@ne\fi} +\newcount\pointcount@ +\def\getpoints@#1.#2\getpoints@{\pointcount@#1 } +\newdimen\accentdimen@ +\newcount\accentmu@ +\def\dimentomu@{\multiply\accentdimen@ 100 + \expandafter\getpoints@\the\accentdimen@\getpoints@ + \multiply\pointcount@18 + \divide\pointcount@\@m + \global\accentmu@\pointcount@} +\def\mathaccent@#1#2{\ifnum\mathgroup=\m@ne\xdef\thefam@{1}\else + \xdef\thefam@{\the\mathgroup}\fi + \accentdimen@\z@ + \setboxz@h{\unbracefonts@$\m@th\mathgroup\thefam@\relax#2$}% + \ifdim\accentdimen@=\z@\DN@{\mathaccent#1{#2}}% + \setbox\@ne\hbox{\unbracefonts@ + $\m@th\mathgroup\thefam@\relax#2\theskewchar@$} + \setbox\tw@\hbox{$\m@th\ifnum\skewcharcount@=\m@ne\else + \mathchar\skewcharcount@\fi$}% + \global\accentdimen@\wd\@ne\global\advance\accentdimen@-\wdz@ + \global\advance\accentdimen@-\wd\tw@ + \global\multiply\accentdimen@\tw@ + \dimentomu@\global\advance\accentmu@\@ne + \else\DN@{{\mathaccent#1{#2\mkern\accentmu@ mu}% + \mkern-\accentmu@ mu}{}}\fi + \next@} +\def\unbracefonts@{\let\math@bgroup\@empty\let\math@egroup\@empty} +\begingroup \catcode`\"=12 +\def\@tempa#1#2{\gdef#1{\RIfM@\DN@{\mathaccent@{"\accentclass@#2 }}% + \else\DN@{\nonmatherr@{#1}}\fi\next@}} +\@tempa\Hat{05E}\@tempa\Check{014}\@tempa\Tilde{07E}\@tempa\Acute{013} +\@tempa\Grave{012}\@tempa\Dot{05F}\@tempa\Ddot{07F}\@tempa\Breve{015} +\@tempa\Bar{016} +\gdef\Vec{\RIfM@\DN@{\mathaccent@{"017E }}\else + \DN@{\nonmatherr@\Vec}\fi\next@} +\endgroup +\begingroup \catcode`\"=12 +\gdef\@@sqrt#1{\radical"270370 {#1}} +\endgroup +\@saveprimitive\overline\@@overline +\def\overline#1{\@@overline{#1}} +\def\boxed#1{\fbox{\m@th$\displaystyle#1$}} +\def\setb@ck{\iffirstchoice@\global\advance\c@equation\m@ne\fi} +\newcount\dspbrk@lvl +\dspbrk@lvl=-1 +\interdisplaylinepenalty\@M +\def\allowdisplaybreaks{% + \new@ifnextchar[\allowdspbrks@{\allowdspbrks@[4]}} +\def\allowdspbrks@[#1]{% + \interdisplaylinepenalty\getdsp@pen{#1}} +\def\getdsp@pen#1{% + \ifcase #1\relax \@M + \or 9999 + \or 6999 + \or 2999 + \or \z@\fi} +\def\displaybreak{\PackageError{amstex}{\Invalid@@\displaybreak}\@eha} +\def\displaybreak@{% + \def\displaybreak{\new@ifnextchar[\dspbrk@{\dspbrk@[4]}}} +\def\dspbrk@[#1]{\global\dspbrk@lvl #1\relax} +\def\math@cr{{\ifnum0=`}\fi + \new@ifstar{\global\@eqpen\@M\math@cr@}% + {\global\@eqpen + \ifnum\dspbrk@lvl <\z@ \interdisplaylinepenalty + \else -\@getpen\dspbrk@lvl \fi + \math@cr@}} +\def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}} +\def\math@cr@@[#1]{\ifnum0=`{\fi}\math@cr@@@ + \noalign{\vskip#1\relax}} +\def\Let@{\let\\\math@cr} +\def\restore@math@cr{\def\math@cr@@@{\cr}} +\restore@math@cr +\def\intertext{\PackageError{amstex}{\Invalid@@\intertext}\@eha} +\def\intertext@{\def\intertext##1{\noalign{% + \penalty\postdisplaypenalty\vskip\belowdisplayskip + \vbox{\normalbaselines\noindent##1}% + \penalty\predisplaypenalty\vskip\abovedisplayskip}}} +\newhelp\tag@help + {tag cannot be used at this point.\space + If you don't understand why^^Jyou should consult + the documentation.^^JBut don't worry: just continue, and I'll + forget what happened.} +\def\gobble@tag{\new@ifstar\@gobble\@gobble} +\def\invalid@tag#1{\PackageError{amstex}{#1}{\the\tag@help}\gobble@tag} +\def\dft@tag{\invalid@tag{\string\tag\space not allowed here}} +\def\default@tag{\let\tag\dft@tag} +\default@tag +\def\maketag@@{\new@ifstar\maketag@@@\tagform@} +\def\maketag@@@#1{\hbox{\m@th\normalfont#1}} +\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip)}} +\def\thetag{\leavevmode\tagform@} +\def\make@df@tag{\new@ifstar\make@df@tag@@\make@df@tag@@@} +\def\make@df@tag@@#1{% + \def\@currentlabel{#1}% + \gdef\df@tag{\maketag@@@{#1}}} +\def\make@df@tag@@@#1{\@seteqlabel{#1}\gdef\df@tag{\tagform@{#1}}} +\def\@seteqlabel#1{\toks@\@xp{\p@equation{#1}}% + \edef\@currentlabel{\the\toks@}} +\def\notag{\nonumber} +\iftagsleft@ +\def\@eqnnum{\hbox to1sp{}\rlap{\normalfont + \hskip -\displaywidth\tagform@\theequation}} +\fi + +\let\@adjusttag\@empty + +\def\adjusttag#1{\skip@#1\relax\gdef\@adjusttag{#1}} + +\def\@movetag{% + \ifx\@adjusttag\@empty \else + \vskip\@adjusttag\relax + \global\let\@adjusttag\@empty + \fi +} +\def\multilimits@{\bgroup + \Let@ + \restore@math@cr + \default@tag + \baselineskip\fontdimen10 \scriptfont\tw@ + \advance\baselineskip\fontdimen12 \scriptfont\tw@ + \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ + \lineskiplimit\lineskip + \vbox\bgroup\ialign\bgroup\hfil$\m@th\scriptstyle{##}$\hfil\crcr} +\def\Sb{_\multilimits@} +\def\Sp{^\multilimits@} +\def\endSb{\crcr\egroup\egroup\egroup} +\let\endSp=\endSb +\def\smallmatrix{\null\,\vcenter\bgroup + \Let@\restore@math@cr\default@tag + \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip + \ialign\bgroup\hfil$\m@th\scriptstyle{##}$\hfil&&\thickspace\hfil + $\m@th\scriptstyle{##}$\hfil\crcr} +\def\endsmallmatrix{\crcr\egroup\egroup\,} +\newcount\c@MaxMatrixCols +\c@MaxMatrixCols=10 + +\def\matrix{\hskip -\arraycolsep\array{*\c@MaxMatrixCols c}} +\def\endmatrix{\endarray \hskip -\arraycolsep} +\@ifundefined{prepnext@tok}{% + \def\@array[#1]#2{% + \setbox\@arstrutbox\hbox{\vrule\@height\arraystretch\ht\strutbox + \@depth\arraystretch\dp\strutbox \@width\z@}% + \@mkpream{#2}\edef\@preamble{\ialign \noexpand\@halignto + \bgroup \tabskip\z@ \@arstrut \@preamble \tabskip\z@ \cr}% + \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox + \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi + \bgroup \let\par\@empty + \let\@sharp##\let\protect\relax + \lineskip\z@\baselineskip\z@\@preamble}% +\begingroup \lccode`\~=`\@ \catcode`\~=\active % just to be sure! +\lowercase{% +\gdef\@xexpast#1*#2#3#4\@@{\begingroup + \def~{@}\edef\reserved@a{#1}\@tempcnta#2\relax + \ifnum\@tempcnta >\z@ + \@whilenum\@tempcnta >\z@\do + {\edef\reserved@a{\reserved@a#3}\advance\@tempcnta \m@ne}% + \let\reserved@b\@xexpast + \else \let\reserved@b\@xexnoop\fi + \expandafter\reserved@b \reserved@a #4\@@ + \expandafter\endgroup + \expandafter\def\expandafter\reserved@a\expandafter{\reserved@a}% + \let\@tempa\reserved@a +}% End of \@xexpast +}% End of \lowercase +\endgroup +}{}% End of \@ifundefined test. +\def\pmatrix{\left(\matrix} +\def\endpmatrix{\endmatrix\right)} +\def\bmatrix{\left[\matrix} +\def\endbmatrix{\endmatrix\right]} +\def\vmatrix{\left|\matrix} +\def\endvmatrix{\endmatrix\right|} +\def\Vmatrix{\left\|\matrix} +\def\endVmatrix{\endmatrix\right\|} +\let\hdots\@ldots +\def\hdotsfor#1{\if\noexpand#1[\expandafter\shdots@for\else + \hdots@for\@ne{#1}\fi} +\newmuskip\dotsspace@ +\def\shdots@for#1]{\hdots@for{#1}} +\def\hdots@for#1#2{\multicolumn{#2}c% + {\m@th\dotsspace@1.5mu\mkern-#1\dotsspace@ + \xleaders\hbox{$\m@th\mkern#1\dotsspace@.\mkern#1\dotsspace@$}% + \hfill + \mkern-#1\dotsspace@}% + } +\def\cases{\left\{\def\arraystretch{1.2}\hskip-\arraycolsep + \array{l@{\quad}l}} +\def\endcases{\endarray\hskip-\arraycolsep\right.} +\newif\ifinany@ +\newif\ifinalign@ +\newif\ifingather@ +\newcount\and@ +\newif\iftag@ +\newhelp\andhelp@ +{An extra & here is so disastrous that you should probably exit^^J +and fix things up.} +\newif\ifst@rred +\newtoks\@envbody +\def\addto@envbody#1{\@envbody\expandafter{\the\@envbody#1}} +\def\collect@body#1{% + \@envbody{}% + \def\process@envbody{% + \expandafter#1\expandafter{\the\@envbody}}% + \expandafter\let\csname\@currenvir\endcsname\collect@@body + \csname\@currenvir\endcsname} +\def\collect@@body#1\end#2{% + \def\@tempa{#2}% + \ifx\@tempa\@currenvir + \addto@envbody{#1}% + \expandafter\edef\csname\@currenvir\endcsname + {\noexpand\process@envbody\noexpand\end{\@tempa}}% + \else + \addto@envbody{#1\end{#2}}% + \fi + \csname\@currenvir\endcsname} +\newenvironment{aligned}{% + \relax\ifmmode\else\nonmatherr@{\begin{aligned}}\fi + \null\,\new@ifnextchar[{\aligned@}{\aligned@[c]}% +}{% + \crcr\egroup\egroup +} +\def\aligned@[#1]{% + \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi + \bgroup + \Let@\restore@math@cr + \default@tag + \ifinany@\else\openup\jot\fi + \ialign\bgroup\hfil\strut@$\m@th\displaystyle{##}$&% + $\m@th\displaystyle{{}##}$\hfil\crcr} +\newtoks\hashtoks@ +\hashtoks@{#} +\newcount\atcount@ +\def\doat@#1{\toks@{\hfil\strut@$\m@th + \displaystyle{\the\hashtoks@}$&$\m@th\displaystyle + {{}\the\hashtoks@}$\hfil}% + \atcount@#1\relax\advance\atcount@\m@ne + \loop\ifnum\atcount@>\z@\toks@\expandafter{\the\toks@&\hfil$\m@th + \displaystyle{\the\hashtoks@}$&$\m@th + \displaystyle{{}\the\hashtoks@}$\hfil}\advance + \atcount@\m@ne\repeat + \xdef\preamble@{\the\toks@}\xdef\preamble@@{\preamble@}} +\newenvironment{alignedat}[2][c]{% + \null\,% + \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi + \bgroup\doat@{#2}\Let@ \restore@math@cr\default@tag + \ifinany@\else\openup\jot\fi\ialign\bgroup\span\preamble@@\crcr +}{% + \endaligned +} +\newenvironment{gathered}[1][c]{% + \relax\ifmmode\else\nonmatherr@{\begin{gathered}}\fi + \null\,% + \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi + \bgroup\Let@\restore@math@cr + \ifinany@\else\openup\jot\fi\ialign + \bgroup\hfil\strut@$\m@th\displaystyle##$\hfil\crcr +}{% + \endaligned +} +\def\tag@in@align{\relax + \iftag@\DN@{\invalid@tag{Multiple \string\tag}}\else + \global\tag@true + \if@eqnsw\global\@eqnswfalse\fi + \let\next@\make@df@tag\fi + \next@} +\def\math@cr@@@align{% + \if@eqnsw\global\tag@true\fi + \iftag@ + \ifcase\and@ + \DN@{&&}\else + \DN@{&}\fi\else + \let\next@\relax\fi + \next@ + \relax + \if@eqnsw\tagform@\theequation\stepcounter{equation}\else + \iftag@\df@tag\fi\fi + \global\@eqnswtrue\cr} +\def\Tag@{\relax\iftag@\else\firstchoice@true + \PackageError{amstex}{% + Extra & on this line% + }{\the\andhelp@% "An extra & here is disastrous" +}\fi} +\newdimen\lwidth@ +\newdimen\rwidth@ +\newdimen\maxlwidth@ +\newdimen\maxrwidth@ +\newdimen\totwidth@ +\def\measure@#1{\lwidth@\z@\rwidth@\z@\maxlwidth@\z@\maxrwidth@\z@ + \global\and@\z@ + \setbox\@ne\vbox{% + \everycr{\noalign{\global\tag@false\global\and@\z@}}\Let@ + \let\tag\gobble@tag + \let\notag\@empty \let\nonumber\@empty + \firstchoice@false + \halign{\setboxz@h{$\m@th\displaystyle{\@lign##}$}% + \global\lwidth@\wdz@ + \ifdim\lwidth@>\maxlwidth@\global\maxlwidth@\lwidth@\fi + \global\advance\and@\@ne + &\setboxz@h{$\m@th\displaystyle{{}\@lign##}$}% + \global\rwidth@\wdz@ + \ifdim\rwidth@>\maxrwidth@\global\maxrwidth@\rwidth@\fi + \global\advance\and@\@ne + &\Tag@\@gobble{##}\crcr#1\crcr}}% + \totwidth@\maxlwidth@\advance\totwidth@\maxrwidth@} +\def\displ@y{\global\dt@ptrue\openup\jot\m@th + \everycr{\noalign{\ifdt@p \global\dt@pfalse + \vskip-\lineskiplimit \vskip\normallineskiplimit + \else \penalty\@eqpen \fi}}} +\def\displ@y@{\global\dt@ptrue\openup\jot + \everycr{\noalign{\global\tag@false + \global\and@\z@ + \global\dspbrk@lvl\m@ne + \ifdt@p\global\dt@pfalse + \vskip-\lineskiplimit\vskip\normallineskiplimit\else + \penalty\@eqpen\fi}}} +\def\black@#1{\noalign{\ifdim#1>\displaywidth + \dimen@\prevdepth\nointerlineskip + \vskip-\ht\strutbox@\vskip-\dp\strutbox@ + \vbox{\noindent\hbox to#1{\strut@\hfill}}% + \prevdepth\dimen@ + \fi}} +\def\align{\ifingather@ + {\ifnum0=`}\fi + \DN@{\@nameuse{align (in \string\gather)}}% + \else \ifmmode\nomath@env + \DN@{\let\endalign\relax\@gobble}\else + $$\stepcounter{equation}% + \st@rredfalse\let\next@\align@\fi\fi + \collect@body\next@} +\@namedef{align*}{\ifingather@ + {\ifnum0=`}\fi + \DN@{\@nameuse{align* (in \string\gather)}}\else + \ifmmode\nomath@env + \DN@{\@namedef{endalign*}{}\@gobble}\else + $$\st@rredtrue + \let\next@\align@\fi\fi + \collect@body\next@} +\newdimen\lineht@ +\def\align@{\inalign@true\inany@true + \displaybreak@\intertext@ + \let\math@cr@@@\math@cr@@@align + \let\tag\tag@in@align + \global\and@\z@\global\dspbrk@lvl\m@ne + \iftagsleft@\DN@{\@nameuse{align }}\else + \DN@{\@nameuse{align \space}}\fi\next@} +\@namedef{align }#1{% + \measure@{#1}% + \global\and@\z@ + \global\dspbrk@lvl\m@ne + \if@fleqn %%*F + \advance\totwidth@\@mathmargin %%*F + \fi %%*F + \ifdim\totwidth@>\displaywidth + \let\displaywidth@\totwidth@ + \else + \let\displaywidth@\displaywidth + \fi + \ifingather@ + \everycr{% + \noalign{% + \global\and@\z@ + \global\dspbrk@lvl\m@ne + }% + }% + \else + \displ@y@ + \fi + \Let@ + \ifst@rred\else\@seteqlabel\theequation\fi + \tabskip\@mathmargin %%*F + \dimen@\displaywidth %%*F + \if@fleqn %%*F + \ifingather@ %%*F + \tabskip\z@skip %%*F + \advance\dimen@-\@mathmargin %%*F + \fi %%*F + \fi %%*F + \halign to\dimen@\bgroup %%*F + \ifst@rred\nonumber\fi + \hfil + \strut@ + \setboxz@h{\global\tag@false$\m@th\displaystyle{\@lign##}$}% + \global\lwidth@\wdz@ + \global\lineht@\ht\z@ + \boxz@ + \global\advance\and@\@ne + \tabskip\z@skip + &\setboxz@h{$\m@th\displaystyle{{}\@lign##}$}% + \global\rwidth@\wdz@ + \ifdim\ht\z@>\lineht@ + \global\lineht@\ht\z@ + \fi + \boxz@ + \hfil + \global\advance\and@\@ne + \tabskip\@centering + &\kern-\displaywidth@ + \setboxz@h{\@lign\strut@{##}}% + \if@fleqn %%*F + \dimen@\@mathmargin %%*F + \advance\dimen@\maxlwidth@ %%*F + \advance\dimen@-\lwidth@ %%*F + \else %%*F + \dimen@\displaywidth + \advance\dimen@-\totwidth@ + \divide\dimen@\tw@ + \advance\dimen@\maxlwidth@ + \advance\dimen@-\lwidth@ + \fi %%*F + \ifdim\dimen@<\tw@\wdz@ + \rlap{\vbox{\normalbaselines\boxz@\vbox to\lineht@{}}}% + \else + \rlap{\boxz@}% + \fi + \tabskip\displaywidth@ + \crcr + #1% +} +\@namedef{align \space}#1{% + \measure@{#1}% + \if@fleqn %%*F + \advance\totwidth@\@mathmargin %%*F + \fi %%*F + \global\and@\z@ + \global\dspbrk@lvl\m@ne + \ifingather@ + \everycr{\noalign{\global\and@\z@\global\dspbrk@lvl\m@ne}}% + \else + \displ@y@ + \fi + \Let@ + \ifst@rred\else\@seteqlabel\theequation\fi + \tabskip\@mathmargin %%*F + \dimen@\displaywidth %%*F + \if@fleqn %%* + \ifingather@ %%*F + \tabskip\z@skip %%*F + \advance\dimen@-\@mathmargin %%*F + \fi %%*F + \fi %%*F + \halign to\dimen@\bgroup %%*F + \ifst@rred\nonumber\fi + \hfil + \strut@ + \setboxz@h{\global\tag@false$\m@th\displaystyle{\@lign##}$}% + \global\lwidth@\wdz@\boxz@ + \global\advance\and@\@ne + \tabskip\z@skip + &\setboxz@h{$\m@th\displaystyle{{}\@lign##}$}% + \global\rwidth@\wdz@ + \boxz@ + \hfill + \global\advance\and@\@ne + \tabskip\@centering + &\setboxz@h{\@lign\strut@{##}}% + \dimen@\displaywidth + \advance\dimen@-\totwidth@ + \divide\dimen@\tw@ + \advance\dimen@\maxrwidth@ + \advance\dimen@-\rwidth@ + \ifdim\dimen@<\tw@\wdz@ + \llap{\vtop{\@movetag\normalbaselines\null\boxz@}}%%*T + \else + \llap{\boxz@}% + \fi + \tabskip\z@skip + \crcr#1% +} +\def\endalign{\math@cr@@@align + \black@\totwidth@ + \egroup$$\global\@ignoretrue\setb@ck} + +\@namedef{endalign*}{\math@cr@@@align\black@\totwidth@ + \egroup$$\global\@ignoretrue} +\@namedef{align (in \string\gather)}{% + \ifst@rred\stepcounter{equation}\fi + \def\endalign{\@nameuse{endalign (in \string\gather)}\ifnum0=`{\fi}}% + \vcenter\bgroup\st@rredfalse + \collect@body\align@} +\@namedef{endalign (in \string\gather)}{% + \math@cr@@@align\black@\totwidth@ + \egroup\egroup + \ifst@rred\setb@ck\fi% this ifst@rred is set by the enclosing gather + \global\tag@false\global\@eqnswfalse} +\@namedef{align* (in \string\gather)}{% + \@namedef{endalign*}{\@nameuse{endalign* (in \string\gather)}% + \ifnum0=`{\fi}}% + \vcenter\bgroup\st@rredtrue + \collect@body\align@} +\@namedef{endalign* (in \string\gather)}{% + \math@cr@@@align\black@\totwidth@\egroup\egroup + \global\tag@false\global\@eqnswfalse} +\newif\ifxat@ +\def\alignat#1{% + \ifmmode\nomath@env\DN@{\let\endalignat\relax\@gobble}\else$$% + \st@rredfalse\stepcounter{equation}\@seteqlabel\theequation + \DN@{\@nameuse{alignat }#1}\fi + \collect@body\next@} +\@namedef{alignat*}#1{% + \ifmmode\nomath@env\DN@{\@namedef{endalignat*}{}\@gobble}\else$$% + \st@rredtrue + \DN@{\@nameuse{alignat }#1}\fi + \collect@body\next@} +\newif\ifmeasuring@ +\newbox\savealignat@ +\def\math@cr@@@alignat{% + \if@eqnsw\global\tag@true\fi + \iftag@ + \multiply\count@\tw@ + \xdef\next@{}\loop\ifnum\count@>\and@\xdef\next@{&\next@}% + \advance\count@\m@ne\repeat\else + \let\next@\relax\fi + \next@ + \relax + \if@eqnsw\tagform@\theequation\stepcounter{equation}\else + \iftag@\df@tag\fi\fi + \global\@eqnswtrue\cr}% +\@namedef{alignat }#1#2{% + \inany@true + \xat@false + \let\tag\tag@in@align + \def\math@cr@@@{\count@#1\relax \math@cr@@@alignat}% + \displaybreak@ + \intertext@ + \displ@y@ + \ifst@rred + \global\@eqnswfalse + \else + \global\@eqnswtrue + \fi + \measuring@true + \setbox\savealignat@\hbox{% + $\m@th\displaystyle\Let@ + \attag@{#1}% + \vbox{\firstchoice@false\halign{\span\preamble@@\crcr#2\crcr}}$% + }% + \measuring@false + \Let@ + \attag@{#1}% + \tabskip\@mathmargin %%*F + \halign to\displaywidth\bgroup + \span\preamble@@\crcr + #2% +} +\def\endalignat{\math@cr@@@\black@{\wd\savealignat@}% + \egroup\setb@ck$$\global\@ignoretrue} +\@namedef{endalignat*}{\math@cr@@@\black@{\wd\savealignat@}\egroup + $$\global\@ignoretrue} +\def\xalignat#1{% + \ifmmode\nomath@env\DN@{\let\endxalignat\relax\@gobble}\else$$% + \st@rredfalse\stepcounter{equation}\@seteqlabel\theequation + \DN@{\@nameuse{xalignat }#1}\fi + \collect@body\next@} +\@namedef{xalignat*}#1{% + \ifmmode\nomath@env\DN@{\@namedef{endxalignat*}{}\@gobble}\else$$% + \st@rredtrue + \DN@{\@nameuse{xalignat }#1}\fi + \collect@body\next@} +\let\endxalignat=\endalignat + +\expandafter\let\csname endxalignat*\expandafter + \endcsname\csname endalignat*\endcsname +\@namedef{xalignat }#1#2{% + \inany@true + \xat@true + \let\tag\tag@in@align + \def\math@cr@@@{\count@#1\relax\math@cr@@@alignat}% + \displaybreak@ + \intertext@ + \displ@y@ + \measuring@true + \setbox\savealignat@\hbox{% + $\m@th\displaystyle\Let@ + \attag@{#1}% + \vbox{% + \firstchoice@false + \halign{\span\preamble@@\crcr#2\crcr}% + }% + $% + }% + \measuring@false + \Let@ + \attag@{#1}% + \tabskip\@mathmargin %%*F + \halign to\displaywidth\bgroup + \span\preamble@@\crcr#2% +} +\def\attag@#1{% + \let\TAG@\Tag@\let\Tag@0% + \ifmeasuring@\def\llap@##1{\setboxz@h{##1}\hbox to\tw@\wdz@{}}% + \def\rlap@##1{\setboxz@h{##1}\hbox to\tw@\wdz@{}}\else + \let\llap@\llap\let\rlap@\rlap\fi + \toks@{\hfil\strut@$\m@th\displaystyle{\@lign\the\hashtoks@}$% + \tabskip\z@skip + \global\advance\and@\@ne + &$\m@th\displaystyle{{}\@lign\the\hashtoks@}$\hfil + \ifxat@\tabskip\@centering\fi\global\advance\and@\@ne}% + \iftagsleft@ + \@temptokena{\tabskip\@centering&\Tag@\kern-\displaywidth + \rlap@{\@lign + \the\hashtoks@ + }% + \global\advance\and@\@ne\tabskip\displaywidth}\else + \@temptokena{\tabskip\@centering&\Tag@\llap@{\@lign + \the\hashtoks@ + }\global\advance\and@\@ne\tabskip\z@skip}\fi + \atcount@#1\relax\advance\atcount@\m@ne + \loop\ifnum\atcount@>\z@ + \toks@\expandafter{\the\toks@&\hfil$\m@th\displaystyle{\@lign + \the\hashtoks@}$\global\advance\and@\@ne + \tabskip\z@skip + &$\m@th\displaystyle{{}\@lign\the\hashtoks@}$\hfil\ifxat@ + \tabskip\@centering\fi\global\advance\and@\@ne}\advance\atcount@\m@ne + \repeat + \xdef\preamble@{\the\toks@\the\@temptokena}% + \xdef\preamble@@{\ifst@rred\noexpand\nonumber\fi\preamble@}% + \let\Tag@\TAG@} +\def\xxalignat#1{% + \ifmmode\nomath@env\DN@{\let\endxxalignat\relax\@gobble}\else$$% + \DN@{\@nameuse{xxalignat }#1}\fi + \collect@body\next@} +\@namedef{xxalignat }#1#2{\inany@true + \displaybreak@\intertext@ + \displ@y\setbox\savealignat@\hbox{$\m@th\displaystyle\Let@ + \xxattag@{#1}% + \vbox{\firstchoice@false\halign{\span\preamble@@\crcr#2\crcr}}$}% + \Let@\xxattag@{#1}\tabskip\z@skip\halign to\displaywidth\bgroup + \span\preamble@@\crcr#2} +\expandafter\let\expandafter\endxxalignat\csname endxalignat*\endcsname +\def\xxattag@#1{\toks@{\tabskip\z@skip\hfil\strut@ + $\m@th\displaystyle{\the\hashtoks@}$&% + $\m@th\displaystyle{{}\the\hashtoks@}$\hfil\tabskip\@centering&}% + \atcount@#1\relax\advance\atcount@\m@ne\loop\ifnum\atcount@>\z@ + \toks@ + \expandafter + {\the\toks@&\hfil$\m@th\displaystyle{\the\hashtoks@}$% + \tabskip\z@skip&$\m@th\displaystyle{{}\the\hashtoks@}$\hfil + \tabskip\@centering}\advance\atcount@\m@ne\repeat + \xdef\preamble@{\the\toks@\tabskip\z@skip}\xdef\preamble@@{\preamble@}} +\newdimen\gwidth@ +\newdimen\gmaxwidth@ +\def\gmeasure@#1{\gwidth@\z@\gmaxwidth@\z@\setbox\@ne\vbox{\Let@ + \firstchoice@false\let\tag\gobble@tag + \halign{\setboxz@h{$\m@th\displaystyle{##}$}\global\gwidth@\wdz@ + \ifdim\gwidth@>\gmaxwidth@\global\gmaxwidth@\gwidth@\fi + &\@gobble{##}\crcr#1\crcr}}} +\def\math@cr@@@gather{% + \if@eqnsw\global\tag@true\fi + \iftag@ + \DN@{&\relax \if@eqnsw + \tagform@\theequation \stepcounter{equation}% + \else\iftag@\df@tag\fi\fi}% + \else + \expandafter\@gobble\fi + \next@ + \global\@eqnswtrue\cr} +\def\gather{% + \ifmmode\nomath@env\DN@{\let\endgather\relax\@gobble}\else $$% + \ingather@true\inany@true + \stepcounter{equation}% + \let\tag\tag@in@align\st@rredfalse + \displaybreak@\intertext@ + \displ@y + \Let@\@seteqlabel\theequation + \let\math@cr@@@\math@cr@@@gather + \iftagsleft@\DN@{\@nameuse{gather }}\else + \DN@{\@nameuse{gather \space}}\fi\fi + \collect@body\next@} +\@namedef{gather*}{% + \ifmmode\nomath@env\DN@{\@namedef{endgather*}{}\@gobble}\else $$% + \ingather@true\inany@true + \let\tag\tag@in@align\st@rredtrue + \displaybreak@\intertext@ + \displ@y\Let@ + \let\math@cr@@@\math@cr@@@gather + \iftagsleft@\DN@{\@nameuse{gather }}\else + \DN@{\@nameuse{gather \space}}\fi\fi + \collect@body\next@} +\newdimen\glineht@ +\@namedef{gather \space}#1{% + \gmeasure@{#1}% + \if@fleqn %%*F + \advance\gmaxwidth@\@mathmargin %%*F + \fi %%*F + \global\dt@ptrue + \tabskip\@mathmargin %%*F + \halign to\displaywidth\bgroup + \ifst@rred\nonumber\else\global\@eqnswtrue\fi + \if@fleqn\else\hfil\fi %%*F + \strut@ + \setboxz@h{\global\tag@false$\m@th\displaystyle{##}$}% + \global\gwidth@\wdz@\boxz@ + \hfil + \tabskip\@centering %%*F + &\setboxz@h{\strut@{##}}% + \dimen@\displaywidth + \advance\dimen@-\gwidth@ + \if@fleqn %%*F + \advance\dimen@-\@mathmargin %%*F + \else %%*F + \divide\dimen@\tw@ %%*B + \fi %%*F + \ifdim\dimen@<\tw@\wdz@ %%* + \llap{\vtop{\@movetag\normalbaselines\null\boxz@}}%%*T %%* + \else + \llap{\boxz@}% %%* + \fi + \tabskip\z@skip + \crcr + #1% +} +\def\endgather{\math@cr + \black@\gmaxwidth@\egroup $$\setb@ck\global\@ignoretrue} + +\@namedef{endgather*}{\math@cr + \black@\gmaxwidth@\egroup $$\global\@ignoretrue} +\@namedef{gather }#1{% + \gmeasure@{#1}% + \global\dt@ptrue + \if@fleqn %%*F + \advance\gmaxwidth@\@mathmargin %%*F + \fi %%*F + \ifdim\gmaxwidth@>\displaywidth + \let\gdisplaywidth@\gmaxwidth@ + \else + \let\gdisplaywidth@\displaywidth + \fi + \tabskip\@mathmargin %%*F + \halign to\displaywidth\bgroup + \ifst@rred\nonumber\else\global\@eqnswtrue\fi + \if@fleqn\else\hfil\fi %%*F + \strut@ + \setboxz@h{\global\tag@false$\m@th\displaystyle{##}$}% + \global\gwidth@\wdz@ + \global\glineht@\ht\z@ + \boxz@ + \hfil + \tabskip\@centering %%*F + &\kern-\gdisplaywidth@ + \setboxz@h{\strut@{##}}% + \if@fleqn %%*F + \dimen@\@mathmargin %%*F + \else %%*F + \dimen@\displaywidth + \advance\dimen@-\gwidth@ + \divide\dimen@\tw@ %%*B + \fi %%*F + \ifdim\dimen@<\tw@\wdz@ %%* + \rlap{\vbox{\normalbaselines\boxz@\vbox to\glineht@{}}}% %%* + \else + \rlap{\boxz@}% %%* + \fi + \tabskip\gdisplaywidth@ + \crcr + #1% +} +\def\split{% + \ifinany@\let\next@\insplit@\else + \DN@{\PackageError{amstex}{\string\begin{split} is not allowed + here. Try the `aligned' environment.}\@ehb}\fi + \next@} +\def\insplit@{\global\setbox\z@\vbox\bgroup + \Let@ \restore@math@cr \default@tag % disallow use of \tag here + \ialign\bgroup \hfil\strut@ + $\m@th\displaystyle{##}$&$\m@th\displaystyle{{}##}$\hfill\crcr} +\def\endsplit{\crcr\egroup\egroup + \iftagsleft@\expandafter\lendsplit@\else + \expandafter\rendsplit@\fi} +\def\rendsplit@{\global\setbox9 \vbox + {\unvcopy\z@\global\setbox8 \lastbox\unskip}% + \setbox\@ne\hbox{\unhcopy8 \unskip\global\setbox\tw@\lastbox + \unskip\global\setbox\thr@@\lastbox}% + \global\setbox7 \hbox{\unhbox\tw@\unskip}% + \ifinalign@\ifctagsplit@ + \gdef\split@{\hbox to\wd\thr@@{}& + \vcenter{\vbox{\moveleft\wd\thr@@\boxz@}}}% + \else\gdef\split@{&\vbox{\moveleft\wd\thr@@\box9}\crcr + \box\thr@@&\box7}\fi + \else + \ifctagsplit@\gdef\split@{\vcenter{\boxz@}}\else + \gdef\split@{\box9\crcr\hbox{\box\thr@@\box7}}\fi + \fi + \aftergroup\split@} +\def\lendsplit@{\global\setbox9\vtop{\unvcopy\z@}% + \setbox\@ne\vbox{\unvcopy\z@\global\setbox8\lastbox}% + \setbox\@ne\hbox{\unhcopy8\unskip\setbox\tw@\lastbox + \unskip\global\setbox\thr@@\lastbox}% + \ifinalign@\ifctagsplit@ + \gdef\split@{\hbox to\wd\thr@@{}& + \vcenter{\vbox{\moveleft\wd\thr@@\box9}}}% + \else + \gdef\split@{\hbox to\wd\thr@@{}&\vbox{\moveleft\wd\thr@@\box9}}\fi + \else + \ifctagsplit@\gdef\split@{\vcenter{\box9}}\else + \gdef\split@{\box9}\fi + \fi\aftergroup\split@} +\newdimen\multlinegap +\multlinegap10pt +\newdimen\multlinetaggap@ +\multlinetaggap@10pt +\def\multline{% + \ifmmode\nomath@env\DN@{\let\endmultline\relax\@gobble}% + \else $$\DN@{\collect@body\multline@}\fi + \st@rredfalse\@eqnswtrue \@seteqlabel\theequation + \stepcounter{equation}\next@} +\@namedef{multline*}{% + \ifmmode\nomath@env\DN@{\@namedef{endmultline*}{}\@gobble}% + \else $$\DN@{\collect@body\multline@}\fi + \st@rredtrue\@eqnswfalse \let\@currentlabel\@empty + \next@} +\def\multline@{\inany@true\displaybreak@ + \global\tag@false + \def\tag{\ifst@rred\else + \global\advance\c@equation\m@ne\fi\tag@in@align}% + \iftagsleft@ + \expandafter\lmultline@@\else + \expandafter\rmultline@@\fi} +\newdimen\mwidth@ +\def\rmmeasure@#1{% + \def\shoveleft##1{##1}\def\shoveright##1{##1}% + \setbox\@ne\vbox{\firstchoice@false\Let@\halign{\setboxz@h + {$\m@th\@lign\displaystyle{}##$}\global\mwidth@\wdz@ + \crcr#1\crcr}}} +\newdimen\mlineht@ +\newif\ifzerocr@ +\newif\ifonecr@ +\def\lmmeasure@#1{\global\zerocr@true\global\onecr@false + \everycr{\noalign{\ifonecr@\global\onecr@false\fi + \ifzerocr@\global\zerocr@false\global\onecr@true\fi}}% + \def\shoveleft##1{##1}\def\shoveright##1{##1}% + \setbox\@ne\vbox{\Let@\firstchoice@false\halign{\setboxz@h + {$\m@th\@lign\displaystyle{}##$}\ifonecr@\global\mwidth@\wdz@ + \global\mlineht@\ht\z@\fi\crcr#1\crcr}}} +\newbox\mtagbox@ +\newdimen\ltwidth@ +\newdimen\rtwidth@ +\def\lmultline@@#1{% + \lmmeasure@{#1}% + \setbox\mtagbox@\hbox{% + \iftag@ + \df@tag + \else + \if@eqnsw + \global\tag@true + \tagform@\theequation + \fi + \fi + }% + \dimen@\mwidth@ + \advance\dimen@\wd\mtagbox@ + \advance\dimen@\multlinetaggap@ + \if@fleqn %%*F + \advance\dimen@\@mathmargin %%*F + \fi %%*F + \ifdim\dimen@>\displaywidth + \ltwidth@\z@ + \else + \ltwidth@\wd\mtagbox@ + \fi + \lmultline@@@#1 +} +\def\lmultline@@@{% + \displ@y + \def\shoveright##1{##1\hfilneg\hskip\multlinegap}% + \if@fleqn %%*F + \def\shoveleft##1{##1}% %%*F + \else %%*F + \def\shoveleft##1{% + \setboxz@h{$\m@th\displaystyle{}##1$}% + \setbox\@ne\hbox{$\m@th\displaystyle##1$}% + \hfilneg + \iftag@ + \ifdim\ltwidth@>\z@ + \hskip\ltwidth@ + \hskip\multlinetaggap@ + \fi + \else + \hskip\multlinegap + \fi + \hskip.5\wd\@ne + \hskip-.5\wdz@##1% + }% + \fi %%*F + \if@fleqn %%*F + \tabskip\@mathmargin %%*F + \else %%*F + \tabskip\z@skip %%* + \fi %%*F + \totwidth@\displaywidth %%*F + \if@fleqn %%*F + \advance\totwidth@-\@mathmargin %%*F + \fi %%*F + \halign\bgroup + \Let@ + \let\tag\gobble@tag + \hbox to\totwidth@{% %%*F + \strut@$\m@th\displaystyle + \if@fleqn %%*F + \hskip 0pt plus 1000pt %%*F + \else %%*F + \hfil + \fi %%*F + {}##\hfil$% + }% + \crcr + \if@fleqn %%*F + \hskip-\@mathmargin %%*F + \else %%*F + \hfilneg + \fi %%*F + \iftag@ + \ifdim\ltwidth@>\z@ + \box\mtagbox@ + \hskip\multlinetaggap@ + \else + \rlap{% + \vbox{% + \normalbaselines + \hbox{\strut@\box\mtagbox@}% + \vbox to\mlineht@{}% + }% + }% + \hskip\multlinegap %%* + \fi + \else + \hskip\multlinegap + \fi +} +\def\rmultline@@#1{% + \rmmeasure@{#1}% + \setbox\mtagbox@\hbox{% + \iftag@ + \df@tag + \else + \if@eqnsw + \global\tag@true + \tagform@\theequation + \fi + \fi + }% + \dimen@\mwidth@ + \advance\dimen@\wd\mtagbox@ + \advance\dimen@\multlinetaggap@ + \if@fleqn %%*F + \advance\dimen@\@mathmargin %%*F + \fi %%*F + \ifdim\dimen@>\displaywidth + \rtwidth@\z@ + \else + \rtwidth@\wd\mtagbox@ + \fi + \rmultline@@@#1 +} +\def\rmultline@@@{% + \displ@y + \def\shoveright##1{% + ##1% + \hfilneg + \iftag@ + \ifdim\rtwidth@>\z@ + \hskip\rtwidth@ + \hskip\multlinetaggap@ + \fi + \else + \hskip\multlinegap + \fi + }% + \if@fleqn %%*F + \def\shoveleft##1{##1}% %%*F + \else %%*F + \def\shoveleft##1{% + \setboxz@h{$\m@th\displaystyle{}##1$}% + \setbox\@ne\hbox{$\m@th\displaystyle##1$}% + \hfilneg + \hskip\multlinegap + \hskip.5\wd\@ne + \hskip-.5\wdz@ + ##1% + }% + \fi %%*F + \if@fleqn %%*F + \tabskip\@mathmargin %%*F + \else %%*F + \tabskip\z@skip %%* + \fi %%*F + \totwidth@\displaywidth %%*F + \if@fleqn %%*F + \advance\totwidth@-\@mathmargin %%*F + \fi %%*F + \halign\bgroup + \Let@ + \let\tag\gobble@tag + \hbox to\totwidth@{% + \strut@$\m@th\displaystyle + \if@fleqn %%*F + \hskip 0pt plus 1000pt %%*F + \else %%*F + \hfil + \fi %%*F + {}##\hfil$% + }% + \crcr + \if@fleqn %%*F + \hskip-\@mathmargin %%*F + \else %%*F + \hfilneg + \fi %%*F + \hskip\multlinegap +} +\def\endmultline{\iftagsleft@\expandafter\lendmultline@\else + \expandafter\rendmultline@\fi\global\@ignoretrue} +\expandafter\let\csname endmultline*\endcsname=\endmultline +\def\lendmultline@{\hfilneg\hskip\multlinegap\crcr\egroup$$} +\def\rendmultline@{% + \iftag@ + \ifdim\rtwidth@>\z@ + \hskip\multlinetaggap@ + \box\mtagbox@ + \else + \hskip\multlinegap %%* + \llap{% + \vtop{% + \@movetag %%*T + \normalbaselines\null\hbox{\strut@\box\mtagbox@}% + }% + }% + \fi + \else + \hskip\multlinegap + \fi + \hfilneg + \crcr + \egroup$$% +} +\expandafter\def + \expandafter\@arrayparboxrestore + \expandafter{\@arrayparboxrestore + \inany@false\ingather@false\inalign@false + \default@tag} +\def\equation{\gather\def\\{\PackageError{amstex}{\Invalid@@\\}\@eha}} +\def\endequation{\endgather} +\newenvironment{equation*}{% + \equation +}{% + \nonumber\endequation +} +\newcounter{parentequation}% Counter for ``parent equation''. +\newenvironment{subequations}{% + \refstepcounter{equation}% + \begingroup % conservative approach + \let\protect\@nx + \edef\@tempa{\def\@nx\theparentequation{\theequation}}% + \@xp\endgroup\@tempa + \setcounter{parentequation}{\value{equation}}% + \setcounter{equation}{0}% + \def\theequation{\theparentequation\alph{equation}}% + \ignorespaces +}{% + \setcounter{equation}{\value{parentequation}}% + \global\@ignoretrue +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\atdef@#1{\expandafter\def\csname\space @\string#1\endcsname} +\begingroup \catcode`\@=\active +\gdef @{\Iat} +\endgroup +\DeclareRobustCommand{\Iat}{\FN@\at@} +\def\at@{\let\next@\at@@ + \ifcat\noexpand\@let@token a\else + \ifcat\noexpand\@let@token0\else + \ifcat\noexpand\@let@token\relax\else + \let\@let@token@\at@@@\fi\fi\fi\next@} +\def\at@@#1{\expandafter + \@ifundefined{ @\string#1}% + {\DN@{\at@@@#1}}% + {\DN@{\csname\space @\string#1\endcsname}}% + \next@}% +\def\at@@@{\PackageError{amstex}{\Invalid@@ @}% + {\the\athelp@}% "I'll assume you wanted @@" + \char64\relax} +\newhelp\athelp@ +{Only certain combinations beginning with @ make sense to me.^^J% +I'll assume you wanted @@ for a printed @.} +\atdef@ @{{\atchar}}% to define @@ +\chardef\atchar=64 +\def\makeatother{\catcode64=\active} +\def\@tempa#1#2#3#4#5#6{% + {#1}{#2}\ifnum0#6=0{13}\@xp\@gobblefour + \else{#3}\fi\@tempa{#4}{#5}{#6}}% +\xdef\@currnamestack{\@xp\@tempa\@currnamestack{}{}{0}} +{\def\@makeother{\noexpand\@makeother\noexpand} +\xdef\@sanitize{\@sanitize\@makeother\@}} +{\def\do{\noexpand\do\noexpand} +\xdef\dospecials{\dospecials\do\@}} +\atdef@,{\ifmmode\mskip.1\thinmuskip\else \nonmatherr@{@,}\fi} +\atdef@!{\RIfM@\mskip-.1\thinmuskip\else \nonmatherr@{@!}\fi} + +\@ifpackageloaded{amscd}{% +}{% +\atdef@>#1>#2>{% + \global\bigaw@\minaw@ + \setboxz@h{$\m@th\scriptstyle\;{#1}\;\;$}% + \ifdim\wdz@>\bigaw@ \global\bigaw@\wdz@ \fi + \@ifnotempty{#2}{\setbox\@ne\hbox{$\m@th\scriptstyle\;{#2}\;\;$}% + \ifdim\wd\@ne>\bigaw@ \global\bigaw@\wd\@ne \fi}% + \mathrel{\mathop{\hbox to\bigaw@{\rightarrowfill@\displaystyle}}% + \limits^{#1}\@ifnotempty{#2}{_{#2}}}% +}% end of @>>> +\atdef@<#1<#2<{% + \global\bigaw@\minaw@ + \setboxz@h{$\m@th\scriptstyle\;\;{#1}\;$}% + \ifdim\wdz@>\bigaw@ \global\bigaw@\wdz@ \fi + \@ifnotempty{#2}{\setbox\@ne\hbox{$\m@th\scriptstyle\;\;{#2}\;$}% + \ifdim\wd\@ne>\bigaw@ \global\bigaw@\wd\@ne \fi}% + \mathrel{\mathop{\hbox to\bigaw@{\leftarrowfill@\displaystyle}}% + \limits^{#1}\@ifnotempty{#2}{_{#2}}}% +}% end of @<<< +}% end of @ifpackageloaded +\@ifundefined{minaw@}{\newdimen\minaw@}{} +\minaw@11.111pt +\@ifundefined{bigaw@}{\newdimen\bigaw@}{} +\atdef@-{\let\next-%% + \DN@{\ifx\next-%% + \def\next-{\setbox\z@\hbox{-}\unhbox\z@\FN@\next@}%% + \expandafter\next \else\nobreak\fi}%% + \next@-}%% +\def\leftroot{\PackageError{amstex}{\Invalid@@\leftroot}\@eha} +\def\uproot{\PackageError{amstex}{\Invalid@@\uproot}\@eha} +\newcount\uproot@ +\newcount\leftroot@ +\def\root{\relaxnext@ + \DN@{\ifx\@let@token\uproot\let\next@\nextii@\else + \ifx\@let@token\leftroot\let\next@\nextiii@\else + \let\next@\plainroot@\fi\fi\next@}% + \def\nextii@\uproot##1{\uproot@##1\relax\FN@\nextiv@}% + \def\nextiv@{\ifx\@let@token\@sptoken\DN@. {\FN@\nextv@}\else + \DN@.{\FN@\nextv@}\fi\next@.}% + \def\nextv@{\ifx\@let@token\leftroot\let\next@\nextvi@\else + \let\next@\plainroot@\fi\next@}% + \def\nextvi@\leftroot##1{\leftroot@##1\relax\plainroot@}% + \def\nextiii@\leftroot##1{\leftroot@##1\relax\FN@\nextvii@}% + \def\nextvii@{\ifx\@let@token\@sptoken + \DN@. {\FN@\nextviii@}\else + \DN@.{\FN@\nextviii@}\fi\next@.}% + \def\nextviii@{\ifx\@let@token\uproot\let\next@\nextix@\else + \let\next@\plainroot@\fi\next@}% + \def\nextix@\uproot##1{\uproot@##1\relax\plainroot@}% + \bgroup\uproot@\z@\leftroot@\z@\FN@\next@} +\def\plainroot@#1\of#2{\setbox\rootbox\hbox{% + $\m@th\scriptscriptstyle{#1}$}% + \mathchoice{\r@@t\displaystyle{#2}}{\r@@t\textstyle{#2}} + {\r@@t\scriptstyle{#2}}{\r@@t\scriptscriptstyle{#2}}\egroup} +\def\r@@t#1#2{\setboxz@h{$\m@th#1\@@sqrt{#2}$}% + \dimen@\ht\z@\advance\dimen@-\dp\z@ + \setbox\@ne\hbox{$\m@th#1\mskip\uproot@ mu$}% + \advance\dimen@ by1.667\wd\@ne + \mkern-\leftroot@ mu\mkern5mu\raise.6\dimen@\copy\rootbox + \mkern-10mu\mkern\leftroot@ mu\boxz@} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Fragment from old amsfonts.sty to deal with msam, msbm, eufm fonts; +%% omit if `noamsfonts' option was specified. +\ifx F\@amsfonts \endinput \fi +\DeclareSymbolFont{AMSa}{U}{msa}{m}{n} +\DeclareSymbolFont{AMSb}{U}{msb}{m}{n} +\ifx P\@amsfonts + \DeclareFontFamily{U}{msa}{}% + \DeclareFontShape{U}{msa}{m}{n}{<-6>msam5<6-8>msam7<8->msam10}{}% + \DeclareFontFamily{U}{msb}{}% + \DeclareFontShape{U}{msb}{m}{n}{<-6>msbm5<6-8>msbm7<8->msbm10}{}% + \DeclareFontFamily{U}{euf}{}% + \DeclareFontShape{U}{euf}{m}{n}{<-6>eufm5<6-8>eufm7<8->eufm10}{}% + \DeclareFontShape{U}{euf}{b}{n}{<-6>eufb5<6-8>eufb7<8->eufb10}{}% +\fi +\@ifundefined{yen}{% + \edef\yen{\noexpand\mathhexbox{\hexnumber@\symAMSa}55} +}{} +\@ifundefined{checkmark}{% + \edef\checkmark{\noexpand\mathhexbox{\hexnumber@\symAMSa}58} +}{} +\@ifundefined{circledR}{% + \edef\circledR{\noexpand\mathhexbox{\hexnumber@\symAMSa}72} +}{} +\@ifundefined{maltese}{% + \edef\maltese{\noexpand\mathhexbox{\hexnumber@\symAMSa}7A} +}{} +\begingroup \catcode`\"=12 +\DeclareMathDelimiter\ulcorner{\mathopen} {AMSa}{"70}{AMSa}{"70} +\DeclareMathDelimiter\urcorner{\mathclose}{AMSa}{"71}{AMSa}{"71} +\DeclareMathDelimiter\llcorner{\mathopen} {AMSa}{"78}{AMSa}{"78} +\DeclareMathDelimiter\lrcorner{\mathclose}{AMSa}{"79}{AMSa}{"79} +\xdef\widehat#1{\noexpand\@mathmeasure\z@\textstyle{#1}% + \noexpand\ifdim\noexpand\wdz@>\tw@ em% + \mathaccent"0\hexnumber@\symAMSb 5B{#1}% + \noexpand\else\mathaccent"0362{#1}\noexpand\fi} +\xdef\widetilde#1{\noexpand\@mathmeasure\z@\textstyle{#1}% + \noexpand\ifdim\noexpand\wdz@>\tw@ em% + \mathaccent"0\hexnumber@\symAMSb 5D{#1}% + \noexpand\else\mathaccent"0365{#1}\noexpand\fi} +\DeclareMathSymbol\dabar@{\mathord}{AMSa}{"39} +\xdef\dashrightarrow{\mathrel{\dabar@\dabar@ + \mathchar"0\hexnumber@\symAMSa 4B}}% +\xdef\dashleftarrow{\mathrel{\mathchar"0\hexnumber@\symAMSa 4C\dabar@ + \dabar@}}% +\global\let\dasharrow\dashrightarrow +\global\let\rightleftharpoons\undefined +\DeclareMathSymbol\rightleftharpoons{\mathrel}{AMSa}{"0A} +\global\let\angle\undefined +\DeclareMathSymbol\angle {\mathord}{AMSa}{"5C} +\global\let\hbar\undefined +\DeclareMathSymbol\hbar {\mathord}{AMSb}{"7E} +\global\let\sqsubset\undefined +\DeclareMathSymbol\sqsubset {\mathrel}{AMSa}{"40} +\global\let\sqsupset\undefined +\DeclareMathSymbol\sqsupset {\mathrel}{AMSa}{"41} +\global\let\mho\undefined +\DeclareMathSymbol\mho {\mathord}{AMSb}{"66} +\DeclareMathSymbol\square {\mathord}{AMSa}{"03} +\DeclareMathSymbol\lozenge {\mathord}{AMSa}{"06} +\DeclareMathSymbol\vartriangleright {\mathrel}{AMSa}{"42} +\DeclareMathSymbol\vartriangleleft {\mathrel}{AMSa}{"43} +\DeclareMathSymbol\trianglerighteq {\mathrel}{AMSa}{"44} +\DeclareMathSymbol\trianglelefteq {\mathrel}{AMSa}{"45} +\DeclareMathSymbol\rightsquigarrow {\mathrel}{AMSa}{"20} +\def\@tempa{\not@base\lhd} +\ifx\lhd\@tempa + \global\let\lhd\vartriangleleft + \global\let\unlhd\trianglelefteq + \global\let\rhd\vartriangleright + \global\let\unrhd\trianglerighteq + \global\let\Box\square + \global\let\Diamond\lozenge + \global\let\leadsto\rightsquigarrow +\xdef\Join{\mathrel{\mathchar"0\hexnumber@\symAMSb 6F\mkern-13.8mu% + \mathchar"0\hexnumber@\symAMSb 6E}} +\fi +\endgroup +\DeclareMathAlphabet\mathfrak{U}{euf}{m}{n} +\SetMathAlphabet\mathfrak{bold}{U}{euf}{b}{n} +\DeclareSymbolFontAlphabet{\mathbb}{AMSb} +\DeclareFontEncodingDefaults{\relax}{\def\accentclass@{7}} +\def\frak{\mathfrak} +\def\Bbb{\mathbb} +\def\bold{\mathbf} +\begingroup \catcode`\"=12 \relax +\gdef\newsymbol#1#2#3#4#5{% + \@ifdefinable#1{% + \edef\next@ + {\ifcase #2 \or + \hexnumber@\symAMSa\or + \hexnumber@\symAMSb\fi}% + \ifx\next@\@empty + \PackageError{amsfonts}{\Invalid@@\newsymbol}\@ehd% + \else + \global\mathchardef#1"#3\next@#4#5 + \fi}} +\endgroup +%% Some odds and ends +\def\sphat{^{\mathchoice{}{}% + {\,\,\smash[b]{\hbox{\lower4\ex@\hbox{$\m@th\widehat{\null}$}}}}% + {\,\smash[b]{\hbox{\lower3\ex@\hbox{$\m@th\hat{\null}$}}}}}} +\def\spcheck{^\vee} +\def\sptilde{^\sim} +\def\spdot{^{\hbox{\raise\ex@\hbox{\normalfont .}}}} +\def\spddot{^{\hbox{\raise\ex@\hbox{\normalfont ..}}}} +\def\spdddot{^{\hbox{\raise\ex@\hbox{\normalfont...}}}} +\def\spbreve{^{\!\smash[b]{\hbox{\lower4\ex@\hbox{\u{}}}}}} +\def\fracwithdelims#1#2{\new@ifnextchar[{\fracwithdelims@#1#2}% + {\fracwithdelims@#1#2[\@empty]}} +\def\fracwithdelims@#1#2[#3]#4#5{\relax + \ifx\@empty#3{#4\overwithdelims#1#2#5}\else + {#4\abovewithdelims#1#2#3\relax#5}\fi} +\def\accentedsymbol#1#2{% + \expandafter\newbox + \csname\expandafter\@gobble\string#1@box\endcsname + \expandafter\setbox + \csname\expandafter\@gobble\string#1@box\endcsname + \hbox{$\m@th#2$}% + \newcommand{#1}{% + \expandafter\copy + \csname\expandafter\@gobble\string#1@box\endcsname{}}% +} +\def~{\nobreakspace} +\DeclareRobustCommand{\nobreakspace}{\unskip\nobreak\ \ignorespaces} +%% +%% End of file `amstex.sty'. diff --git a/macros/latex-dev/required/amsmath/amstext.dtx b/macros/latex-dev/required/amsmath/amstext.dtx new file mode 100644 index 0000000000..a4c9aeb5d9 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amstext.dtx @@ -0,0 +1,302 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +% \iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\usepackage{amstext} +\GetFileInfo{amstext.sty} +\begin{document} +\title{The \pkg{amstext} package} +\author{Frank Mittelbach \and Rainer Sch\"opf} +\date{Version \fileversion, \filedate} +\DocInput{amstext.dtx} +\end{document} +%</driver> +% \fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% +% This style file implements the \AmSTeX{} macro \cn{text} for use +% with the new font selection scheme. The \cn{text} macro is a +% sophisticated command which allows the user to insert ``normal text'' +% into math formulas without worrying about correct sizes in sub- or +% superscripts. It can also be used in ordinary text; there it +% produces an unbreakable unit similar to \cn{mbox}. +% +% Here is an example demonstrating some of its features: +% \[ +%^^A mathbin spacing is nonscript glue, disappears in superscript +% x^{2\,\times\,\text{size of $y$}} +% \leq +% z_{i_{\text{upper bound of the array}}} +% \] +% This was produced by +% \begin{verbatim} +% \[ +% x^{2\,\times\,\text{size of $y$}} +% \leq +% z_{i_{\text{upper bound of the array}}} +% \] +% \end{verbatim} +% +% Additionally this style file redefines an internal \fn{plain.tex} +% macro called \cs{mathhexbox} so that commands like \cn{dag} +% or \cn{P} will change sizes if used in math subscripts. +% +% \StopEventually{} +% Package information. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must be December 1994 or later +\ProvidesPackage{amstext}[2000/06/29 v2.01 AMS text] +% \end{macrocode} +% +% \section{The implementation} +% We need a few tools from \fn{amsgen.sty}. +% \begin{macrocode} +\RequirePackage{amsgen} +% \end{macrocode} +% +% \begin{macro}{\text} +% Now we come to the \cn{text} macro which is used to place +% ordinary text inside of math formulas. If it is used outside +% math it will produce an unbreakable unit of text. +% \begin{macrocode} +\DeclareRobustCommand{\text}{% + \ifmmode\expandafter\text@\else\expandafter\mbox\fi} +% \end{macrocode} +% At the present time (late 1994) the \latex/ internal function +% |\nfss@text| is used in |\ref|, in font commands like |\textbf|, +% and in a few text symbol definitions like |\$| and |\pounds|. By +% equating |\nfss@text| to |\text| we give it the ability of +% |\text| to change sizes properly if used in a subscript. +% \begin{macrocode} +\let\nfss@text\text +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\text@} +% If \cn{text} is encountered inside math mode the macro +% \cs{text@} is called. It has one mandatory argument, the text +% which should be produced. Since we do not know in which math +% style we are currently in we call \cs{mathchoice} to tyeset +% our text in all four possible styles. +% \begin{macrocode} +\def\text@#1{{\mathchoice +% \end{macrocode} +% To save token space we call a macro \cs{textdef@} which takes +% three arguments: the current math style, the corresponding size +% macro and the text to typeset possibly with some additional +% information for typesetting. +% \begin{macrocode} + {\textdef@\displaystyle\f@size{#1}}% +% \end{macrocode} +% The other three cases are similar except for the +% \cs{iffirstchoice} switch which we set to false. This is +% done to prevent \LaTeX{} macros like \cn{ref} or \cn{index} +% from writing their arguments more than once. +% \begin{macrocode} + {\textdef@\textstyle\f@size{\firstchoice@false #1}}% + {\textdef@\textstyle\sf@size{\firstchoice@false #1}}% + {\textdef@\textstyle \ssf@size{\firstchoice@false #1}}% +% \end{macrocode} +% Here we need to check whether a math size-change occurred inside +% the argument of \cn{text}. If so, restore +% \begin{macrocode} + \check@mathfonts + }% +} +% \end{macrocode} +% The macros \cs{f@size}, \cs{sf@size} and \cs{ssf@size} hold the +% sizes which should be used when we are loading a new font for use +% in \cs{textfont}, \cs{scriptfont} and \cs{scriptscriptfont}. There +% is some question whether we should use use \cs{tf@size} or +% \cs{f@size} for the main size, but since the primary purpose of the +% \cn{text} macro is to switch back to text within a display, it +% seems that \cs{f@size} is the better choice. (Indeed it could be +% said that the \cn{text} actually provides two different functions: +% one for escaping out of math mode in a display to print some words, +% and the other for handling math objects that are named by a +% fragment of text, when \cn{operatorname} isn't the right choice. +% For the latter \cs{tf@size} might be more correct but for the +% former \cs{f@size} is clearly better.) +% \end{macro} +% +% \begin{macro}{\textdef@} +% To typeset the argument of \cn{text} correctly we have to make +% several actions. We start by placing everything inside an +% \cs{hbox}. But this is not enough: we need one extra level of +% grouping. These extra braces are necessary because of the new +% font selection scheme which might produce an \cs{aftergroup} +% to globally restore some font values after the current group. To +% prevent any damage by this mechanism we add the braces thereby +% bringing the token inserted by \cs{aftergroup} inside the +% \cs{hbox}.\footnote{The mechanism will not produce a second +% \cs{aftergroup}. For more details see the technical documentation +% for NFSS2.} +% \begin{macrocode} +\def\textdef@#1#2#3{\hbox{{% +% \end{macrocode} +% Since text typeset inside an \cs{hbox} always stays in the size +% of the text surrounding the formula we have to adjust this for +% script and scriptscript sizes. For any math formula inside this +% argument this will be achieved by setting \cs{everymath} to +% the first argument of \cs{textdef@} since this argument +% contains the math size in the current typeset case of +% \cs{mathchoice}. +% Since \latex/ also knows about \cn{parbox}es and the +% \env{minipage} environment it might be neccessary to adjust +% \cs{everydisplay} too but this has to be tested further. +% \begin{macrocode} + \everymath{#1}% +% \end{macrocode} +% The next line of code changes locally (i.e.\ inside the current +% \cs{hbox}) the value of \cs{f@size}. This macro holds the +% size for typesetting ordinary text (e.g.\ loading or selecting a +% new font via \cs{selectfont}). By changing it to a smaller +% value a following \cs{selectfont} will switch to the wanted +% size. +% \begin{macrocode} + \let\f@size#2\selectfont +% \end{macrocode} +% Now we simply call the third argument and close all open groups. +% \begin{macrocode} + #3}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\iffirstchoice@} +% Here is the switch that we use to decide if \cn{ref} etc.\ +% should print its warnings. The default is true since +% normally these warnings shouldn't be suppressed. +% \begin{macrocode} +\newif\iffirstchoice@ +\firstchoice@true +% \end{macrocode} +% \end{macro} +% +% \subsection{Re-definition of \latex/ macros to work with \cn{text}} +% +% If a counter-changing command occurs inside the argument of +% \cn{text}, we don't want the counter to be changed four times +% because \cn{stepcounter} and \cn{addtocounter} have global effect. +% So we add the \cs{iffirstchoice@} test to make the counter +% operations execute only once. +% +% \begin{macro}{\stepcounter} +% Use \cs{def} rather than \cn{renewcommand*} because the star-form +% (for non-\cs{long} definitions) doesn't work with the June 1994 +% release of \latex/. +% \begin{macrocode} +\def\stepcounter#1{% + \iffirstchoice@ + \addtocounter{#1}\@ne + \begingroup \let\@elt\@stpelt \csname cl@#1\endcsname \endgroup + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\addtocounter} +% \begin{macrocode} +\def\addtocounter#1#2{% + \iffirstchoice@ + \@ifundefined {c@#1}{\@nocounterr {#1}}% + {\global \advance \csname c@#1\endcsname #2\relax}% + \fi} +% \end{macrocode} +% \end{macro} +% +% For \cn{ref}, \cn{pageref}, and indeed anything else that issues a +% warning or error, \cn{text} will produce four copies of the +% warning/error message. To suppress the last three copies, we change +% \cs{GenericInfo}, \cs{GenericWarning}, \cs{GenericError}. +% \begin{macrocode} +\let\m@gobble\@empty +\@xp\let\csname m@gobble4\endcsname\@gobblefour +\long\@xp\def\csname m@gobble6\endcsname#1#2#3#4#5#6{} +% \end{macrocode} +% +% \begin{macrocode} +\toks@{% + \csname m@gobble\iffirstchoice@\else 4\fi\endcsname + \protect} +\edef\GenericInfo{\the\toks@ + \@xp\@nx\csname GenericInfo \endcsname} +% +\edef\GenericWarning{\the\toks@ + \@xp\@nx\csname GenericWarning \endcsname} +% +\toks@{% + \csname m@gobble\iffirstchoice@\else 6\fi\endcsname + \protect} +\edef\GenericError{\the\toks@ + \@xp\@nx\csname GenericError \endcsname} +% \end{macrocode} +% +% At one time \cn{label}, \cs{@wrindex} and \cs{@wrglossary} were +% changed here too to use the \cs{iffirstchoice@} test but it seems +% that was a mistake because those are non-immediate writes. +% Something like +% \begin{verbatim} +% \text{something \index{foo}} +% \end{verbatim} +% within a math formula would therefore \emph{lose the index term} if +% the surrounding context was not displaystyle. (Unlikely in +% practice, but not impossible.) [mjd,1994/12/09] +% +%\subsection{Applications of \cn{text}} +% +% \begin{macro}{\mathhexbox} +% We start with an re-definition of the \fn{plain.tex} macro +% \cs{mathhexbox}. (Although M. Spivak in \amstex/ uses the name +% \cs{mathhexbox@} for this purpose, I [FMi] don't see any reason +% to use a new name since the new definition is superior, has the +% same syntax and is used for the same purpose.) +% \begin{macrocode} +\begingroup \catcode`\"=12 +\gdef\mathhexbox#1#2#3{\text{$\m@th\mathchar"#1#2#3$}} +\endgroup +% \end{macrocode} +% This redefinition means that now symbols like \S, \P, \dag, \ldots, +% which are defined via \cs{mathhexbox} in \fn{plain.tex} or +% elsewhere now correctly change sizes if they are used in math mode. +% \end{macro} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \CheckSum{129} +% \Finale diff --git a/macros/latex-dev/required/amsmath/amstext.ins b/macros/latex-dev/required/amsmath/amstext.ins new file mode 100644 index 0000000000..84fcb0cb95 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amstext.ins @@ -0,0 +1,51 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amstext.sty}{\from{amstext.dtx}{}} +} + +\endbatchfile + diff --git a/macros/latex-dev/required/amsmath/amstext.pdf b/macros/latex-dev/required/amsmath/amstext.pdf Binary files differnew file mode 100644 index 0000000000..a5c78d6737 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amstext.pdf diff --git a/macros/latex-dev/required/amsmath/amsxtra.dtx b/macros/latex-dev/required/amsmath/amsxtra.dtx new file mode 100644 index 0000000000..2165dde41a --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsxtra.dtx @@ -0,0 +1,127 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +%\iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\usepackage{amsxtra} +\GetFileInfo{amsxtra.sty} +\begin{document} +\title{The \pkg{amsxtra} package} +\author{American Mathematical Society\\Michael Downes} +\date{Version \fileversion, \filedate} +\DocInput{amsxtra.dtx} +\end{document} +%</driver> +%\fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% The \pkg{amsxtra} package contains a few rarely used commands that +% were present in version 1.1 of the \pkg{amstex} package: +% \cn{fracwithdelims}, {accentedsymbol}, \cn{sphat}, \cn{spcheck}, +% \cn{sptilde}, \cn{spdot}, \cn{spddot}, \cn{spdddot}, \cn{spbreve}. +% If any of these commands were used in existing documents, the +% \pkg{amsxtra} package provides a way to get them. But for 99\% of +% documents using the \pkg{amstex} package these commands are just +% wasted overhead. +% +% \StopEventually{} +% +% \begin{macrocode} +\ProvidesPackage{amsxtra}[1999/11/15 v1.2c AMS extra commands] +% \end{macrocode} +% We need to ensure that either the \pkg{amstex} package or the +% \pkg{amsmath} package is loaded. This means we need something a +% little more complicated than \cn{RequirePackage}. +% \begin{macrocode} +\@ifpackageloaded{amstex}{}{% + \RequirePackage{amsmath}[1996/10/01 v1.2]} +% \end{macrocode} +% +% Superscripted accent characters. +% \begin{macrocode} +\def\sphat{^{\mathchoice{}{}% + {\,\,\smash[b]{\hbox{\lower4\ex@\hbox{$\m@th\widehat{\null}$}}}}% + {\,\smash[b]{\hbox{\lower3\ex@\hbox{$\m@th\hat{\null}$}}}}}} +\def\spcheck{^\vee} +\def\sptilde{^\sim} +\def\spdot{^{\hbox{\raise\ex@\hbox{\normalfont .}}}} +\def\spddot{^{\hbox{\raise\ex@\hbox{\normalfont ..}}}} +\def\spdddot{^{\hbox{\raise\ex@\hbox{\normalfont...}}}} +\def\spbreve{^{\!\smash[b]{\hbox{\lower4\ex@\hbox{\u{}}}}}} +% \end{macrocode} +% +% The \cn{fracwithdelims} command is skipped if the base package is +% \pkg{amsmath}; it is only needed if the base package is +% \pkg{amstex}. +% \begin{macrocode} +\@ifpackageloaded{amstex}{% +\def\fracwithdelims#1#2{\new@ifnextchar[{\fracwithdelims@#1#2}% + {\fracwithdelims@#1#2[\@empty]}} +\def\fracwithdelims@#1#2[#3]#4#5{\relax + \ifx\@empty#3{#4\overwithdelims#1#2#5}\else + {#4\abovewithdelims#1#2#3\relax#5}\fi} +}{} +% \end{macrocode} +% +% Perhaps |\accentedsymbol| should use |\newsavebox|, but I don't +% know of any compelling reason at the moment.[mjd,5-Sep-1994] +% |\accentedsymbol| can only produce a single size of +% the given symbol, so you'd need two different versions for main +% size and subscript size. +% \begin{macrocode} +\def\accentedsymbol#1#2{% + \expandafter\newbox + \csname\expandafter\@gobble\string#1@box\endcsname + \expandafter\setbox + \csname\expandafter\@gobble\string#1@box\endcsname + \hbox{$\m@th#2$}% + \newcommand{#1}{% + \expandafter\copy + \csname\expandafter\@gobble\string#1@box\endcsname{}}% +} +% \end{macrocode} +% +% Change the definition of \qc{\~} to automatically remove a +% preceding space as well as a following space, if present. +% \begin{macrocode} +\def~{\nobreakspace} +\DeclareRobustCommand{\nobreakspace}{\unskip\nobreak\ \ignorespaces} +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \CheckSum{113} +% \Finale diff --git a/macros/latex-dev/required/amsmath/amsxtra.ins b/macros/latex-dev/required/amsmath/amsxtra.ins new file mode 100644 index 0000000000..9e739c3d4b --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsxtra.ins @@ -0,0 +1,51 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amsxtra.sty}{\from{amsxtra.dtx}{}} +} + +\endbatchfile + diff --git a/macros/latex-dev/required/amsmath/amsxtra.pdf b/macros/latex-dev/required/amsmath/amsxtra.pdf Binary files differnew file mode 100644 index 0000000000..11cea1ef60 --- /dev/null +++ b/macros/latex-dev/required/amsmath/amsxtra.pdf diff --git a/macros/latex-dev/required/amsmath/changes.txt b/macros/latex-dev/required/amsmath/changes.txt new file mode 100644 index 0000000000..1b2d097dd5 --- /dev/null +++ b/macros/latex-dev/required/amsmath/changes.txt @@ -0,0 +1,123 @@ +2019-02-06 Frank Mittelbach <Frank.Mittelbach@latex-project.org> + + * amsmath.dtx (section{Mods, continued fractions, etc.}): + Command \overunderset added + +######################### +# 2018-12-01 Release +######################### + +2018-10-09 Frank Mittelbach <Frank.Mittelbach@latex-project.org> + + * amsmath.dtx + Don't drop \frozen@everymath + Start LR-mode for \thinspace and friends if necessary (github/49) + Start LR-mode for \bigl and friends if necessary (github/49) + Start LR-mode for \smash if necessary (github/49) + +######################### +# 2018-04-01 Release +######################### + +2017-09-02 David Carlisle <latex-bugs@latex-project.org> + + * amsmath.dtx: ensure that overfull alignments give warnings in more cases + https://tex.stackexchange.com/questions/141287/addmargin-enumerate-and-align-miss-an-overfull-hbox + + * amsmath.dtx: move the nulldelimiterspace correction for closing + delimiters in \genfrac for extended TeXs to the line before + \nulldelimiterspace is locally set to 0pt. + +2017-04-14 David Carlisle <latex-bugs@latex-project.org> + + * amscd.dtx: typo fix in ProvidesPackage line. + +2016-11-05 David Carlisle <latex-bugs@latex-project.org> + + * alignedleftspace[yes|no|yesifneg] package options + * New genfrac implementation for XeTeX and LuaTeX + * Delete obsolete install.txt file. + +2016-06-28 David Carlisle <latex-bugs@latex-project.org> + + * amsmath.dtx: Add space to prevent runaway argument error with \dots \left... + +2016-05-26 David Carlisle <latex-bugs@latex-project.org> + + * amsmath.dtx: ignore spaces at start of \intertext + +2016-03-10 David Carlisle <latex-bugs@latex-project.org> + + * amsmath.dtx: Preserve box0 in \resetMathstrut@ + +2016-03-08 David Carlisle <latex-bugs@latex-project.org> + + * amsopn.dtx: In xetex, and luatex, add version of \newmcodes@ + that works even if - has a \Umathcode definition. + +2016-03-03 David Carlisle <latex-bugs@latex-project.org> + + * amsmath.dtx: missing % + +2016-02-20 David Carlisle <latex-bugs@latex-project.org> + + * amsmath.dtx: update to support \Umathchardef and \long macros in \dots. + +2013-01-14 amsmath.dtx 2.14 + + * amsmath.sty 2.14 + -- Minimal changes to make amsmath compatible with stix.sty. + +2000-07-18 amsmath.dtx 2.13 + -- After the numbering patches in 2.11, \notag failed in certain + circumstances: introduce some more auxiliary functions to sort + things out, and redefine \nonumber. + +2000-06-29 amstext.dtx 2.01 + -- Use \f@size instead of \tf@size because they are not + necessarily the same and the former is better for putting a few + words into a display. + +2000-06-06 amsmath.dtx 2.12 + -- Fix transposed lines in 2.11 patch. + +2000-06-02 amsmath.dtx 2.11 + + * amsmath.sty 2.11 + -- Prevent "Arithmetic overflow" error by guarding against + divide-by-zero in \x@calc@shift@lc (align environment). + + * amsdtx.dtx + -- Moved to the amscls distribution. + +2000-05-25 amsmath.dtx 2.10 + -- Clear up error message for \allowdisplaybreaks[0]. + -- Make mathdisplay re-entrant by introducing mathdisplay@stack, + to clear up numbering problems in unusual circumstances such as + \[ \] nested inside minipage inside equation. + +2000-04-21 amsmath.dtx 2.09 + -- Ensure good catcodes for " etc. + +2000-03-16 amsmath.dtx 2.08 + -- Fixed erroneous tag placement on split with fleqn/tbtags options. + +2000-03-15 amsmath.dtx 2.07 + -- Add \reset@strutbox@ to deal with the following bug: After + $...\mbox{\Huge $...$}...$, line spacing is wrong in a + following "gather" or other environment that uses \strut@. + -- Patch to fix bug with intlimits option: too much space in the + middle of \iint. + -- Overhaul math accents again to fix a couple of bugs reported by + Thimm. + +2000-03-10 amsmath.dtx 2.06 + -- Change \MathAccent to \mathaccentV so \DeclareMathAccent won't + give an error when redefining an accent. + +2000-01-06 amsmath.dtx 2.05 + -- Fixed incorrect placement of fleqn/reqno equation numbers + inside indented lists (displaywidth < columnwidth). Changed the + multline/fleqn/leqno indent to match mathmargin when possible + instead of always just using multlinetaggap. + diff --git a/macros/latex-dev/required/amsmath/diffs-m.txt b/macros/latex-dev/required/amsmath/diffs-m.txt new file mode 100644 index 0000000000..af3a273f52 --- /dev/null +++ b/macros/latex-dev/required/amsmath/diffs-m.txt @@ -0,0 +1,551 @@ +diffs-m.txt [1999/12/15] American Mathematical Society + +This is a synopsis of the principal differences between various versions +of the amsmath package and its companion packages. + +A synopsis of changes in the "AMS-LaTeX" distribution is included at the +end of this file. See also diffs-c.txt in the amslatex/classes area. + +Those upgrading from version 1.2 to version 2.0 will probably be +interested in the question: + + After I upgrade will anything fail in my pre-existing documents? + +Certain of the bug fixes have the potential to affect the output of +existing documents in the following ways: + +---Vertical spacing for some displayed equations will change because +"abovedisplayshortskip" is now applied when possible. + +---Incorrect horizontal spacing for certain math constructs will change, +e.g., for \iint\nolimits or a subscript on a double-accented letter. + +---The default subscript placement in displayed formulas for \varinjlim, +\varprojlim, \varliminf, \varlimsup is now below rather than to the +side. To get the old behavior, add \nolimits---e.g., +\varliminf\nolimits_{...}. + +---Ellipsis dots in text (\ldots or \dots) will now behave the same as +in standard LaTeX; the surrounding space may therefore change. + +During regression testing we found some errors cropping up in documents +from incorrect usage that had not been caught with version 1.2. Although +these errors are relatively rare, documents containing such usage will +need to be corrected before they will run properly with version 2.0: + +---Use of two mutually exclusive display structures for the same +display. In this example the outer \[ \] are redundant: + + \[ + \begin{align*} + ... + \end{align*} + \] + +---Inadequate argument markup for math accents: + + \hat \mathcal{C} + +This should have been written with braces surrounding the argument of +the \hat command: \hat{\mathcal{C}}. + +For documents where error messages crop up after the upgrade, there are +various possible approaches, including: + +(a) Change instances of incorrect usage (if applicable). + +(b) Put a copy of amsmath.sty version 1.2 into the home directory of the +document. Then it should continue to work the same as before. + +(c) Use the snapshot package in combination with a shell script to +arrange that version 1.2 of amsmath is found instead of 2.0 when +processing the document. See ftp://ftp.ams.org/pub/tex/snapshot.*. This +approach requires a certain amount of technical knowledge. + +(d) Downgrade to version 1.2 again. + +======================================================================== +Changes in amsmath 2.0 [November 1999] + +---The AMS-LaTeX User's Guide (amsldoc.tex) has been turned into the + AMSmath User's Guide by moving the amsthm documentation into a + separate file (amsthdoc.tex) in the amslatex/classes area. + +---Restored normal use of "shortskip" spacing in single equations. + +[!! NOTE: This means that page breaks may change in existing documents.] + +---Restored normal use of available shrink around binary operators in + single equations. + +---Fixed poor subscript placement for double-accented letters. Math +accent handling was reworked in the process in such a way that the +capitalized forms of the math accent commands are no longer necessary. +\hat{\hat{X}} will do proper alignment of the second accent. \Hat et +cetera are retained for compabitility reasons. (Thanks to Javier Bezos +for donating some code from his accents package.) + +[!! NOTE: Improper math accent use will now produce wrong output.] + +Suppose that we have \boldH defined in the preamble as +\newcommand{\boldH}{\mathbf{H}}. Then the following examples illustrate +recommended usage. + + \hat{\mathbf{H}} OK + \hat{\boldH} OK + \hat\boldH Works OK, but deprecated by the LaTeX book + \hat\mathbf{H} Not OK! Output will be incorrect. + +Since the output will be wrong, amsmath gives an error message when the +last variant is detected. + +---The following kinds of mixed structures worked by happenstance with + amsmath 1.2, although they should have produced an error message. + With amsmath 2.0 they will produce an error or warning message. + + [!! NOTE: Potential error messages] + + % Outer \[ \] is redundant + + \[ + \begin{align*} + ... + \end{align*} + \] + + % Outer \begin{equation*} ... \end{equation*} is redundant + + \begin{equation*}\begin{alignat*}{2} + ... + \end{alignat*} + \end{equation*} + + % No printed material is allowed between \begin{equation} and + % \begin{split}: + + \begin{equation*}\left \{ + \begin{split} + ... + \end{split}\right . + \end{equation*} + +---diff12.tex is replaced by diffs-m.txt and diffs-c.txt, with the + latter moving to the amslatex/classes area. + +---Added an "?" option which gives some information about the available + documentation. + +---The amsmath definitions for matrix, pmatrix, and cases are + incompatible with the plain-TeX syntax for \pmatrix, \matrix, and + \cases, which are used occasionally by some authors in LaTeX + documents. In version 2.0 the error messages resulting from the + plain-TeX syntax have been made more intelligible. + +---If you need the boldsymbol facilities of the amsbsy package, use of + the "bm" (boldmath) package is recommended instead for new documents. + The amsbsy package is retained for compatibility with existing + documents. If you have a recent version of LaTeX (1998 or newer) you + already have the bm package; otherwise you may need to get it from + CTAN. (It is not an AMS package.) + +---\iint\nolimits: Fixed poor placement of subscript (also \iiint, +\idotsint, etc). + +---\varinjlim, \varprojlim, \varliminf, \varlimsup: Default to +\displaylimits instead of nolimits. + +---Fixed alignedat so that it doesn't take the first token of its + contents and try to interpret it as a number. + +---Leave text version of \dots and \ldots unchanged. + +---Changed \numberwithin so it no longer assumes previous definition of + \thesomething contained no prefixes. + +---\mathbf{\Gamma}: Leave cap Greek letters alone instead of converting + them from variable (fam 7) to fixed (fam 0). \mathbf{\gamma} still + fails---but that's a math font problem. + +---\mathindent is aliased to \@mathmargin so that when the fleqn option + is used, users can reset it as the LaTeX book advertises. + +---With the showkeys package: Corrected loss of marginal notes when +labels occurred inside an align environment. + +---Carried over some tweaks (\bmod, \right/leftarrowfill) from the 1996 + version of plain.tex. + +---Adjusted spacing of overarrow@ and underarrow@ to allow more room for + larger cmsy arrowheads. + +---Corrected spurious "overfull \hbox" warnings for \xrightarrow. + +---Corrected poor spacing for \xleftarrow. + +---Removed the \leavevmode in \smash which caused trouble for some + applications (e.g., the crop package) that expected the original + LaTeX definition. + +---Changed \def to \newcommand/\newenvironment where appropriate. + +---Use \sqrtsign instead of \@@sqrt (but include a backward + compatibility hack for the latter). + +---Left brace in \env{cases} environment would fail to work in + certain circumstances: Fix by using \lbrace instead of \{. + +---Use \ignorespacesafterend where applicable instead of + \global\@ignoretrue. + +---Protected commands in the definition of \theequation were + incorrectly expanded by the subequations environment when copying + the definition to \theparentequation: Fix by using \protected@edef. + +---Spurious extra space following punctuation at that end of a display: + In \math@cr, \math@cr@@, etc, use \iffalse{\fi instead of simply { to + keep an unwanted mathord atom from being added at the end of the + current math list; added \endmultline@math to work around a similar + sort of problem specific to the `multline' environment. + +---Various wrong results or no effect for \displaybreak inside "align", + "alignat", etc. Resetting \dspbrk@level in the \everycr of + \@display@init cleared most of these up. + +---Changed \displaybreak to issue an error message if enclosed in boxing + environment that will keep it from having any effect. + +---Turned off \displaybreak during the measuring phase of multline. + +---Fixed some numbering problems with multline and multline* and error + for use of \tag. + +---Use \@gtempa instead of \@tempa where assigned globally (standard + save stack precaution). + +---Save and restore \column@ to keep aligned from screwing up the column + counting of a parent align environment. Made \column@ assignments + uniformly global, except in a couple of places where the risk of side + effects seemed too great. + +---Error recovery for misspelled '\end{multline}' was not very helpful. + Improve \collect@body along lines suggested by Hellström. + +---Fixed up certain number placement problems with align + +---Add \alignsafe@testopt to work around a LaTeX bug: when a nested + alignment environment that takes an optional argument has an empty + first cell (i.e., begins with an &) LaTeX's optional argument + scanning screws up the alignment state. + +---Add `mathdisplay' environment (internal use) to correct several + problems of \[ \] and the `equation' environment arising from the + previous implementation as a degenerate case of `gather'. + +---It is possible now to use \eeq as an abbreviation for \end{equation} +(one of the consequences of the preceding change). But still not \eal +for \end{align} or certain other display structures. + +---Reorganize `split' internal calling sequence to go along with the use + of `mathdisplay' in \[ \] and `equation'. + +---Suppression of LaTeX error messages during measuring phase made + primitive TeX errors harder to understand; stop suppressing. (As a + result, users will sometimes get redundant error messages now.) + Remove obsolete Sb, Sp environments again. + +---The file amsintx.dtx was removed from the distribution pending + further development. + +---Remove the \ifinany@ switch, use \spread@equation instead to achieve + the same ends. + +---Remove unbracefonts@ function, no longer needed after changes in + math accent handling. + +---Got rid of the special trap for '^x that had been carried over from +AMS-TeX. + +---Made \overline, \doteq, \longrightarrow, etc, robust. + +---Changed \relbar to use \std@minus---otherwise \underleftrightarrow +works poorly in a \DeclareMathOperator definition. + +---Use \new@ifnextchar in matrix, pmatrix, cases so that \\<newline>[x] +doesn't trigger an error. + +---Bug fix for nested use of \label inside minipage inside equation. + +---Add minalignsep after every second column in aligned, for consistency +with align. + +======================================================================== +Changes in amsmath 1.2 [January 1995] + +---Name change; relation to the "amsfonts" package + +In version 1.1 of AMS-LaTeX, the name of this package was "amstex". The +new name is "amsmath". The amstex package automatically invoked the +amsfonts package as well; the amsmath package does not. + +---Adapted for LaTeX2e + +Old method of invocation: + + \documentstyle[amstex]{article}% LaTeX 2.09 + +New method of invocation: + + \documentclass{article} + \usepackage{amsmath} + +---Handling of options intlim, nosumlim, nonamelm, righttag, ctagsplt + +Old usage: + + \documentstyle[amstex,righttag,intlim] + +New usage: + + \usepackage[reqno,intlimits]{amsmath} + +Several option names were changed (mainly, they are no longer restricted +to eight characters): + + intlim -> intlimits + nosumlim -> nosumlimits + nonamelm -> nonamelimits + righttag -> reqno [for consistency with "leqno"] + ctagsplt -> centertags + +---Character @ is no longer used as a special command prefix + +Certain commands in the amstex pkg started with "@" instead of "\". This +special usage has been discontinued, except for the amscd package, and +then only within the CD environment. Practically speaking, this means +primarily that it is no longer necessary to use doubled @@ to get a +single printed @ character (e.g., in e-mail addresses). + +---The @, and @! micro-spacing commands are no longer provided + +As a consequence of the @ character change, "@," and "@!" are no longer +recognized spacing commands. An \mspace command is provided that can be +used instead; see the AMSmath User's Guide. + +---Extensible arrow commands @>>> and @<<< + +The commands @>>> and @<<< are no longer available [except in the CD +environment of the amscd package]; alternative commands \xleftarrow and +\xrightarrow are provided by the amsmath package. The sub and +superscripts are given through an optional resp. mandatory argument, for +example + + X\xleftarrow{b}Y % superscript "b" only + X\xrightarrow[\alpha]{\beta}Y % sub alpha, sup beta + +---The command \bold has been superseded by the command \mathbf, as the +latter is now the standard name provided by LaTeX for this purpose. + +---The commands \newsymbol, \frak, \Bbb are no longer available because +the amsfonts package is not loaded by amsmath. In any case those +commands now have new names---\frak -> \mathfrak, \Bbb -> \mathbb, etc. +See the amsfonts documentation for further details. + +---The amsmath package provides \lvert and \rvert to use for vert-bar +symbols when they act as delimiters (compare \langle, \rangle for +angle-bracket delimiters). Commands \lVert and \rVert are likewise +provided instead of \| for paired-delimiter use of the double-vert +symbol. Use of | and \| for paired delimiters can lead to incorrect +spacing in rare cases. Further discussion is found in the AMS-LaTeX +user's guide (amsldoc.tex). + +---The ~ command is now left unchanged by amsmath; the change +that makes it remove a redundant preceding or following space character +is now done only by AMS documentclasses (in version 1.1 this was done by +the amstex package). + +---The following rarely used commands are removed to the amsxtra +package: \accentedsymbol, \sphat, \spcheck, \sptilde, \spdot, \spddot, +\spdddot, \spbreve, \@))), \@(((. + +---The six generalized fraction commands \over, \overwithdelims, \atop, +\atopwithdelims, \above, \abovewithdelims are deprecated and produce +warning messages. Their functionality can be obtained through \frac, +\binom, and \genfrac instead. See amsldoc.tex and technote.tex for +further details. + +---The \fracwithdelims command is gone, as \genfrac provides +equivalent functionality (and a little more). + +---The optional argument of \frac that allowed changing the thickness of +the fraction line is gone. That functionality is now provided only +through \genfrac: the need to change the line thickness is so rare in +practice that it seems better not to burden the ubiquitous \frac command +with the somewhat time-consuming look-ahead process required for an +optional argument. I.e., this change will contribute in a small way to +making your documents run faster. + +---The commands \lcfrac and \rcfrac for left or right alignment of +continued fraction numerators are gone; they are replaced by an optional +argument of the \cfrac command. + +---A new command \DeclareMathOperator is provided for defining new +operator names: + +\DeclareMathOperator{\Tr}{Tr} +\DeclareMathOperator*{\xlim}{x-lim} + +The * form makes the operator name produce limit-style sub and +superscripts, like \max or \lim. This is now the preferred method, +instead of using the old command \operatorname (which is, however, +retained for now). The command \operatornamewithlimits has been renamed +\operatorname*. These commands now can also be obtained through a +separate package amsopn, so it's not necessary to load the entire +amsmath package just to get that feature. + +---Environments "Sb", "Sp" retired. + +The environments Sb and Sp for multiline subscripts have been replaced +by a single command \substack, used as follows: + +\sum_{\substack{first line\\second line}} + +This command can be used equally well in a subscript or superscript, and +provides better vertical positioning (as compared to Sb, Sp) if a +multiline subscript is placed on the side, as perhaps for an integral. +There is also a slightly generalized alternative, an environment +subarray that allows you to specify either centering or left alignment +for the contents: + +\sum_{\begin{subarray}{l}first line\\second line\end{subarray}} + +---New command \nobreakdash + +A command \nobreakdash is provided to suppress the possibility of a +linebreak after the following hyphen or dash. For example, if you write +"$p$\nobreakdash-adic" then a linebreak will never be taken between the +hyphen and the "adic". + +---The placement of equation numbers has been substantially improved for +align, gather, and split. Numbers will now never overlap on top of the +equation body (as far as we can ascertain), and they are much less +likely to be shifted up or down unnecessarily when there is actually +adequate space to leave the number in the normal place. In a few +remaining cases, an equation number will be shifted unnecessarily +because technical complications make accurate measurement of the +available room too difficult; for those cases a \raisetag command is +provided that allows you to manually adjust the vertical position of the +equation number. + +---The [xx]align[at] family of environments has been thoroughly revised: +now the xalignat environment is gone, as its function has been merged +into the align environment (it's no longer necessary to specify how many +side-by-side structures, as was required for xalignat, because align +automatically handles any number of them). Similarly, the xxalignat +environment has been replaced by an environment flalign that doesn't +require you to specify how many side-by-side structures will be needed. +Certain numbering problems (presence of an equation number when it +should be absent, or vice versa) have also been cleared up. + +(Thanks to David M. Jones for his substantial [volunteer] work behind +this change and the preceding one.) + +---The alignedat environment was changed to take two arguments rather +than one: a mandatory argument (as formerly) specifying the number of +align structures, and a new optional one specifying the placement of the +environment (parallel to the optional argument of aligned). However, +aligned is simpler to use, allowing any number of aligned structures +automatically, and therefore the use of alignedat is deprecated. + +---The seldom-used command \oldnos is gone; if you need it, you should +consult the LaTeX documentation on using fonts (e.g., fntguide.tex) to +find out how to construct an equivalent command. + +---A new subequations environment causes all numbered equation +environments within its scope to be numbered (4.9a) (4.9b) (4.9c) etc., +if the preceding numbered equation was 4.8. A \label command immediately +after \begin{subequations} will produce a \ref of the parent number +`4.9', not `4.9a'. The counters used by the subequations environment are +parentequation and equation and standard uses of \addtocounter, +\setcounter, etc., are possible with those counter names. + +---The amsmath package (unlike amstex) respects the setting provided by +the documentclass for putting equation numbers on the right or the left. +[Technical note: a documentclass that has leqno as the default should +explicitly pass that option to the amsmath package with +\PassOptionsToPackage in order for it to be effective.] + +---The fleqn option for left-aligned instead of centered equations is +now supported (thanks to David M. Jones). + +************************************************************************ +The remainder of this file discusses some changes that do not directly +pertain to the amsmath package but to the parent distribution known as +"AMS-LaTeX". + +======================================================================== +Changes in AMS-LaTeX 2.0 + +---The AMS-LaTeX User's Guide (amsldoc.tex) is split up into amsldoc.tex +and amsthdoc.tex, with the latter moving into the "classes" area. + +---The file amslatex.faq was split into amsmath.faq and amsclass.faq. + +---The file amslatex.bug was done away with; most of the information was +merged into diffs-m.txt, diffs-c.txt, amsmath.faq, and amsclass.faq. + +======================================================================== +Changes in AMS-LaTeX 1.2 + +---Adapted for LaTeX2e + +AMS-LaTeX 1.0 and 1.1 were designed to work with LaTeX 2.09, which +became obsolete in 1994 with the appearance of "LaTeX2e". AMS-LaTeX 1.2 +has been extensively adapted to take advantage of various features of +LaTeX2e. It is no longer a separate TeX format---i.e., it does not need +to be invoked by a separate "amslatex" command. + +---LaTeX 2.09 font commands (\bf, \it, etc) + +Pre-existing documents will for the most part continue to work fine +without requiring any changes. However, depending on the installation +options used for your copy of AMS-LaTeX 1.1 you may need to update the +options list of the \documentstyle command by adding newlfont, for +example: + + \documentstyle[newlfont]{amsart} + +---The packages amsfonts, amssymb were moved to the AMSFonts +distribution. They used to be included in the AMS-LaTeX distribution for +pragmatic reasons but their natural home is with the AMSFonts +distribution. + +---Package amstex renamed to amsmath + +The amstex package has been renamed amsmath. The old name `amstex' came +from the fact that version 1.0 was a more or less straight port into +LaTeX of selected portions from the macro package AmS-TeX written by +Michael Spivak, but the historical origins of the package are likely of +less interest to the general usership---especially looking to the +future---than a straightforward declaration in the name `amsmath' of the +sort of features that are provided. + +Another important reason for the name change was to make possible some +progress that would be out of the question (because of the impact on +existing documents) if the name `amstex' were retained. For example, +unlike amstex, amsmath doesn't automatically load the amsfonts package, +as that package was moved out to the AMSFonts distribution as described +above. If this change were not accompanied by a name change, many +existing documents would have to be updated by hand (adding +\usepackage{amsfonts}) in order to run without error. A frozen version +of amstex.sty is provided for processing pre-existing documents; it +won't have active maintainence henceforth except for bug fixes. For new +documents, authors should use the amsmath package. + +Therefore, "\usepackage{amstex}" is incorrect usage---do not rely on the +1994 edition of `The LaTeX Companion' in this respect (unless you obtain +the errata for Chapter 8). + +---New documentclass amsproc + +A new documentclass amsproc was added for collections of articles, such as +the proceedings of a conference. diff --git a/macros/latex-dev/required/amsmath/manifest.txt b/macros/latex-dev/required/amsmath/manifest.txt new file mode 100644 index 0000000000..ee6b8e3238 --- /dev/null +++ b/macros/latex-dev/required/amsmath/manifest.txt @@ -0,0 +1,32 @@ +README.txt +amsbsy.dtx +amsbsy.ins +amsbsy.pdf +amscd.dtx +amscd.ins +amscd.pdf +amsgen.dtx +amsgen.ins +amsgen.pdf +amsldoc.pdf +amsldoc.tex +amsmath.dtx +amsmath.ins +amsmath.pdf +amsopn.dtx +amsopn.ins +amsopn.pdf +amstex.sty +amstext.dtx +amstext.ins +amstext.pdf +amsxtra.dtx +amsxtra.ins +amsxtra.pdf +diffs-m.txt +subeqn.pdf +subeqn.tex +technote.pdf +technote.tex +testmath.pdf +testmath.tex diff --git a/macros/latex-dev/required/amsmath/subeqn.pdf b/macros/latex-dev/required/amsmath/subeqn.pdf Binary files differnew file mode 100644 index 0000000000..2e84ebe942 --- /dev/null +++ b/macros/latex-dev/required/amsmath/subeqn.pdf diff --git a/macros/latex-dev/required/amsmath/subeqn.tex b/macros/latex-dev/required/amsmath/subeqn.tex new file mode 100644 index 0000000000..c34b3f6952 --- /dev/null +++ b/macros/latex-dev/required/amsmath/subeqn.tex @@ -0,0 +1,202 @@ +%%% ==================================================================== +%%% @LaTeX-file{ +%%% filename = "subeqn.tex", +%%% version = "1.2c", +%%% date = "1999/11/29", +%%% time = "14:49:29 EST", +%%% checksum = "29866 202 668 6426", +%%% author = "American Mathematical Society", +%%% copyright = "Copyright 1999 American Mathematical Society, +%%% all rights reserved. Copying of this file is +%%% authorized only if either: +%%% (1) you make absolutely no changes to your copy, +%%% including name; OR +%%% (2) if you do make changes, you first rename it +%%% to some other name.", +%%% address = "American Mathematical Society, +%%% Technical Support, +%%% Electronic Products and Services, +%%% P. O. Box 6248, +%%% Providence, RI 02940, +%%% USA", +%%% telephone = "401-455-4080 or (in the USA and Canada) +%%% 800-321-4AMS (321-4267)", +%%% FAX = "401-331-3842", +%%% email = "tech-support@ams.org (Internet)", +%%% supported = "yes", +%%% keywords = "latex, amslatex, ams-latex, amstex", +%%% abstract = "This is part of the AMS-\LaTeX{} distribution. +%%% It is a sample document illustrating the use of +%%% the subequations environment and the effect of +%%% the fleqn option.", +%%% docstring = "The checksum field above contains a CRC-16 +%%% checksum as the first value, followed by the +%%% equivalent of the standard UNIX wc (word +%%% count) utility output of lines, words, and +%%% characters. This is produced by Robert +%%% Solovay's checksum utility.", +%%% } +%%% ==================================================================== +\documentclass[fleqn]{article} + +\title{Test of subequations environment} +\author{mjd} + +\usepackage{amsmath} +\numberwithin{equation}{section} + +\newcommand{\env}[1]{{\normalfont\texttt{#1}}} + +\AtEndDocument{\multipasswarning} +\newcommand{\multipasswarning}{% + \clearpage + \typeout{% + **********************************************************************} + \typeout{% + Note: This document needs to run through LaTeX three times, instead of} + \typeout{% + the usual two, to resolve indirect cross-references.} + \typeout{% + **********************************************************************} +} + +\makeatletter +% Omit the warning message if three passes have been completed (on +% first pass \ref{check} is undefined and it is set to 0; on second +% pass \ref{check} is 0 and set to 1; on third pass it is 1). +\def\checkref{\begingroup + \@ifundefined{r@check}{\let\r@check\relax\def\@currentlabel{0}}{\def\@currentlabel{1}}% + \ifnum1=0\expandafter\@firstoftwo\r@check\relax + \global\let\multipasswarning\relax + \fi + \label{check}% + \endgroup} +\makeatother + +\begin{document} +\section{Prime equation numbers} + +First an equation. +\begin{equation}\label{e:previous} +A=B +\end{equation} +That was equation \eqref{e:previous}. + +Then the same, with a prime on the number.\checkref +\begin{equation} +\tag{\ref{e:previous}$'$}\label{e:prevprime} +C=D +\end{equation} +And that was equation \eqref{e:prevprime}. + +Notice, by the way, that when a \verb"\ref" occurs inside a \verb"\tag", +and that \verb"\tag" is then \verb"\label"'d, a \verb"\ref" for the the +second \verb"\label" requires \emph{three} runs of \LaTeX{} in order to +get the proper value. (If you run through the logic of \LaTeX{}'s +cross-referencing mechanisms as they apply in this case, you will see +that this is necessary.) + +\section{Subnumbered equations} + +Here is a,b,c sub-numbering. +\begin{subequations} +\begin{eqnarray} +A&=&B\\ +D&=&C \label{e:middle}\\ +E&=&F +\end{eqnarray} +\end{subequations} +That was produced with the \env{eqnarray} environment; the middle line +was labeled as \eqref{e:middle}. + +An equation following the end of the \verb"subequations" environment +should revert to normal numbering: +\begin{equation}\label{e:check} +H<K +\end{equation} +A check on the labeling: that was equation~\eqref{e:check}. + +The sub-numbered equations can be spread out through the text, like +this: +\begin{subequations} +\begin{equation} +A=B +\end{equation} +The \verb"subequations" environment can span arbitrary text between +subsidiary equations. The only restriction is that if there are any +numbered equations inside the \verb"subequations" environment that break +out of the subequation numbering sequence, they would have to be handled +specially. +\begin{equation} +D=C \label{e:newmiddle} +\end{equation} +More arbitrary text. +\begin{equation} +E=F +\end{equation} +\end{subequations} +Label check: the middle one was \eqref{e:newmiddle} + +A final equation for a numbering check. +\begin{equation}\label{e:final} +G=H +\end{equation} +That equation was labeled as \eqref{e:final}. + +\section{Tests of \env{align}, \env{gather}, and other +AMS-\protect\LaTeX{} environments} + +The \env{align} environment: +\begin{subequations} +\begin{align} +\label{align:a}A+B&=B+A\\ +\label{align:b}C&=D+E\\ +\label{align:c}E&=F +\end{align} +\end{subequations} +Label check: that was \eqref{align:a}, \eqref{align:b}, and +\eqref{align:c}. + +The \env{align} environment again: +\begin{subequations} +\begin{align} +\label{xalign:a}A+B&=B& B&=B+A\\ +\label{xalign:b}C&=D+E& C\oplus D&=E\\ +\label{xalign:c}E&=F& E'&=F' +\end{align} +\end{subequations} +Label check: that was \eqref{xalign:a}, \eqref{xalign:b}, and +\eqref{xalign:c}. + +The \env{gather} environment. For the third line we refer to one of the +numbers in the first \env{align} structure. +\begin{subequations} +\begin{gather} +\label{gather:a}A+B=B\\ +\label{gather:b}C=D+E\\ +\tag{\ref{align:c}$'$}\label{gather:c}E=F +\end{gather} +\end{subequations} +Label check: that was \eqref{gather:a}, +\eqref{gather:b}, and +\eqref{gather:c}. + +The next \env{subequations} environment encompasses two separate +equations. A \env{split} environment: +\begin{subequations} +\begin{equation} +\label{split:x} +\begin{split} +A&=B+C+F\\ +&=G +\end{split} +\end{equation} +and a \env{multline} environment: +\begin{multline}\label{multline:x} +A[B]C[D]E[F]G[[H[I]J[K]L[M]N]]=\\ +H[I]J[K]L[M]N[O]P[Q]R[S]T[U]V[W]X[Y]Z +\end{multline} +\end{subequations} +Label check: That was \eqref{split:x} and \eqref{multline:x}. + +\end{document} diff --git a/macros/latex-dev/required/amsmath/technote.pdf b/macros/latex-dev/required/amsmath/technote.pdf Binary files differnew file mode 100644 index 0000000000..7d7ab397c8 --- /dev/null +++ b/macros/latex-dev/required/amsmath/technote.pdf diff --git a/macros/latex-dev/required/amsmath/technote.tex b/macros/latex-dev/required/amsmath/technote.tex new file mode 100644 index 0000000000..aede450621 --- /dev/null +++ b/macros/latex-dev/required/amsmath/technote.tex @@ -0,0 +1,233 @@ +%%% ==================================================================== +%%% @LaTeX-file{ +%%% filename = "technote.tex", +%%% version = "2.0", +%%% date = "1999/11/15", +%%% time = "15:07:20 EST", +%%% checksum = "58506 233 1647 12005", +%%% author = "American Mathematical Society", +%%% copyright = "Copyright 1995, 1999 American Mathematical Society, +%%% all rights reserved. Copying of this file is +%%% authorized only if either: +%%% (1) you make absolutely no changes to your copy, +%%% including name; OR +%%% (2) if you do make changes, you first rename it +%%% to some other name.", +%%% address = "American Mathematical Society, +%%% Technical Support, +%%% Electronic Products and Services, +%%% P. O. Box 6248, +%%% Providence, RI 02940, +%%% USA", +%%% telephone = "401-455-4080 or (in the USA and Canada) +%%% 800-321-4AMS (321-4267)", +%%% FAX = "401-331-3842", +%%% email = "tech-support@ams.org (Internet)", +%%% supported = "yes", +%%% keywords = "amsmath, latex", +%%% abstract = "This is part of the AMS-\LaTeX{} distribution. It +%%% is a document discussing some technical issues in the +%%% contents and interface of AMS-\LaTeX{} packages." +%%% docstring = "The checksum field above contains a CRC-16 checksum +%%% as the first value, followed by the equivalent of +%%% the standard UNIX wc (word count) utility output of +%%% lines, words, and characters. This is produced by +%%% Robert Solovay's checksum utility.", +%%% } +%%% ==================================================================== +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\documentclass{amsdtx} + +\title{Technical notes on the \pkg{amsmath} package} +\author{American Mathematical Society\\Michael Downes} +\date{1999/10/29} + +\markboth + {Technical notes on the \pkg{amsmath} package} + {Technical notes on the \pkg{amsmath} package} +\renewcommand{\sectionmark}[1]{} + +\providecommand{\etc}[1]{etc.} + +\providecommand{\begend}[1]{% + {\ntt \symbol{92}begin\symbol{123}#1\symbol{125}} + \ldots\ {\ntt\symbol{92}end\symbol{123}#1\symbol{125}}% +} + +\MakeShortVerb{\|} + +\begin{document} +\maketitle + +\section{Introduction} + +These notes are miscellaneous remarks on some technical questions +applicable to version 2.0 of \amslatex/. + +\section{Deprecated and disallowed commands} + +Certain commands that were in the \pkg{amstex} package (the predecessor, +in \amslatex/ 1.0 and 1.1, of the \pkg{amsmath} package) were moved into +\pkg{amsxtra} because they seemed to be little-used relics: +\cn{accentedsymbol}, \qq{sup accents} (\cn{sptilde}, \cn{sphat}, etc.). + +Certain other commands\mdash e.g., \cn{over}, \cn{pmatrix}, and +\cn{cases}\mdash are changed by the \pkg{amsmath} package to produce +warning messages or error messages, depending on their history; these +are discussed in more detail in the following sections. + +\section{Why do \cn{matrix}, \cn{pmatrix}, and \cn{cases} stop working +when I add the \pkg{amsmath} package?} + +If you used the \fn{plain.tex} versions of \cn{matrix}, \cn{pmatrix}, or +\cn{cases} in a document and then later converted the document to use +the \pkg{amsmath} package (or one of the AMS documentclasses, which +automatically call the \pkg{amsmath} package internally), the instances +of those commands will produce error messages. The problem is that when +\latex/ was originally created, it adopted most of its mathematics +features straight from \fn{plain.tex}. But in the case of \cn{matrix}, +\cn{pmatrix}, \cn{cases} this was a mistake\mdash the \fn{plain.tex} +syntax for them is decidedly non-\latex/ in style, for example the fact +that they use \cs{cr} instead of \cn{\\} to mark line breaks, and they +don't use \cn{begin} and \cn{end}. In basic \latex/ this mistake will be +perpetuated at least until \latex/3 appears, in order to avoid breaking +existing documents. But no existing documents that were written with the +\pkg{amsmath} package have that syntactic problem, as \pkg{amsmath} +provides proper \latex/-syntax versions of \cn{matrix} and the others. +The possibility of optionally allowing the \fn{plain.tex} variants to +make document conversion easier seems ill-advised since those variants +are so blatantly wrong in a \latex/ context. The \env{array} environment +ought to have been used instead. + +\section{Why do \cn{over}, \cn{atop}, \cn{above} [\dots{\ntt withdelims}] + give a warning when I add the \pkg{amsmath} package?} + +Using the six generalized fraction commands \cn{over}, +\cn{overwithdelims}, \cn{atop}, \cn{atopwithdelims}, \cn{above}, +\cn{abovewithdelims} is not really a good idea in \latex/, for reasons +explained below. I construe \latex/'s provision of \cs{frac}, and the +lack of any mention in the \latex/ book of the primitive fraction +commands, as an implicit injunction against their use, although I don't +think Lamport actually spent a lot of time pondering the issue, and the +basic \latex/ version of \cn{frac} provides access only to \cn{over}, +not to \cn{atop}, \cn{above}, or the \verb'withdelims' variants. The +\pkg{amsmath} package, however, provides a \cn{genfrac} command that +gives user-level access to all six of the generalized fraction +primitives in a way that conforms to the syntactic conventions followed +by all other \latex/ commands. + +Not only is the unusual syntax of the \tex/ primitives rather out of +place in \latex/, but furthermore that syntax seems to be responsible +for one of the most significant flaws in \tex/'s mathematical +typesetting capabilities: the fact that the current mathstyle at any +given point in a math formula cannot be determined until the end of the +formula, because of the possibility that a following generalized +fraction command will change the mathstyle of the \emph{preceding} +material. To cite two of the worst side effects: \cn{mathchoice} must +actually typeset all four of its arguments, instead of being able to +immediately select only one; and, were it possible to always know the +current math style at a given point, math font selection would be +greatly simplified and the upper limit of 16 different math font +\cn{fam}s would never be a problem as \cn{text,script[script]font} +assignments for any \cn{fam} could take immediate effect and therefore +could be changed arbitrarily often within a single formula. More +concretely, math font selection difficulties are responsible for many of +the more convoluted passages in the source code of \latex/'s NFSS (that +does font loading on demand) and of the \pkg{amsmath} package, and by +extension it has historically been responsible for significant delays in +making new features available to end users and for making those features +more prone to bugs. + +There are additional bad consequences following from the syntax of those +generalized fraction commands that only become evident when you do some +writing of nontrivial macros for math use. For example, as things +currently stand you cannot measure the size of any object in math +without going through \cn{mathchoice} and \emph{leaving and reentering +math mode} via \verb'\hbox{$' (which then introduces complications +regarding \cn{everymath} and \cn{mathsurround}). And it seems that +uncertainty about the current mathstyle is the only barrier to allowing +the use of mu units with \cn{vrule}, to make vertical struts in +constructing compound symbols or notation. And so on and so forth. + +\section{The \opt{fleqn} option and \cn{mathindent}} + +Strictly speaking, the \pkg{amsmath} package doesn't use \cn{mathindent} +to control the left indent of displayed equations when the \opt{fleqn} +option is in effect: it uses an internal parameter \cs{@mathmargin} +instead. However, for compatibility with existing \latex/ documentation, +\pkg{amsmath} turns \cn{mathindent} into an alias for \cs{@mathmargin}. +There is a small risk here: In the plain \latex/ implementation, +\cn{mathindent} is a dimen register, but with \pkg{amsmath} +\cs{@mathmargin} is a skip register and, by association, so is +\cn{mathindent}. If any package or documentclass uses \cn{mathindent} in +a way that depends on it being a dimen register, when used in +conjunction with the \pkg{amsmath} package it may be vulnerable to a +well-known pitfall having to do with the primitive \tex/ lookahead for a +\texttt{plus} or \texttt{minus} key word. However if the standard +\latex/ commands \cn{setlength} and \cn{addtolength} are used to modify +\cn{mathindent} then this problem will not arise. + +\section{Why can't I use abbreviations for \protect\begend{align}?} + +Authors often like to use abbreviations such as |\beq| |\eeq| for +|\begin{equation}| |\end{equation}|. For some environments defined by +the \pkg{amsmath} package, such as \env{align}, \env{gather}, +\env{multline}, and others of the same general type, this does not work: +An attempt to define |\bal| |\eal| as shorthand for |\begin{align}| +|\end{align}| will fail with a puzzling error message. This has to do +with unfortunately nontrivial technical complications: the given +environments must read their contents as a delimited macro argument +because they do multipass processing of the contents using algorithms +inherited from Spivak's \fn{amstex.tex}. The obvious +solution\mdash substitution of different algorithms that do box shuffling +instead of token shuffling for the multipass calculations\mdash would +require rewriting these display environments from the ground up; while +that is a worthy goal, it was beyond the original scope of the +\amslatex/ project. Work is under way on an auxiliary package called +\pkg{breqn} that addresses not only this problem but a number of others; +at the time of this writing, however [September 1999] it has only +progressed as far as a beta release. + +Some workarounds: +\begin{itemize} +\item |\def\bal#1\eal{\begin{align}#1\end{align}}| +\item Define |\newcommand{\env}[2]{\begin{#1}#2\end{#1}}| and then use + |\env{align}{...}| +\end{itemize} + +\section{The \pkg{upref} package} + +The reason for splitting out the \pkg{upref} package instead of +automatically incorporating it in the \cls{amsart} and \cls{amsbook} +classes is this: It involves low-level surgery on an important \latex/ +command. This means that if ever this command changes in the future (as +it did between versions 2.09 and 2e of \latex/) we have a maintenance +problem. And the benefit that \pkg{upref} provides is something that +most end users don't care much about. + +\section{The \pkg{amsintx} package} + +After a very preliminary trial release the \pkg{amsintx} package was +withdrawn to await further development. It is still considered a worthy +project but has simply not yet made it to the head of the priority queue +in the AMS \latex/ development program, as it has had to contend with a +number of other equally worthy projects for development time. + +\section{Hyphenation in the documentation} + +Hyphenation was allowed for certain long command names in +\fn{amsldoc.tex}; this presented technical difficulties because \latex/ +normally deactivates hyphenation for tt fonts. The method chosen to +reinstate hyphenation was to turn off the encoding-specific function +\cs{OT1+cmtt} that disables the \cs{hyphenchar} for tt fonts; see the +definition of \cn{allowtthyphens} in \fn{amsdtx.dtx}. Then a list of all +tt words in the document was gathered (from the \fn{.idx} file, produced +by the \cn{cn}, \cn{fn}, \cn{pkg}, etc. commands) and \cn{showhyphens} +was applied to this list. The result was another list in the resulting +\tex/ log, containing those words in a form suitable for the argument of +\cn{hyphenation}. That list was then edited by hand to overrule +undesirable hyphenations; words with acceptable hyphenations were +dropped from the list, as they don't need to be repeated there. + +\end{document} diff --git a/macros/latex-dev/required/amsmath/testmath.pdf b/macros/latex-dev/required/amsmath/testmath.pdf Binary files differnew file mode 100644 index 0000000000..d97ff85f73 --- /dev/null +++ b/macros/latex-dev/required/amsmath/testmath.pdf diff --git a/macros/latex-dev/required/amsmath/testmath.tex b/macros/latex-dev/required/amsmath/testmath.tex new file mode 100644 index 0000000000..069944ee9d --- /dev/null +++ b/macros/latex-dev/required/amsmath/testmath.tex @@ -0,0 +1,2342 @@ +%%% ==================================================================== +%%% @LaTeX-file{ +%%% filename = "testmath.tex", +%%% version = "2.0", +%%% date = "1999/11/15", +%%% time = "15:09:17 EST", +%%% checksum = "07762 2342 7811 82371", +%%% author = "American Mathematical Society", +%%% copyright = "Copyright 1995, 1999 American Mathematical Society, +%%% all rights reserved. Copying of this file is +%%% authorized only if either: +%%% (1) you make absolutely no changes to your copy, +%%% including name; OR +%%% (2) if you do make changes, you first rename it +%%% to some other name.", +%%% address = "American Mathematical Society, +%%% Technical Support, +%%% Electronic Products and Services, +%%% P. O. Box 6248, +%%% Providence, RI 02940, +%%% USA", +%%% telephone = "401-455-4080 or (in the USA and Canada) +%%% 800-321-4AMS (321-4267)", +%%% FAX = "401-331-3842", +%%% email = "tech-support@ams.org (Internet)", +%%% codetable = "ISO/ASCII", +%%% keywords = "latex, amsmath, examples, documentation", +%%% supported = "yes", +%%% abstract = "This is a test file containing extensive examples of +%%% mathematical constructs supported by the amsmath +%%% package.", +%%% docstring = "The checksum field above contains a CRC-16 +%%% checksum as the first value, followed by the +%%% equivalent of the standard UNIX wc (word +%%% count) utility output of lines, words, and +%%% characters. This is produced by Robert +%%% Solovay's checksum utility.", +%%% } +%%% ==================================================================== +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\documentclass[draft]{article} +\pagestyle{headings} + +\title{Sample Paper for the \pkg{amsmath} Package\\ +File name: \fn{testmath.tex}} +\author{American Mathematical Society} +\date{Version 2.0, 1999/11/15} + +\usepackage{amsmath,amsthm} + +% Some definitions useful in producing this sort of documentation: +\chardef\bslash=`\\ % p. 424, TeXbook +% Normalized (nonbold, nonitalic) tt font, to avoid font +% substitution warning messages if tt is used inside section +% headings and other places where odd font combinations might +% result. +\newcommand{\ntt}{\normalfont\ttfamily} +% command name +\newcommand{\cn}[1]{{\protect\ntt\bslash#1}} +% LaTeX package name +\newcommand{\pkg}[1]{{\protect\ntt#1}} +% File name +\newcommand{\fn}[1]{{\protect\ntt#1}} +% environment name +\newcommand{\env}[1]{{\protect\ntt#1}} +\hfuzz1pc % Don't bother to report overfull boxes if overage is < 1pc + +% Theorem environments + +%% \theoremstyle{plain} %% This is the default +\newtheorem{thm}{Theorem}[section] +\newtheorem{cor}[thm]{Corollary} +\newtheorem{lem}[thm]{Lemma} +\newtheorem{prop}[thm]{Proposition} +\newtheorem{ax}{Axiom} + +\theoremstyle{definition} +\newtheorem{defn}{Definition}[section] + +\theoremstyle{remark} +\newtheorem{rem}{Remark}[section] +\newtheorem*{notation}{Notation} + +%\numberwithin{equation}{section} + +\newcommand{\thmref}[1]{Theorem~\ref{#1}} +\newcommand{\secref}[1]{\S\ref{#1}} +\newcommand{\lemref}[1]{Lemma~\ref{#1}} + +\newcommand{\bysame}{\mbox{\rule{3em}{.4pt}}\,} + +% Math definitions + +\newcommand{\A}{\mathcal{A}} +\newcommand{\B}{\mathcal{B}} +\newcommand{\st}{\sigma} +\newcommand{\XcY}{{(X,Y)}} +\newcommand{\SX}{{S_X}} +\newcommand{\SY}{{S_Y}} +\newcommand{\SXY}{{S_{X,Y}}} +\newcommand{\SXgYy}{{S_{X|Y}(y)}} +\newcommand{\Cw}[1]{{\hat C_#1(X|Y)}} +\newcommand{\G}{{G(X|Y)}} +\newcommand{\PY}{{P_{\mathcal{Y}}}} +\newcommand{\X}{\mathcal{X}} +\newcommand{\wt}{\widetilde} +\newcommand{\wh}{\widehat} + +\DeclareMathOperator{\per}{per} +\DeclareMathOperator{\cov}{cov} +\DeclareMathOperator{\non}{non} +\DeclareMathOperator{\cf}{cf} +\DeclareMathOperator{\add}{add} +\DeclareMathOperator{\Cham}{Cham} +\DeclareMathOperator{\IM}{Im} +\DeclareMathOperator{\esssup}{ess\,sup} +\DeclareMathOperator{\meas}{meas} +\DeclareMathOperator{\seg}{seg} + +% \interval is used to provide better spacing after a [ that +% is used as a closing delimiter. +\newcommand{\interval}[1]{\mathinner{#1}} + +% Notation for an expression evaluated at a particular condition. The +% optional argument can be used to override automatic sizing of the +% right vert bar, e.g. \eval[\biggr]{...}_{...} +\newcommand{\eval}[2][\right]{\relax + \ifx#1\right\relax \left.\fi#2#1\rvert} + +% Enclose the argument in vert-bar delimiters: +\newcommand{\envert}[1]{\left\lvert#1\right\rvert} +\let\abs=\envert + +% Enclose the argument in double-vert-bar delimiters: +\newcommand{\enVert}[1]{\left\lVert#1\right\rVert} +\let\norm=\enVert + +\begin{document} +\maketitle +\markboth{Sample paper for the {\protect\ntt\lowercase{amsmath}} package} +{Sample paper for the {\protect\ntt\lowercase{amsmath}} package} +\renewcommand{\sectionmark}[1]{} + +\section{Introduction} + +This paper contains examples of various features from \AmS-\LaTeX{}. + +\section{Enumeration of Hamiltonian paths in a graph} + +Let $\mathbf{A}=(a_{ij})$ be the adjacency matrix of graph $G$. The +corresponding Kirchhoff matrix $\mathbf{K}=(k_{ij})$ is obtained from +$\mathbf{A}$ by replacing in $-\mathbf{A}$ each diagonal entry by the +degree of its corresponding vertex; i.e., the $i$th diagonal entry is +identified with the degree of the $i$th vertex. It is well known that +\begin{equation} +\det\mathbf{K}(i|i)=\text{ the number of spanning trees of $G$}, +\quad i=1,\dots,n +\end{equation} +where $\mathbf{K}(i|i)$ is the $i$th principal submatrix of +$\mathbf{K}$. +\begin{verbatim} +\det\mathbf{K}(i|i)=\text{ the number of spanning trees of $G$}, +\end{verbatim} + +Let $C_{i(j)}$ be the set of graphs obtained from $G$ by attaching edge +$(v_iv_j)$ to each spanning tree of $G$. Denote by $C_i=\bigcup_j +C_{i(j)}$. It is obvious that the collection of Hamiltonian cycles is a +subset of $C_i$. Note that the cardinality of $C_i$ is $k_{ii}\det +\mathbf{K}(i|i)$. Let $\wh X=\{\hat x_1,\dots,\hat x_n\}$. +\begin{verbatim} +$\wh X=\{\hat x_1,\dots,\hat x_n\}$ +\end{verbatim} +Define multiplication for the elements of $\wh X$ by +\begin{equation}\label{multdef} +\hat x_i\hat x_j=\hat x_j\hat x_i,\quad \hat x^2_i=0,\quad +i,j=1,\dots,n. +\end{equation} +Let $\hat k_{ij}=k_{ij}\hat x_j$ and $\hat k_{ij}=-\sum_{j\not=i} \hat +k_{ij}$. Then the number of Hamiltonian cycles $H_c$ is given by the +relation \cite{liuchow:formalsum} +\begin{equation}\label{H-cycles} +\biggl(\prod^n_{\,j=1}\hat x_j\biggr)H_c=\frac{1}{2}\hat k_{ij}\det +\wh{\mathbf{K}}(i|i),\qquad i=1,\dots,n. +\end{equation} +The task here is to express \eqref{H-cycles} +in a form free of any $\hat x_i$, +$i=1,\dots,n$. The result also leads to the resolution of enumeration of +Hamiltonian paths in a graph. + +It is well known that the enumeration of Hamiltonian cycles and paths in +a complete graph $K_n$ and in a complete bipartite graph $K_{n_1n_2}$ +can only be found from \textit{first combinatorial principles} +\cite{hapa:graphenum}. One wonders if there exists a formula which can +be used very efficiently to produce $K_n$ and $K_{n_1n_2}$. Recently, +using Lagrangian methods, Goulden and Jackson have shown that $H_c$ can +be expressed in terms of the determinant and permanent of the adjacency +matrix \cite{gouja:lagrmeth}. However, the formula of Goulden and +Jackson determines neither $K_n$ nor $K_{n_1n_2}$ effectively. In this +paper, using an algebraic method, we parametrize the adjacency matrix. +The resulting formula also involves the determinant and permanent, but +it can easily be applied to $K_n$ and $K_{n_1n_2}$. In addition, we +eliminate the permanent from $H_c$ and show that $H_c$ can be +represented by a determinantal function of multivariables, each variable +with domain $\{0,1\}$. Furthermore, we show that $H_c$ can be written by +number of spanning trees of subgraphs. Finally, we apply the formulas to +a complete multigraph $K_{n_1\dots n_p}$. + +The conditions $a_{ij}=a_{ji}$, $i,j=1,\dots,n$, are not required in +this paper. All formulas can be extended to a digraph simply by +multiplying $H_c$ by 2. + +\section{Main Theorem} +\label{s:mt} + +\begin{notation} For $p,q\in P$ and $n\in\omega$ we write +$(q,n)\le(p,n)$ if $q\le p$ and $A_{q,n}=A_{p,n}$. +\begin{verbatim} +\begin{notation} For $p,q\in P$ and $n\in\omega$ +... +\end{notation} +\end{verbatim} +\end{notation} + +Let $\mathbf{B}=(b_{ij})$ be an $n\times n$ matrix. Let $\mathbf{n}=\{1, +\dots,n\}$. Using the properties of \eqref{multdef}, it is readily seen +that + +\begin{lem}\label{lem-per} +\begin{equation} +\prod_{i\in\mathbf{n}} +\biggl(\sum_{\,j\in\mathbf{n}}b_{ij}\hat x_i\biggr) +=\biggl(\prod_{\,i\in\mathbf{n}}\hat x_i\biggr)\per \mathbf{B} +\end{equation} +where $\per \mathbf{B}$ is the permanent of $\mathbf{B}$. +\end{lem} + +Let $\wh Y=\{\hat y_1,\dots,\hat y_n\}$. Define multiplication +for the elements of $\wh Y$ by +\begin{equation} +\hat y_i\hat y_j+\hat y_j\hat y_i=0,\quad i,j=1,\dots,n. +\end{equation} +Then, it follows that +\begin{lem}\label{lem-det} +\begin{equation}\label{detprod} +\prod_{i\in\mathbf{n}} +\biggl(\sum_{\,j\in\mathbf{n}}b_{ij}\hat y_j\biggr) +=\biggl(\prod_{\,i\in\mathbf{n}}\hat y_i\biggr)\det\mathbf{B}. +\end{equation} +\end{lem} + +Note that all basic properties of determinants are direct consequences +of Lemma ~\ref{lem-det}. Write +\begin{equation}\label{sum-bij} +\sum_{j\in\mathbf{n}}b_{ij}\hat y_j=\sum_{j\in\mathbf{n}}b^{(\lambda)} +_{ij}\hat y_j+(b_{ii}-\lambda_i)\hat y_i\hat y +\end{equation} +where +\begin{equation} +b^{(\lambda)}_{ii}=\lambda_i,\quad b^{(\lambda)}_{ij}=b_{ij}, +\quad i\not=j. +\end{equation} +Let $\mathbf{B}^{(\lambda)}=(b^{(\lambda)}_{ij})$. By \eqref{detprod} +and \eqref{sum-bij}, it is +straightforward to show the following +result: +\begin{thm}\label{thm-main} +\begin{equation}\label{detB} +\det\mathbf{B}= +\sum^n_{l =0}\sum_{I_l \subseteq n} +\prod_{i\in I_l}(b_{ii}-\lambda_i) +\det\mathbf{B}^{(\lambda)}(I_l |I_l ), +\end{equation} +where $I_l =\{i_1,\dots,i_l \}$ and $\mathbf{B}^{(\lambda)}(I_l |I_l )$ +is the principal submatrix obtained from $\mathbf{B}^{(\lambda)}$ +by deleting its $i_1,\dots,i_l $ rows and columns. +\end{thm} + +\begin{rem} +Let $\mathbf{M}$ be an $n\times n$ matrix. The convention +$\mathbf{M}(\mathbf{n}|\mathbf{n})=1$ has been used in \eqref{detB} and +hereafter. +\end{rem} + +Before proceeding with our discussion, we pause to note that +\thmref{thm-main} yields immediately a fundamental formula which can be +used to compute the coefficients of a characteristic polynomial +\cite{mami:matrixth}: +\begin{cor}\label{BI} +Write $\det(\mathbf{B}-x\mathbf{I})=\sum^n_{l =0}(-1) +^l b_l x^l $. Then +\begin{equation}\label{bl-sum} +b_l =\sum_{I_l \subseteq\mathbf{n}}\det\mathbf{B}(I_l |I_l ). +\end{equation} +\end{cor} +Let +\begin{equation} +\mathbf{K}(t,t_1,\dots,t_n) +=\begin{pmatrix} D_1t&-a_{12}t_2&\dots&-a_{1n}t_n\\ +-a_{21}t_1&D_2t&\dots&-a_{2n}t_n\\ +\hdotsfor[2]{4}\\ +-a_{n1}t_1&-a_{n2}t_2&\dots&D_nt\end{pmatrix}, +\end{equation} +\begin{verbatim} +\begin{pmatrix} D_1t&-a_{12}t_2&\dots&-a_{1n}t_n\\ +-a_{21}t_1&D_2t&\dots&-a_{2n}t_n\\ +\hdotsfor[2]{4}\\ +-a_{n1}t_1&-a_{n2}t_2&\dots&D_nt\end{pmatrix} +\end{verbatim} +where +\begin{equation} +D_i=\sum_{j\in\mathbf{n}}a_{ij}t_j,\quad i=1,\dots,n. +\end{equation} + +Set +\begin{equation*} +D(t_1,\dots,t_n)=\frac{\delta}{\delta t}\eval{\det\mathbf{K}(t,t_1,\dots,t_n) +}_{t=1}. +\end{equation*} +Then +\begin{equation}\label{sum-Di} +D(t_1,\dots,t_n) +=\sum_{i\in\mathbf{n}}D_i\det\mathbf{K}(t=1,t_1,\dots,t_n; i|i), +\end{equation} +where $\mathbf{K}(t=1,t_1,\dots,t_n; i|i)$ is the $i$th principal +submatrix of $\mathbf{K}(t=1,t_1,\dots,t_n)$. + +Theorem ~\ref{thm-main} leads to +\begin{equation}\label{detK1} +\det\mathbf{K}(t_1,t_1,\dots,t_n) +=\sum_{I\in\mathbf{n}}(-1)^{\envert{I}}t^{n-\envert{I}} +\prod_{i\in I}t_i\prod_{j\in I}(D_j+\lambda_jt_j)\det\mathbf{A} +^{(\lambda t)}(\overline{I}|\overline I). +\end{equation} +Note that +\begin{equation}\label{detK2} +\det\mathbf{K}(t=1,t_1,\dots,t_n)=\sum_{I\in\mathbf{n}}(-1)^{\envert{I}} +\prod_{i\in I}t_i\prod_{j\in I}(D_j+\lambda_jt_j)\det\mathbf{A} +^{(\lambda)}(\overline{I}|\overline{I})=0. +\end{equation} + +Let $t_i=\hat x_i,i=1,\dots,n$. Lemma ~\ref{lem-per} yields +\begin{multline} +\biggl(\sum_{\,i\in\mathbf{n}}a_{l _i}x_i\biggr) +\det\mathbf{K}(t=1,x_1,\dots,x_n;l |l )\\ +=\biggl(\prod_{\,i\in\mathbf{n}}\hat x_i\biggr) +\sum_{I\subseteq\mathbf{n}-\{l \}} +(-1)^{\envert{I}}\per\mathbf{A}^{(\lambda)}(I|I) +\det\mathbf{A}^{(\lambda)} +(\overline I\cup\{l \}|\overline I\cup\{l \}). +\label{sum-ali} +\end{multline} +\begin{verbatim} +\begin{multline} +\biggl(\sum_{\,i\in\mathbf{n}}a_{l _i}x_i\biggr) +\det\mathbf{K}(t=1,x_1,\dots,x_n;l |l )\\ +=\biggl(\prod_{\,i\in\mathbf{n}}\hat x_i\biggr) +\sum_{I\subseteq\mathbf{n}-\{l \}} +(-1)^{\envert{I}}\per\mathbf{A}^{(\lambda)}(I|I) +\det\mathbf{A}^{(\lambda)} +(\overline I\cup\{l \}|\overline I\cup\{l \}). +\label{sum-ali} +\end{multline} +\end{verbatim} + +By \eqref{H-cycles}, \eqref{detprod}, and \eqref{sum-bij}, we have +\begin{prop}\label{prop:eg} +\begin{equation} +H_c=\frac1{2n}\sum^n_{l =0}(-1)^{l} +D_{l}, +\end{equation} +where +\begin{equation}\label{delta-l} +D_{l}=\eval[2]{\sum_{I_{l}\subseteq \mathbf{n}} +D(t_1,\dots,t_n)}_{t_i=\left\{\begin{smallmatrix} +0,& \text{if }i\in I_{l}\quad\\% \quad added for centering +1,& \text{otherwise}\end{smallmatrix}\right.\;,\;\; i=1,\dots,n}. +\end{equation} +\end{prop} + +\section{Application} +\label{lincomp} + +We consider here the applications of Theorems~\ref{th-info-ow-ow} and +~\ref{th-weak-ske-owf} to a complete +multipartite graph $K_{n_1\dots n_p}$. It can be shown that the +number of spanning trees of $K_{n_1\dots n_p}$ +may be written +\begin{equation}\label{e:st} +T=n^{p-2}\prod^p_{i=1} +(n-n_i)^{n_i-1} +\end{equation} +where +\begin{equation} +n=n_1+\dots+n_p. +\end{equation} + +It follows from Theorems~\ref{th-info-ow-ow} and +~\ref{th-weak-ske-owf} that +\begin{equation}\label{e:barwq} +\begin{split} +H_c&=\frac1{2n} +\sum^n_{{l}=0}(-1)^{l}(n-{l})^{p-2} +\sum_{l _1+\dots+l _p=l}\prod^p_{i=1} +\binom{n_i}{l _i}\\ +&\quad\cdot[(n-l )-(n_i-l _i)]^{n_i-l _i}\cdot +\biggl[(n-l )^2-\sum^p_{j=1}(n_i-l _i)^2\biggr].\end{split} +\end{equation} +\begin{verbatim} +... \binom{n_i}{l _i}\\ +\end{verbatim} +and +\begin{equation}\label{joe} +\begin{split} +H_c&=\frac12\sum^{n-1}_{l =0} +(-1)^{l}(n-l )^{p-2} +\sum_{l _1+\dots+l _p=l} +\prod^p_{i=1}\binom{n_i}{l _i}\\ +&\quad\cdot[(n-l )-(n_i-l _i)]^{n_i-l _i} +\left(1-\frac{l _p}{n_p}\right) +[(n-l )-(n_p-l _p)]. +\end{split} +\end{equation} + +The enumeration of $H_c$ in a $K_{n_1\dotsm n_p}$ graph can also be +carried out by Theorem ~\ref{thm-H-param} or ~\ref{thm-asym} +together with the algebraic method of \eqref{multdef}. +Some elegant representations may be obtained. For example, $H_c$ in +a $K_{n_1n_2n_3}$ graph may be written +\begin{equation}\label{j:mark} +\begin{split} +H_c=& +\frac{n_1!\,n_2!\,n_3!} +{n_1+n_2+n_3}\sum_i\left[\binom{n_1}{i} +\binom{n_2}{n_3-n_1+i}\binom{n_3}{n_3-n_2+i}\right.\\ +&+\left.\binom{n_1-1}{i} +\binom{n_2-1}{n_3-n_1+i} +\binom{n_3-1}{n_3-n_2+i}\right].\end{split} +\end{equation} + +\section{Secret Key Exchanges} +\label{SKE} + +Modern cryptography is fundamentally concerned with the problem of +secure private communication. A Secret Key Exchange is a protocol +where Alice and Bob, having no secret information in common to start, +are able to agree on a common secret key, conversing over a public +channel. The notion of a Secret Key Exchange protocol was first +introduced in the seminal paper of Diffie and Hellman +\cite{dihe:newdir}. \cite{dihe:newdir} presented a concrete +implementation of a Secret Key Exchange protocol, dependent on a +specific assumption (a variant on the discrete log), specially +tailored to yield Secret Key Exchange. Secret Key Exchange is of +course trivial if trapdoor permutations exist. However, there is no +known implementation based on a weaker general assumption. + +The concept of an informationally one-way function was introduced +in \cite{imlelu:oneway}. We give only an informal definition here: + +\begin{defn} A polynomial time +computable function $f = \{f_k\}$ is informationally +one-way if there is no probabilistic polynomial time algorithm which +(with probability of the form $1 - k^{-e}$ for some $e > 0$) +returns on input $y \in \{0,1\}^{k}$ a random element of $f^{-1}(y)$. +\end{defn} +In the non-uniform setting \cite{imlelu:oneway} show that these are not +weaker than one-way functions: +\begin{thm}[\cite{imlelu:oneway} (non-uniform)] +\label{th-info-ow-ow} +The existence of informationally one-way functions +implies the existence of one-way functions. +\end{thm} +We will stick to the convention introduced above of saying +``non-uniform'' before the theorem statement when the theorem +makes use of non-uniformity. It should be understood that +if nothing is said then the result holds for both the uniform and +the non-uniform models. + +It now follows from \thmref{th-info-ow-ow} that + +\begin{thm}[non-uniform]\label{th-weak-ske-owf} Weak SKE +implies the existence of a one-way function. +\end{thm} + +More recently, the polynomial-time, interior point algorithms for linear +programming have been extended to the case of convex quadratic programs +\cite{moad:quadpro,ye:intalg}, certain linear complementarity problems +\cite{komiyo:lincomp,miyoki:lincomp}, and the nonlinear complementarity +problem \cite{komiyo:unipfunc}. The connection between these algorithms +and the classical Newton method for nonlinear equations is well +explained in \cite{komiyo:lincomp}. + +\section{Review} +\label{computation} + +We begin our discussion with the following definition: + +\begin{defn} + +A function $H\colon \Re^n \to \Re^n$ is said to be +\emph{B-differentiable} at the point $z$ if (i)~$H$ is Lipschitz +continuous in a neighborhood of $z$, and (ii)~ there exists a positive +homogeneous function $BH(z)\colon \Re^n \to \Re^n$, called the +\emph{B-derivative} of $H$ at $z$, such that +\[ \lim_{v \to 0} \frac{H(z+v) - H(z) - BH(z)v}{\enVert{v}} = 0. \] +The function $H$ is \textit{B-differentiable in set $S$} if it is +B-differentiable at every point in $S$. The B-derivative $BH(z)$ is said +to be \textit{strong} if +\[ \lim_{(v,v') \to (0,0)} \frac{H(z+v) - H(z+v') - BH(z)(v + -v')}{\enVert{v - v'}} = 0. \] +\end{defn} + + +\begin{lem}\label{limbog} There exists a smooth function $\psi_0(z)$ +defined for $\abs{z}>1-2a$ satisfying the following properties\textup{:} +\begin{enumerate} +\renewcommand{\labelenumi}{(\roman{enumi})} +\item $\psi_0(z)$ is bounded above and below by positive constants +$c_1\leq \psi_0(z)\leq c_2$. +\item If $\abs{z}>1$, then $\psi_0(z)=1$. +\item For all $z$ in the domain of $\psi_0$, $\Delta_0\ln \psi_0\geq 0$. +\item If $1-2a<\abs{z}<1-a$, then $\Delta_0\ln \psi_0\geq +c_3>0$. +\end{enumerate} +\end{lem} + +\begin{proof} +We choose $\psi_0(z)$ to be a radial function depending only on $r=\abs{z}$. +Let $h(r)\geq 0$ be a suitable smooth function satisfying $h(r)\geq c_3$ +for $1-2a<\abs{z}<1-a$, and $h(r)=0$ for $\abs{z}>1-\tfrac a2$. The radial +Laplacian +\[\Delta_0\ln\psi_0(r)=\left(\frac {d^2}{dr^2}+\frac +1r\frac d{dr}\right)\ln\psi_0(r)\] +has smooth coefficients for $r>1-2a$. Therefore, we may +apply the existence and uniqueness theory for ordinary differential +equations. Simply let $\ln \psi_0(r)$ be the solution of the differential +equation +\[\left(\frac{d^2}{dr^2}+\frac 1r\frac d{dr}\right)\ln \psi_0(r)=h(r)\] +with initial conditions given by $\ln \psi_0(1)=0$ and +$\ln\psi_0'(1)=0$. + +Next, let $D_\nu$ be a finite collection of pairwise disjoint disks, +all of which are contained in the unit disk centered at the origin in +$C$. We assume that $D_\nu=\{z\mid \abs{z-z_\nu}<\delta\}$. Suppose that +$D_\nu(a)$ denotes the smaller concentric disk $D_\nu(a)=\{z\mid +\abs{z-z_\nu}\leq (1-2a)\delta\}$. We define a smooth weight function +$\Phi_0(z)$ for $z\in C-\bigcup_\nu D_\nu(a)$ by setting $\Phi_ +0(z)=1$ when $z\notin \bigcup_\nu D_\nu$ and $\Phi_ +0(z)=\psi_0((z-z_\nu)/\delta)$ when $z$ is an element of $D_\nu$. It +follows from \lemref{limbog} that $\Phi_ 0$ satisfies the properties: +\begin{enumerate} +\renewcommand{\labelenumi}{(\roman{enumi})} +\item \label{boundab}$\Phi_ 0(z)$ is bounded above and below by +positive constants $c_1\leq \Phi_ 0(z)\leq c_2$. +\item \label{d:over}$\Delta_0\ln\Phi_ 0\geq 0$ for all +$z\in C-\bigcup_\nu D_\nu(a)$, +the domain where the function $\Phi_ 0$ is defined. +\item \label{d:ad}$\Delta_0\ln\Phi_ 0\geq c_3\delta^{-2}$ +when $(1-2a)\delta<\abs{z-z_\nu}<(1-a)\delta$. +\end{enumerate} +Let $A_\nu$ denote the annulus $A_\nu=\{(1-2a)\delta<\abs{z-z_\nu}<(1-a) +\delta \}$, and set $A=\bigcup_\nu A_\nu$. The +properties (\ref{d:over}) and (\ref{d:ad}) of $\Phi_ 0$ +may be summarized as $\Delta_0\ln \Phi_ 0\geq c_3\delta^{-2}\chi_A$, +where $\chi _A$ is the characteristic function of $A$. +\end{proof} + +Suppose that $\alpha$ is a nonnegative real constant. We apply +Proposition~\ref{prop:eg} with $\Phi(z)=\Phi_ 0(z) e^{\alpha\abs{z}^2}$. If +$u\in C^\infty_0(R^2-\bigcup_\nu D_\nu(a))$, assume that $\mathcal{D}$ +is a bounded domain containing the support of $u$ and $A\subset +\mathcal{D}\subset R^2-\bigcup_\nu D_\nu(a)$. A calculation gives +\[\int_{\mathcal{D}}\abs{\overline\partial u}^2\Phi_ 0(z) e^{\alpha\abs{z}^2} +\geq c_4\alpha\int_{\mathcal{D}}\abs{u}^2\Phi_ 0e^{\alpha\abs{z}^2} ++c_5\delta^{-2}\int_ A\abs{u}^2\Phi_ 0e^{\alpha\abs{z}^2}.\] + +The boundedness, property (\ref{boundab}) of $\Phi_ 0$, then yields +\[\int_{\mathcal{D}}\abs{\overline\partial u}^2e^{\alpha\abs{z}^2}\geq c_6\alpha +\int_{\mathcal{D}}\abs{u}^2e^{\alpha\abs{z}^2} ++c_7\delta^{-2}\int_ A\abs{u}^2e^{\alpha\abs{z}^2}.\] + +Let $B(X)$ be the set of blocks of $\Lambda_{X}$ +and let $b(X) = \abs{B(X)}$. If $\phi \in Q_{X}$ then +$\phi$ is constant on the blocks of $\Lambda_{X}$. +\begin{equation}\label{far-d} + P_{X} = \{ \phi \in M \mid \Lambda_{\phi} = \Lambda_{X} \}, +\qquad +Q_{X} = \{\phi \in M \mid \Lambda_{\phi} \geq \Lambda_{X} \}. +\end{equation} +If $\Lambda_{\phi} \geq \Lambda_{X}$ then +$\Lambda_{\phi} = \Lambda_{Y}$ for some $Y \geq X$ so that +\[ Q_{X} = \bigcup_{Y \geq X} P_{Y}. \] +Thus by M\"obius inversion +\[ \abs{P_{Y}}= \sum_{X\geq Y} \mu (Y,X)\abs{Q_{X}}.\] +Thus there is a bijection from $Q_{X}$ to $W^{B(X)}$. +In particular $\abs{Q_{X}} = w^{b(X)}$. + +Next note that $b(X)=\dim X$. We see this by choosing a +basis for $X$ consisting of vectors $v^{k}$ defined by +\[v^{k}_{i}= +\begin{cases} 1 & \text{if $i \in \Lambda_{k}$},\\ +0 &\text{otherwise.} \end{cases} +\] +\begin{verbatim} +\[v^{k}_{i}= +\begin{cases} 1 & \text{if $i \in \Lambda_{k}$},\\ +0 &\text{otherwise.} \end{cases} +\] +\end{verbatim} + +\begin{lem}\label{p0201} +Let $\A$ be an arrangement. Then +\[ \chi (\A,t) = \sum_{\B \subseteq \A} +(-1)^{\abs{\B}} t^{\dim T(\B)}. \] +\end{lem} + +In order to compute $R''$ recall the definition +of $S(X,Y)$ from \lemref{lem-per}. Since $H \in \B$, +$\A_{H} \subseteq \B$. Thus if $T(\B) = Y$ then +$\B \in S(H,Y)$. Let $L'' = L(\A'')$. Then +\begin{equation}\label{E_SXgYy} +\begin{split} +R''&= \sum_{H\in \B \subseteq \A} (-1)^{\abs{\B}} +t^{\dim T(\B)}\\ +&= \sum_{Y \in L''} \sum_{\B \in S(H,Y)} +(-1)^{\abs{\B}}t^{\dim Y} \\ +&= -\sum_{Y \in L''} \sum_{\B \in S(H,Y)} (-1)^ +{\abs{\B - \A_{H}}} t^{\dim Y} \\ +&= -\sum_{Y \in L''} \mu (H,Y)t^{\dim Y} \\ +&= -\chi (\A '',t). +\end{split} +\end{equation} + +\begin{cor}\label{tripleA} +Let $(\A,\A',\A'')$ be a triple of arrangements. Then +\[ \pi (\A,t) = \pi (\A',t) + t \pi (\A'',t). \] +\end{cor} + +\begin{defn} +Let $(\A,\A',\A'')$ be a triple with respect to +the hyperplane $H \in \A$. Call $H$ a \textit{separator} +if $T(\A) \not\in L(\A')$. +\end{defn} + +\begin{cor}\label{nsep} +Let $(\A,\A',\A'')$ be a triple with respect to $H \in \A$. +\begin{enumerate} +\renewcommand{\labelenumi}{(\roman{enumi})} +\item +If $H$ is a separator then +\[ \mu (\A) = - \mu (\A'') \] +and hence +\[ \abs{\mu (\A)} = \abs{ \mu (\A'')}. \] + +\item If $H$ is not a separator then +\[\mu (\A) = \mu (\A') - \mu (\A'') \] +and +\[ \abs{\mu (\A)} = \abs{\mu (\A')} + \abs{\mu (\A'')}. \] +\end{enumerate} +\end{cor} + +\begin{proof} +It follows from \thmref{th-info-ow-ow} that $\pi(\A,t)$ +has leading term +\[(-1)^{r(\A)}\mu (\A)t^{r(\A)}.\] +The conclusion +follows by comparing coefficients of the leading +terms on both sides of the equation in +Corollary~\ref{tripleA}. If $H$ is a separator then +$r(\A') < r(\A)$ and there is no contribution +from $\pi (\A',t)$. +\end{proof} + +The Poincar\'e polynomial of an arrangement +will appear repeatedly +in these notes. It will be shown to equal the +Poincar\'e polynomial +of the graded algebras which we are going to +associate with $\A$. It is also the Poincar\'e +polynomial of the complement $M(\A)$ for a +complex arrangement. Here we prove +that the Poincar\'e polynomial is the chamber +counting function for a real arrangement. The +complement $M(\A)$ is a disjoint union of chambers +\[M(\A) = \bigcup_{C \in \Cham(\A)} C.\] +The number +of chambers is determined by the Poincar\'e +polynomial as follows. + +\begin{thm}\label{th-realarr} +Let $\A_{\mathbf{R}}$ be a real arrangement. Then +\[ \abs{\Cham(\A_{\mathbf{R}})} = \pi (\A_{\mathbf{R}},1). \] +\end{thm} + +\begin{proof} +We check the properties required in Corollary~\ref{nsep}: +(i) follows from $\pi (\Phi_{ l},t) = 1$, and (ii) is a +consequence of Corollary~\ref{BI}. +\end{proof} + +\begin{figure} +\vspace{5cm} +\caption[]{$Q(\A_{1}) = xyz(x-z)(x+z)(y-z)(y+z)$} +\end{figure} + +\begin{figure} +\vspace{5cm} +\caption[]{$Q(\A_{2})= xyz(x+y+z)(x+y-z)(x-y+z)(x-y-z)$} +\end{figure} + + +\begin{thm} +\label{T_first_the_int} +Let $\phi$ be a protocol for a random pair $\XcY$. +If one of $\st_\phi(x',y)$ and $\st_\phi(x,y')$ is a prefix of the other +and $(x,y)\in\SXY$, then +\[ +\langle \st_j(x',y)\rangle_{j=1}^\infty +=\langle \st_j(x,y)\rangle_{j=1}^\infty +=\langle \st_j(x,y')\rangle_{j=1}^\infty . +\] +\end{thm} +\begin{proof} +We show by induction on $i$ that +\[ +\langle \st_j(x',y)\rangle_{j=1}^i +=\langle \st_j(x,y)\rangle_{j=1}^i +=\langle \st_j(x,y')\rangle_{j=1}^i. +\] +The induction hypothesis holds vacuously for $i=0$. Assume it holds for +$i-1$, in particular +$[\st_j(x',y)]_{j=1}^{i-1}=[\st_j(x,y')]_{j=1}^{i-1}$. Then one of +$[\st_j(x',y)]_{j=i}^{\infty}$ and $[\st_j(x,y')]_{j=i}^{\infty}$ is a +prefix of the other which implies that one of $\st_i(x',y)$ and +$\st_i(x,y')$ is a prefix of the other. If the $i$th message is +transmitted by $P_\X$ then, by the separate-transmissions property and +the induction hypothesis, $\st_i(x,y)=\st_i(x,y')$, hence one of +$\st_i(x,y)$ and $\st_i(x',y)$ is a prefix of the other. By the +implicit-termination property, neither $\st_i(x,y)$ nor $\st_i(x',y)$ +can be a proper prefix of the other, hence they must be the same and +$\st_i(x',y)=\st_i(x,y)=\st_i(x,y')$. If the $i$th message is +transmitted by $\PY$ then, symmetrically, $\st_i(x,y)=\st_i(x',y)$ by +the induction hypothesis and the separate-transmissions property, and, +then, $\st_i(x,y)=\st_i(x,y')$ by the implicit-termination property, +proving the induction step. +\end{proof} + +If $\phi$ is a protocol for $(X,Y)$, and $(x,y)$, $(x',y)$ are distinct +inputs in $\SXY$, then, by the correct-decision property, +$\langle\st_j(x,y)\rangle_{j=1}^\infty\ne\langle +\st_j(x',y)\rangle_{j=1}^\infty$. + +Equation~(\ref{E_SXgYy}) defined $\PY$'s ambiguity set $\SXgYy$ +to be the set of possible $X$ values when $Y=y$. +The last corollary implies that for all $y\in\SY$, +the multiset% +\footnote{A multiset allows multiplicity of elements. +Hence, $\{0,01,01\}$ is prefix free as a set, but not as a multiset.} +of codewords $\{\st_\phi(x,y):x\in\SXgYy\}$ is prefix free. + +\section{One-Way Complexity} +\label{S_Cp1} + +$\Cw1$, the one-way complexity of a random pair $\XcY$, +is the number of bits $P_\X$ must transmit in the worst case +when $\PY$ is not permitted to transmit any feedback messages. +Starting with $\SXY$, the support set of $\XcY$, we define $\G$, +the \textit{characteristic hypergraph} of $\XcY$, and show that +\[ +\Cw1=\lceil\,\log\chi(\G)\rceil\ . +\] + +Let $\XcY$ be a random pair. For each $y$ in $\SY$, the support set of +$Y$, Equation~(\ref{E_SXgYy}) defined $\SXgYy$ to be the set of possible +$x$ values when $Y=y$. The \textit{characteristic hypergraph} $\G$ of +$\XcY$ has $\SX$ as its vertex set and the hyperedge $\SXgYy$ for each +$y\in\SY$. + + +We can now prove a continuity theorem. +\begin{thm}\label{t:conl} +Let $\Omega \subset\mathbf{R}^n$ be an open set, let +$u\in BV(\Omega ;\mathbf{R}^m)$, and let +\begin{equation}\label{quts} +T^u_x=\left\{y\in\mathbf{R}^m: + y=\tilde u(x)+\left\langle \frac{Du}{\abs{Du}}(x),z +\right\rangle \text{ for some }z\in\mathbf{R}^n\right\} +\end{equation} +for every $x\in\Omega \backslash S_u$. Let $f\colon \mathbf{R}^m\to +\mathbf{R}^k$ be a Lipschitz continuous function such that $f(0)=0$, and +let $v=f(u)\colon \Omega \to \mathbf{R}^k$. Then $v\in BV(\Omega +;\mathbf{R}^k)$ and +\begin{equation} +Jv=\eval{(f(u^+)-f(u^-))\otimes \nu_u\cdot\, +\mathcal{H}_{n-1}}_{S_u}. +\end{equation} +In addition, for $\abs{\wt{D}u}$-almost every $x\in\Omega $ the +restriction of the function $f$ to $T^u_x$ is differentiable at $\tilde +u(x)$ and +\begin{equation} +\wt{D}v=\nabla (\eval{f}_{T^u_x})(\tilde u) +\frac{\wt{D}u}{\abs{\wt{D}u}}\cdot\abs{\wt{D}u}.\end{equation} +\end{thm} + +Before proving the theorem, we state without proof three elementary +remarks which will be useful in the sequel. +\begin{rem}\label{r:omb} +Let $\omega\colon \left]0,+\infty\right[\to \left]0,+\infty\right[$ +be a continuous function such that $\omega (t)\to 0$ as $t\to +0$. Then +\[\lim_{h\to 0^+}g(\omega(h))=L\Leftrightarrow\lim_{h\to +0^+}g(h)=L\] +for any function $g\colon \left]0,+\infty\right[\to \mathbf{R}$. +\end{rem} +\begin{rem}\label{r:dif} +Let $g \colon \mathbf{R}^n\to \mathbf{R}$ be a Lipschitz +continuous function and assume that +\[L(z)=\lim_{h\to 0^+}\frac{g(hz)-g(0)}h\] +exists for every $z\in\mathbf{Q}^n$ and that $L$ is a linear function of +$z$. Then $g$ is differentiable at 0. +\end{rem} +\begin{rem}\label{r:dif0} +Let $A \colon \mathbf{R}^n\to \mathbf{R}^m$ be a linear function, and +let $f \colon \mathbf{R}^m\to \mathbf{R}$ be a function. Then the +restriction of $f$ to the range of $A$ is differentiable at 0 if and +only if $f(A)\colon \mathbf{R}^n\to \mathbf{R}$ is differentiable at 0 +and +\[\nabla(\eval{f}_{\IM(A)})(0)A=\nabla (f(A))(0).\] +\end{rem} + +\begin{proof} + We begin by showing that $v\in BV(\Omega;\mathbf{R}^k)$ and +\begin{equation}\label{e:bomb} +\abs{Dv}(B)\le K\abs{Du}(B)\qquad\forall B\in\mathbf{B}(\Omega ), +\end{equation} +where $K>0$ is the Lipschitz constant of $f$. By \eqref{sum-Di} and by +the approximation result quoted in \secref{s:mt}, it is possible to find +a sequence $(u_h)\subset C^1(\Omega ;\mathbf{R}^m)$ converging to $u$ in +$L^1(\Omega ;\mathbf{R}^m)$ and such that +\[\lim_{h\to +\infty}\int_\Omega \abs{\nabla u_h}\,dx=\abs{Du}(\Omega ).\] +The functions $v_h=f(u_h)$ are locally Lipschitz continuous in $\Omega +$, and the definition of differential implies that $\abs{\nabla v_h}\le +K\abs{\nabla u_h}$ almost everywhere in $\Omega $. The lower semicontinuity +of the total variation and \eqref{sum-Di} yield +\begin{equation} +\begin{split} +\abs{Dv}(\Omega )\le\liminf_{h\to +\infty}\abs{Dv_h}(\Omega) & +=\liminf_{h\to +\infty}\int_\Omega \abs{\nabla v_h}\,dx\\ +&\le K\liminf_{h\to +\infty}\int_\Omega +\abs{\nabla u_h}\,dx=K\abs{Du}(\Omega). +\end{split}\end{equation} +Since $f(0)=0$, we have also +\[\int_\Omega \abs{v}\,dx\le K\int_\Omega \abs{u}\,dx;\] +therefore $u\in BV(\Omega ;\mathbf{R}^k)$. Repeating the same argument +for every open set $A\subset\Omega $, we get \eqref{e:bomb} for every +$B\in\mathbf{B}(\Omega)$, because $\abs{Dv}$, $\abs{Du}$ are Radon measures. To +prove \lemref{limbog}, first we observe that +\begin{equation}\label{e:SS} +S_v\subset S_u,\qquad\tilde v(x)=f(\tilde u(x))\qquad \forall x\in\Omega +\backslash S_u.\end{equation} +In fact, for every $\varepsilon >0$ we have +\[\{y\in B_\rho(x): \abs{v(y)-f(\tilde u(x))}>\varepsilon \}\subset \{y\in +B_\rho(x): \abs{u(y)-\tilde u(x)}>\varepsilon /K\},\] +hence +\[\lim_{\rho\to 0^+}\frac{\abs{\{y\in B_\rho(x): \abs{v(y)-f(\tilde u(x))}> +\varepsilon \}}}{\rho^n}=0\] +whenever $x\in\Omega \backslash S_u$. By a similar argument, if $x\in +S_u$ is a point such that there exists a triplet $(u^+,u^-,\nu_u)$ +satisfying \eqref{detK1}, \eqref{detK2}, then +\[ +(v^+(x)-v^-(x))\otimes \nu_v=(f(u^+(x))-f(u^-(x)))\otimes\nu_u\quad +\text{if }x\in S_v +\] +and $f(u^-(x))=f(u^+(x))$ if $x\in S_u\backslash S_v$. Hence, by (1.8) +we get +\begin{equation*}\begin{split} +Jv(B)=\int_{B\cap S_v}(v^+-v^-)\otimes \nu_v\,d\mathcal{H}_{n-1}&= +\int_{B\cap S_v}(f(u^+)-f(u^-))\otimes \nu_u\,d\mathcal{H}_{n-1}\\ +&=\int_{B\cap S_u}(f(u^+)-f(u^-))\otimes \nu_u\,d\mathcal{H}_{n-1} +\end{split}\end{equation*} +and \lemref{limbog} is proved. +\end{proof} + +To prove \eqref{e:SS}, it is not restrictive to assume that $k=1$. +Moreover, to simplify our notation, from now on we shall assume that +$\Omega = \mathbf{R}^n$. The proof of \eqref{e:SS} is divided into two +steps. In the first step we prove the statement in the one-dimensional +case $(n=1)$, using \thmref{th-weak-ske-owf}. In the second step we +achieve the general result using \thmref{t:conl}. + +\subsection*{Step 1} +Assume that $n=1$. Since $S_u$ is at most countable, \eqref{sum-bij} +yields that $\abs{\wt{D}v}(S_u\backslash S_v)=0$, so that +\eqref{e:st} and \eqref{e:barwq} imply that $Dv=\wt{D}v+Jv$ is +the Radon-Nikod\'ym decomposition of $Dv$ in absolutely continuous and +singular part with respect to $\abs{\wt{D} u}$. By +\thmref{th-weak-ske-owf}, we have +\begin{equation*} +\frac{\wt{D}v}{\abs{\wt{D}u}}(t)=\lim_{s\to t^+} +\frac{Dv(\interval{\left[t,s\right[})} +{\abs{\wt{D}u}(\interval{\left[t,s\right[})},\qquad +\frac{\wt{D}u}{\abs{\wt{D}u}}(t)=\lim_{s\to t^+} +\frac{Du(\interval{\left[t,s\right[})} +{\abs{\wt{D}u}(\interval{\left[t,s\right[})} +\end{equation*} +$\abs{\wt{D}u}$-almost everywhere in $\mathbf{R}$. It is well known +(see, for instance, \cite[2.5.16]{ste:sint}) that every one-dimensional +function of bounded variation $w$ has a unique left continuous +representative, i.e., a function $\hat w$ such that $\hat w=w$ almost +everywhere and $\lim_{s\to t^-}\hat w(s)=\hat w(t)$ for every $t\in +\mathbf{R}$. These conditions imply +\begin{equation} +\hat u(t)=Du(\interval{\left]-\infty,t\right[}), +\qquad \hat v(t)=Dv(\interval{\left]-\infty,t\right[})\qquad +\forall t\in\mathbf{R} +\end{equation} +and +\begin{equation}\label{alimo} +\hat v(t)=f(\hat u(t))\qquad\forall t\in\mathbf{R}.\end{equation} +Let $t\in\mathbf{R}$ be such that +$\abs{\wt{D}u}(\interval{\left[t,s\right[})>0$ for every $s>t$ and +assume that the limits in \eqref{joe} exist. By \eqref{j:mark} and +\eqref{far-d} we get +\begin{equation*}\begin{split} +\frac{\hat v(s)-\hat +v(t)}{\abs{\wt{D}u}(\interval{\left[t,s\right[})}&=\frac {f(\hat +u(s))-f(\hat u(t))}{\abs{\wt{D}u}(\interval{\left[t,s\right[})}\\ +&=\frac{f(\hat u(s))-f(\hat +u(t)+\dfrac{\wt{D}u}{\abs{\wt{D}u}}(t)\abs{\wt{D}u +}(\interval{\left[t,s\right[}))}% +{\abs{\wt{D}u}(\interval{\left[t,s\right[})}\\ +&+\frac +{f(\hat u(t)+\dfrac{\wt{D}u}{\abs{\wt{D}u}}(t)\abs{\wt{D} +u}(\interval{\left[t,s\right[}))-f(\hat +u(t))}{\abs{\wt{D}u}(\interval{\left[t,s\right[})} +\end{split}\end{equation*} +for every $s>t$. Using the Lipschitz condition on $f$ we find +{\setlength{\multlinegap}{0pt} +\begin{multline*} +\left\lvert\frac{\hat v(s)-\hat +v(t)}{\abs{\wt{D}u}(\interval{\left[t,s\right[})} -\frac{f(\hat +u(t)+\dfrac{\wt{D}u}{\abs{\wt{D}u}}(t) +\abs{\wt{D}u}(\interval{\left[t,s\right[}))-f(\hat +u(t))}{\abs{\wt{D}u}(\interval{\left[t,s\right[})}\right\rvert\\ +\le K\left\lvert +\frac{\hat u(s)-\hat u(t)} + {\abs{\wt{D}u}(\interval{\left[t,s\right[})} +-\frac{\wt{D}u}{\abs{ +\wt{D}u}}(t)\right\rvert.\end{multline*} +}% end of group with \multlinegap=0pt +By \eqref{e:bomb}, the function $s\to +\abs{\wt{D}u}(\interval{\left[t,s\right[})$ is continuous and +converges to 0 as $s\downarrow t$. Therefore Remark~\ref{r:omb} and the +previous inequality imply +\[\frac{\wt{D}v}{\abs{\wt{D}u}}(t)=\lim_{h\to 0^+} +\frac{f(\hat u(t)+h\dfrac{\wt{D}u}{\abs{\wt{D}u}} +(t))-f(\hat u(t))}h\quad\abs{\wt{D}u}\text{-a.e. in }\mathbf{R}.\] +By \eqref{joe}, $\hat u(x)=\tilde u(x)$ for every +$x\in\mathbf{R}\backslash S_u$; moreover, applying the same argument to +the functions $u'(t)=u(-t)$, $v'(t)=f(u'(t))=v(-t)$, we get +\[\frac{\wt{D}v}{\abs{\wt{D}u}}(t)=\lim_{h\to 0} +\frac{f(\tilde u(t) ++h\dfrac{\wt{D}u}{\abs{\wt{D}u}}(t))-f(\tilde u(t))}{h} +\qquad\abs{\wt{D}u}\text{-a.e. in }\mathbf{R}\] +and our statement is proved. + +\subsection*{Step 2} + +Let us consider now the general case $n>1$. Let $\nu\in \mathbf{R}^n$ be +such that $\abs{\nu}=1$, and let $\pi_\nu=\{y\in\mathbf{R}^n: \langle +y,\nu\rangle =0\}$. In the following, we shall identify $\mathbf{R}^n$ +with $\pi_\nu\times\mathbf{R}$, and we shall denote by $y$ the variable +ranging in $\pi_\nu$ and by $t$ the variable ranging in $\mathbf{R}$. By +the just proven one-dimensional result, and by \thmref{thm-main}, we get +\[\lim_{h\to 0}\frac{f(\tilde u(y+t\nu)+h\dfrac{\wt{D}u_y}{\abs{ +\wt{D}u_y}}(t))-f(\tilde u(y+t\nu))}h=\frac{\wt{D}v_y}{\abs{ +\wt{D}u_y}}(t)\qquad\abs{\wt{D}u_y}\text{-a.e. in }\mathbf{R}\] +for $\mathcal{H}_{n-1}$-almost every $y\in \pi_\nu$. We claim that +\begin{equation} +\frac{\langle \wt{D}u,\nu\rangle }{\abs{\langle \wt{D}u,\nu\rangle +}}(y+t\nu)=\frac{\wt{D}u_y} +{\abs{\wt{D}u_y}}(t)\qquad\abs{\wt{D}u_y}\text{-a.e. in }\mathbf{R} +\end{equation} +for $\mathcal{H}_{n-1}$-almost every $y\in\pi_\nu$. In fact, by +\eqref{sum-ali} and \eqref{delta-l} we get +\begin{multline*} +\int_{\pi_\nu}\frac{\wt{D}u_y}{\abs{\wt{D}u_y}}\cdot\abs{\wt{D}u_y +}\,d\mathcal{H}_{n-1}(y)=\int_{\pi_\nu}\wt{D}u_y\,d\mathcal{H}_{n-1}(y)\\ +=\langle \wt{D}u,\nu\rangle =\frac +{\langle \wt{D}u,\nu\rangle }{\abs{\langle \wt{D}u,\nu\rangle}}\cdot +\abs{\langle \wt{D}u,\nu\rangle }=\int_{\pi_\nu}\frac{ +\langle \wt{D}u,\nu\rangle }{\abs{\langle \wt{D}u,\nu\rangle }} +(y+\cdot \nu)\cdot\abs{\wt{D}u_y}\,d\mathcal{H}_{n-1}(y) +\end{multline*} +and \eqref{far-d} follows from \eqref{sum-Di}. By the same argument it +is possible to prove that +\begin{equation} +\frac{\langle \wt{D}v,\nu\rangle }{\abs{\langle \wt{D}u,\nu\rangle +}}(y+t\nu)=\frac{\wt{D}v_y}{\abs{\wt{D}u_y}}(t)\qquad\abs{ +\wt{D}u_y}\text{-a.e. in }\mathbf{R}\end{equation} +for $\mathcal{H}_{n-1}$-almost every $y\in \pi_\nu$. By \eqref{far-d} +and \eqref{E_SXgYy} we get +\[ +\lim_{h\to 0}\frac{f(\tilde u(y+t\nu)+h\dfrac{\langle \wt{D} +u,\nu\rangle }{\abs{\langle \wt{D}u,\nu\rangle }}(y+t\nu))-f(\tilde +u(y+t\nu))}{h} +=\frac{\langle \wt{D}v,\nu\rangle }{\abs{\langle +\wt{D}u,\nu\rangle }}(y+t\nu)\] +for $\mathcal{H}_{n-1}$-almost every $y\in\pi_\nu$, and using again +\eqref{detK1}, \eqref{detK2} we get +\[ +\lim_{h\to 0}\frac{f(\tilde u(x)+h\dfrac{\langle +\wt{D}u,\nu\rangle }{\abs{\langle \wt{D}u,\nu\rangle }}(x))-f(\tilde +u(x))}{h}=\frac{\langle \wt{D}v,\nu\rangle }{\abs{\langle \wt{D}u,\nu +\rangle }}(x) +\] +$\abs{\langle \wt{D}u,\nu\rangle}$-a.e. in $\mathbf{R}^n$. + +Since the function $\abs{\langle \wt{D}u,\nu\rangle }/\abs{\wt{D}u}$ +is strictly positive $\abs{\langle \wt{D}u,\nu\rangle }$-almost everywhere, +we obtain also +\begin{multline*} +\lim_{h\to 0}\frac{f(\tilde u(x)+h\dfrac{\abs{\langle +\wt{D}u,\nu\rangle }}{\abs{\wt{D}u}}(x)\dfrac{\langle \wt{D} +u,\nu\rangle }{\abs{\langle \wt{D}u,\nu\rangle }}(x))-f(\tilde u(x))}{h}\\ +=\frac{\abs{\langle \wt{D}u,\nu\rangle }}{\abs{\wt{D}u}}(x)\frac +{\langle \wt{D}v,\nu\rangle }{\abs{\langle +\wt{D}u,\nu\rangle }}(x) +\end{multline*} +$\abs{\langle \wt{D}u,\nu\rangle }$-almost everywhere in $\mathbf{R}^n$. + +Finally, since +\begin{align*} +&\frac{\abs{\langle \wt{D}u,\nu\rangle }}{\abs{\wt{D}u}} +\frac{\langle \wt{D}u,\nu\rangle }{\abs{\langle \wt{D}u,\nu\rangle}} +=\frac{\langle \wt{D}u,\nu\rangle }{\abs{\wt{D}u}} +=\left\langle \frac{\wt{D}u}{\abs{\wt{D}u}},\nu\right\rangle + \qquad\abs{\wt{D}u}\text{-a.e. in }\mathbf{R}^n\\ +&\frac{\abs{\langle \wt{D}u,\nu\rangle }}{\abs{\wt{D}u}} +\frac{\langle \wt{D}v,\nu\rangle }{\abs{\langle \wt{D}u,\nu\rangle}} +=\frac{\langle \wt{D}v,\nu\rangle }{\abs{\wt{D}u}} +=\left\langle \frac{\wt{D}v}{\abs{\wt{D}u}},\nu\right\rangle + \qquad\abs{\wt{D}u}\text{-a.e. in }\mathbf{R}^n +\end{align*} +and since both sides of \eqref{alimo} +are zero $\abs{\wt{D}u}$-almost everywhere +on $\abs{\langle \wt{D}u,\nu\rangle }$-negligible sets, we conclude that +\[ +\lim_{h\to 0}\frac{f\left( +\tilde u(x)+h\left\langle \dfrac{\wt{D} +u}{\abs{\wt{D}u}}(x),\nu\right\rangle \right)-f(\tilde u(x))}h +=\left\langle \frac{\wt{D}v}{\abs{\wt{D}u}}(x),\nu\right\rangle, +\] +$\abs{\wt{D}u}$-a.e. in $\mathbf{R}^n$. +Since $\nu$ is arbitrary, by Remarks \ref{r:dif} and~\ref{r:dif0} +the restriction of $f$ to +the affine space $T^u_x$ is differentiable at $\tilde u(x)$ for $\abs{\wt{D} +u}$-almost every $x\in \mathbf{R}^n$ and \eqref{quts} holds.\qed + +It follows from \eqref{sum-Di}, \eqref{detK1}, and \eqref{detK2} that +\begin{equation}\label{Dt} +D(t_1,\dots,t_n)=\sum_{I\in\mathbf{n}}(-1)^{\abs{I}-1}\abs{I} +\prod_{i\in I}t_i\prod_{j\in I}(D_j+\lambda_jt_j)\det\mathbf{A}^{(\lambda)} +(\overline I|\overline I). +\end{equation} +Let $t_i=\hat x_i$, $i=1,\dots,n$. Lemma 1 leads to +\begin{equation}\label{Dx} +D(\hat x_1,\dots,\hat x_n)=\prod_{i\in\mathbf{n}}\hat x_i +\sum_{I\in\mathbf{n}}(-1)^{\abs{I}-1}\abs{I}\per \mathbf{A} +^{(\lambda)}(I|I)\det\mathbf{A}^{(\lambda)}(\overline I|\overline I). +\end{equation} +By \eqref{H-cycles}, \eqref{sum-Di}, and \eqref{Dx}, +we have the following result: +\begin{thm}\label{thm-H-param} +\begin{equation}\label{H-param} +H_c=\frac{1}{2n}\sum^n_{l =1}l (-1)^{l -1}A_{l} +^{(\lambda)}, +\end{equation} +where +\begin{equation}\label{A-l-lambda} +A^{(\lambda)}_l =\sum_{I_l \subseteq\mathbf{n}}\per \mathbf{A} +^{(\lambda)}(I_l |I_l )\det\mathbf{A}^{(\lambda)} +(\overline I_{l}|\overline I_l ),\abs{I_{l}}=l . +\end{equation} +\end{thm} + +It is worth noting that $A_l ^{(\lambda)}$ of \eqref{A-l-lambda} is +similar to the coefficients $b_l $ of the characteristic polynomial of +\eqref{bl-sum}. It is well known in graph theory that the coefficients +$b_l $ can be expressed as a sum over certain subgraphs. It is +interesting to see whether $A_l $, $\lambda=0$, structural properties +of a graph. + +We may call \eqref{H-param} a parametric representation of $H_c$. In +computation, the parameter $\lambda_i$ plays very important roles. The +choice of the parameter usually depends on the properties of the given +graph. For a complete graph $K_n$, let $\lambda_i=1$, $i=1,\dots,n$. +It follows from \eqref{A-l-lambda} that +\begin{equation}\label{compl-gr} +A^{(1)}_l =\begin{cases} n!,&\text{if }l =1\\ +0,&\text{otherwise}.\end{cases} +\end{equation} +By \eqref{H-param} +\begin{equation} +H_c=\frac 12(n-1)!. +\end{equation} +For a complete bipartite graph $K_{n_1n_2}$, let $\lambda_i=0$, $i=1,\dots,n$. +By \eqref{A-l-lambda}, +\begin{equation} +A_l = +\begin{cases} -n_1!n_2!\delta_{n_1n_2},&\text{if }l =2\\ +0,&\text{otherwise }.\end{cases} +\label{compl-bip-gr} +\end{equation} +Theorem ~\ref{thm-H-param} +leads to +\begin{equation} +H_c=\frac1{n_1+n_2}n_1!n_2!\delta_{n_1n_2}. +\end{equation} + +Now, we consider an asymmetrical approach. Theorem \ref{thm-main} leads to +\begin{multline} +\det\mathbf{K}(t=1,t_1,\dots,t_n;l |l )\\ +=\sum_{I\subseteq\mathbf{n}-\{l \}} +(-1)^{\abs{I}}\prod_{i\in I}t_i\prod_{j\in I} +(D_j+\lambda_jt_j)\det\mathbf{A}^{(\lambda)} +(\overline I\cup\{l \}|\overline I\cup\{l \}). +\end{multline} + +By \eqref{H-cycles} and \eqref{sum-ali} we have the following asymmetrical +result: +\begin{thm}\label{thm-asym} +\begin{equation} +H_c=\frac12\sum_{I\subseteq\mathbf{n}-\{l \}} +(-1)^{\abs{I}}\per\mathbf{A}^{(\lambda)}(I|I)\det +\mathbf{A}^{(\lambda)} +(\overline I\cup\{l \}|\overline I\cup\{l \}) +\end{equation} +which reduces to Goulden--Jackson's formula when $\lambda_i=0,i=1,\dots,n$ +\cite{mami:matrixth}. +\end{thm} + +\section{Various font features of the \pkg{amsmath} package} +\label{s:font} +\subsection{Bold versions of special symbols} + +In the \pkg{amsmath} package \cn{boldsymbol} is used for getting +individual bold math symbols and bold Greek letters---everything in +math except for letters of the Latin alphabet, +where you'd use \cn{mathbf}. For example, +\begin{verbatim} +A_\infty + \pi A_0 \sim +\mathbf{A}_{\boldsymbol{\infty}} \boldsymbol{+} +\boldsymbol{\pi} \mathbf{A}_{\boldsymbol{0}} +\end{verbatim} +looks like this: +\[A_\infty + \pi A_0 \sim \mathbf{A}_{\boldsymbol{\infty}} +\boldsymbol{+} \boldsymbol{\pi} \mathbf{A}_{\boldsymbol{0}}\] + +\subsection{``Poor man's bold''} +If a bold version of a particular symbol doesn't exist in the +available fonts, +then \cn{boldsymbol} can't be used to make that symbol bold. +At the present time, this means that +\cn{boldsymbol} can't be used with symbols from +the \fn{msam} and \fn{msbm} fonts, among others. +In some cases, poor man's bold (\cn{pmb}) can be used instead +of \cn{boldsymbol}: +% Can't show example from msam or msbm because this document is +% supposed to be TeXable even if the user doesn't have +% AMSFonts. MJD 5-JUL-1990 +\[\frac{\partial x}{\partial y} +\pmb{\bigg\vert} +\frac{\partial y}{\partial z}\] +\begin{verbatim} +\[\frac{\partial x}{\partial y} +\pmb{\bigg\vert} +\frac{\partial y}{\partial z}\] +\end{verbatim} +So-called ``large operator'' symbols such as $\sum$ and $\prod$ +require an additional command, \cn{mathop}, +to produce proper spacing and limits when \cn{pmb} is used. +For further details see \textit{The \TeX book}. +\[\sum_{\substack{i<B\\\text{$i$ odd}}} +\prod_\kappa \kappa F(r_i)\qquad +\mathop{\pmb{\sum}}_{\substack{i<B\\\text{$i$ odd}}} +\mathop{\pmb{\prod}}_\kappa \kappa(r_i) +\] +\begin{verbatim} +\[\sum_{\substack{i<B\\\text{$i$ odd}}} +\prod_\kappa \kappa F(r_i)\qquad +\mathop{\pmb{\sum}}_{\substack{i<B\\\text{$i$ odd}}} +\mathop{\pmb{\prod}}_\kappa \kappa(r_i) +\] +\end{verbatim} + +\section{Compound symbols and other features} +\label{s:comp} +\subsection{Multiple integral signs} + +\cn{iint}, \cn{iiint}, and \cn{iiiint} give multiple integral signs +with the spacing between them nicely adjusted, in both text and +display style. \cn{idotsint} gives two integral signs with dots +between them. +\begin{gather} +\iint\limits_A f(x,y)\,dx\,dy\qquad\iiint\limits_A +f(x,y,z)\,dx\,dy\,dz\\ +\iiiint\limits_A +f(w,x,y,z)\,dw\,dx\,dy\,dz\qquad\idotsint\limits_A f(x_1,\dots,x_k) +\end{gather} + +\subsection{Over and under arrows} + +Some extra over and under arrow operations are provided in +the \pkg{amsmath} package. (Basic \LaTeX\ provides +\cn{overrightarrow} and \cn{overleftarrow}). +\begin{align*} +\overrightarrow{\psi_\delta(t) E_t h}& +=\underrightarrow{\psi_\delta(t) E_t h}\\ +\overleftarrow{\psi_\delta(t) E_t h}& +=\underleftarrow{\psi_\delta(t) E_t h}\\ +\overleftrightarrow{\psi_\delta(t) E_t h}& +=\underleftrightarrow{\psi_\delta(t) E_t h} +\end{align*} +\begin{verbatim} +\begin{align*} +\overrightarrow{\psi_\delta(t) E_t h}& +=\underrightarrow{\psi_\delta(t) E_t h}\\ +\overleftarrow{\psi_\delta(t) E_t h}& +=\underleftarrow{\psi_\delta(t) E_t h}\\ +\overleftrightarrow{\psi_\delta(t) E_t h}& +=\underleftrightarrow{\psi_\delta(t) E_t h} +\end{align*} +\end{verbatim} +These all scale properly in subscript sizes: +\[\int_{\overrightarrow{AB}} ax\,dx\] +\begin{verbatim} +\[\int_{\overrightarrow{AB}} ax\,dx\] +\end{verbatim} + +\subsection{Dots} + +Normally you need only type \cn{dots} for ellipsis dots in a +math formula. The main exception is when the dots +fall at the end of the formula; then you need to +specify one of \cn{dotsc} (series dots, after a comma), +\cn{dotsb} (binary dots, for binary relations or operators), +\cn{dotsm} (multiplication dots), or \cn{dotsi} (dots after +an integral). For example, the input +\begin{verbatim} +Then we have the series $A_1,A_2,\dotsc$, +the regional sum $A_1+A_2+\dotsb$, +the orthogonal product $A_1A_2\dotsm$, +and the infinite integral +\[\int_{A_1}\int_{A_2}\dotsi\]. +\end{verbatim} +produces +\begin{quotation} +Then we have the series $A_1,A_2,\dotsc$, +the regional sum $A_1+A_2+\dotsb$, +the orthogonal product $A_1A_2\dotsm$, +and the infinite integral +\[\int_{A_1}\int_{A_2}\dotsi\] +\end{quotation} + +\subsection{Accents in math} + +Double accents: +\[\Hat{\Hat{H}}\quad\Check{\Check{C}}\quad +\Tilde{\Tilde{T}}\quad\Acute{\Acute{A}}\quad +\Grave{\Grave{G}}\quad\Dot{\Dot{D}}\quad +\Ddot{\Ddot{D}}\quad\Breve{\Breve{B}}\quad +\Bar{\Bar{B}}\quad\Vec{\Vec{V}}\] +\begin{verbatim} +\[\Hat{\Hat{H}}\quad\Check{\Check{C}}\quad +\Tilde{\Tilde{T}}\quad\Acute{\Acute{A}}\quad +\Grave{\Grave{G}}\quad\Dot{\Dot{D}}\quad +\Ddot{\Ddot{D}}\quad\Breve{\Breve{B}}\quad +\Bar{\Bar{B}}\quad\Vec{\Vec{V}}\] +\end{verbatim} +This double accent operation is complicated +and tends to slow down the processing of a \LaTeX\ file. + + +\subsection{Dot accents} +\cn{dddot} and \cn{ddddot} are available to +produce triple and quadruple dot accents +in addition to the \cn{dot} and \cn{ddot} accents already available +in \LaTeX: +\[\dddot{Q}\qquad\ddddot{R}\] +\begin{verbatim} +\[\dddot{Q}\qquad\ddddot{R}\] +\end{verbatim} + +\subsection{Roots} + +In the \pkg{amsmath} package \cn{leftroot} and \cn{uproot} allow you to adjust +the position of the root index of a radical: +\begin{verbatim} +\sqrt[\leftroot{-2}\uproot{2}\beta]{k} +\end{verbatim} +gives good positioning of the $\beta$: +\[\sqrt[\leftroot{-2}\uproot{2}\beta]{k}\] + +\subsection{Boxed formulas} The command \cn{boxed} puts a box around its +argument, like \cn{fbox} except that the contents are in math mode: +\begin{verbatim} +\boxed{W_t-F\subseteq V(P_i)\subseteq W_t} +\end{verbatim} +\[\boxed{W_t-F\subseteq V(P_i)\subseteq W_t}.\] + +\subsection{Extensible arrows} +\cn{xleftarrow} and \cn{xrightarrow} produce +arrows that extend automatically to accommodate unusually wide +subscripts or superscripts. The text of the subscript or superscript +are given as an optional resp.\@ mandatory argument: +Example: +\[0 \xleftarrow[\zeta]{\alpha} F\times\triangle[n-1] + \xrightarrow{\partial_0\alpha(b)} E^{\partial_0b}\] +\begin{verbatim} +\[0 \xleftarrow[\zeta]{\alpha} F\times\triangle[n-1] + \xrightarrow{\partial_0\alpha(b)} E^{\partial_0b}\] +\end{verbatim} + +\subsection{\cn{overset}, \cn{underset}, and \cn{sideset}} +Examples: +\[\overset{*}{X}\qquad\underset{*}{X}\qquad +\overset{a}{\underset{b}{X}}\] +\begin{verbatim} +\[\overset{*}{X}\qquad\underset{*}{X}\qquad +\overset{a}{\underset{b}{X}}\] +\end{verbatim} + +The command \cn{sideset} is for a rather special +purpose: putting symbols at the subscript and superscript +corners of a large operator symbol such as $\sum$ or $\prod$, +without affecting the placement of limits. +Examples: +\[\sideset{_*^*}{_*^*}\prod_k\qquad +\sideset{}{'}\sum_{0\le i\le m} E_i\beta x +\] +\begin{verbatim} +\[\sideset{_*^*}{_*^*}\prod_k\qquad +\sideset{}{'}\sum_{0\le i\le m} E_i\beta x +\] +\end{verbatim} + +\subsection{The \cn{text} command} +The main use of the command \cn{text} is for words or phrases in a +display: +\[\mathbf{y}=\mathbf{y}'\quad\text{if and only if}\quad +y'_k=\delta_k y_{\tau(k)}\] +\begin{verbatim} +\[\mathbf{y}=\mathbf{y}'\quad\text{if and only if}\quad +y'_k=\delta_k y_{\tau(k)}\] +\end{verbatim} + +\subsection{Operator names} +The more common math functions such as $\log$, $\sin$, and $\lim$ +have predefined control sequences: \verb=\log=, \verb=\sin=, +\verb=\lim=. +The \pkg{amsmath} package provides \cn{DeclareMathOperator} and +\cn{DeclareMathOperator*} +for producing new function names that will have the +same typographical treatment. +Examples: +\[\norm{f}_\infty= +\esssup_{x\in R^n}\abs{f(x)}\] +\begin{verbatim} +\[\norm{f}_\infty= +\esssup_{x\in R^n}\abs{f(x)}\] +\end{verbatim} +\[\meas_1\{u\in R_+^1\colon f^*(u)>\alpha\} +=\meas_n\{x\in R^n\colon \abs{f(x)}\geq\alpha\} +\quad \forall\alpha>0.\] +\begin{verbatim} +\[\meas_1\{u\in R_+^1\colon f^*(u)>\alpha\} +=\meas_n\{x\in R^n\colon \abs{f(x)}\geq\alpha\} +\quad \forall\alpha>0.\] +\end{verbatim} +\cn{esssup} and \cn{meas} would be defined in the document preamble as +\begin{verbatim} +\DeclareMathOperator*{\esssup}{ess\,sup} +\DeclareMathOperator{\meas}{meas} +\end{verbatim} + +The following special operator names are predefined in the \pkg{amsmath} +package: \cn{varlimsup}, \cn{varliminf}, \cn{varinjlim}, and +\cn{varprojlim}. Here's what they look like in use: +\begin{align} +&\varlimsup_{n\rightarrow\infty} + \mathcal{Q}(u_n,u_n-u^{\#})\le0\\ +&\varliminf_{n\rightarrow\infty} + \left\lvert a_{n+1}\right\rvert/\left\lvert a_n\right\rvert=0\\ +&\varinjlim (m_i^\lambda\cdot)^*\le0\\ +&\varprojlim_{p\in S(A)}A_p\le0 +\end{align} +\begin{verbatim} +\begin{align} +&\varlimsup_{n\rightarrow\infty} + \mathcal{Q}(u_n,u_n-u^{\#})\le0\\ +&\varliminf_{n\rightarrow\infty} + \left\lvert a_{n+1}\right\rvert/\left\lvert a_n\right\rvert=0\\ +&\varinjlim (m_i^\lambda\cdot)^*\le0\\ +&\varprojlim_{p\in S(A)}A_p\le0 +\end{align} +\end{verbatim} + +\subsection{\cn{mod} and its relatives} +The commands \cn{mod} and \cn{pod} are variants of +\cn{pmod} preferred by some authors; \cn{mod} omits the parentheses, +whereas \cn{pod} omits the `mod' and retains the parentheses. +Examples: +\begin{align} +x&\equiv y+1\pmod{m^2}\\ +x&\equiv y+1\mod{m^2}\\ +x&\equiv y+1\pod{m^2} +\end{align} +\begin{verbatim} +\begin{align} +x&\equiv y+1\pmod{m^2}\\ +x&\equiv y+1\mod{m^2}\\ +x&\equiv y+1\pod{m^2} +\end{align} +\end{verbatim} + +\subsection{Fractions and related constructions} +\label{fracs} + +The usual notation for binomials is similar to the fraction concept, +so it has a similar command \cn{binom} with two arguments. Example: +\begin{equation} +\begin{split} +\sum_{\gamma\in\Gamma_C} I_\gamma& +=2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2}\\ +&\quad+\dots+(-1)^l\binom{k}{l}2^{k-l} ++\dots+(-1)^k\\ +&=(2-1)^k=1 +\end{split} +\end{equation} +\begin{verbatim} +\begin{equation} +\begin{split} +[\sum_{\gamma\in\Gamma_C} I_\gamma& +=2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2}\\ +&\quad+\dots+(-1)^l\binom{k}{l}2^{k-l} ++\dots+(-1)^k\\ +&=(2-1)^k=1 +\end{split} +\end{equation} +\end{verbatim} +There are also abbreviations +\begin{verbatim} +\dfrac \dbinom +\tfrac \tbinom +\end{verbatim} +for the commonly needed constructions +\begin{verbatim} +{\displaystyle\frac ... } {\displaystyle\binom ... } +{\textstyle\frac ... } {\textstyle\binom ... } +\end{verbatim} + +The generalized fraction command \cn{genfrac} provides full access to +the six \TeX{} fraction primitives: +\begin{align} +\text{\cn{over}: }&\genfrac{}{}{}{}{n+1}{2}& +\text{\cn{overwithdelims}: }& + \genfrac{\langle}{\rangle}{}{}{n+1}{2}\\ +\text{\cn{atop}: }&\genfrac{}{}{0pt}{}{n+1}{2}& +\text{\cn{atopwithdelims}: }& + \genfrac{(}{)}{0pt}{}{n+1}{2}\\ +\text{\cn{above}: }&\genfrac{}{}{1pt}{}{n+1}{2}& +\text{\cn{abovewithdelims}: }& + \genfrac{[}{]}{1pt}{}{n+1}{2} +\end{align} +\begin{verbatim} +\text{\cn{over}: }&\genfrac{}{}{}{}{n+1}{2}& +\text{\cn{overwithdelims}: }& + \genfrac{\langle}{\rangle}{}{}{n+1}{2}\\ +\text{\cn{atop}: }&\genfrac{}{}{0pt}{}{n+1}{2}& +\text{\cn{atopwithdelims}: }& + \genfrac{(}{)}{0pt}{}{n+1}{2}\\ +\text{\cn{above}: }&\genfrac{}{}{1pt}{}{n+1}{2}& +\text{\cn{abovewithdelims}: }& + \genfrac{[}{]}{1pt}{}{n+1}{2} +\end{verbatim} + +\subsection{Continued fractions} +The continued fraction +\begin{equation} +\cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+\dotsb +}}}}} +\end{equation} +can be obtained by typing +\begin{verbatim} +\cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+ + \cfrac{1}{\sqrt{2}+\dotsb +}}}}} +\end{verbatim} +Left or right placement of any of the numerators is accomplished by using +\cn{cfrac[l]} or \cn{cfrac[r]} instead of \cn{cfrac}. + +\subsection{Smash} + +In \pkg{amsmath} there are optional arguments \verb"t" and \verb"b" for +the plain \TeX\ command \cn{smash}, because sometimes it is advantageous +to be able to `smash' only the top or only the bottom of something while +retaining the natural depth or height. In the formula +$X_j=(1/\sqrt{\smash[b]{\lambda_j}})X_j'$ \cn{smash}\verb=[b]= has been +used to limit the size of the radical symbol. +\begin{verbatim} +$X_j=(1/\sqrt{\smash[b]{\lambda_j}})X_j'$ +\end{verbatim} +Without the use of \cn{smash}\verb=[b]= the formula would have appeared +thus: $X_j=(1/\sqrt{\lambda_j})X_j'$, with the radical extending to +encompass the depth of the subscript $j$. + +\subsection{The `cases' environment} +`Cases' constructions like the following can be produced using +the \env{cases} environment. +\begin{equation} +P_{r-j}= + \begin{cases} + 0& \text{if $r-j$ is odd},\\ + r!\,(-1)^{(r-j)/2}& \text{if $r-j$ is even}. + \end{cases} +\end{equation} +\begin{verbatim} +\begin{equation} P_{r-j}= + \begin{cases} + 0& \text{if $r-j$ is odd},\\ + r!\,(-1)^{(r-j)/2}& \text{if $r-j$ is even}. + \end{cases} +\end{equation} +\end{verbatim} +Notice the use of \cn{text} and the embedded math. + +\subsection{Matrix} + +Here are samples of the matrix environments, +\cn{matrix}, \cn{pmatrix}, \cn{bmatrix}, \cn{Bmatrix}, \cn{vmatrix} +and \cn{Vmatrix}: +\begin{equation} +\begin{matrix} +\vartheta& \varrho\\\varphi& \varpi +\end{matrix}\quad +\begin{pmatrix} +\vartheta& \varrho\\\varphi& \varpi +\end{pmatrix}\quad +\begin{bmatrix} +\vartheta& \varrho\\\varphi& \varpi +\end{bmatrix}\quad +\begin{Bmatrix} +\vartheta& \varrho\\\varphi& \varpi +\end{Bmatrix}\quad +\begin{vmatrix} +\vartheta& \varrho\\\varphi& \varpi +\end{vmatrix}\quad +\begin{Vmatrix} +\vartheta& \varrho\\\varphi& \varpi +\end{Vmatrix} +\end{equation} +% +\begin{verbatim} +\begin{matrix} +\vartheta& \varrho\\\varphi& \varpi +\end{matrix}\quad +\begin{pmatrix} +\vartheta& \varrho\\\varphi& \varpi +\end{pmatrix}\quad +\begin{bmatrix} +\vartheta& \varrho\\\varphi& \varpi +\end{bmatrix}\quad +\begin{Bmatrix} +\vartheta& \varrho\\\varphi& \varpi +\end{Bmatrix}\quad +\begin{vmatrix} +\vartheta& \varrho\\\varphi& \varpi +\end{vmatrix}\quad +\begin{Vmatrix} +\vartheta& \varrho\\\varphi& \varpi +\end{Vmatrix} +\end{verbatim} + +To produce a small matrix suitable for use in text, use the +\env{smallmatrix} environment. +\begin{verbatim} +\begin{math} + \bigl( \begin{smallmatrix} + a&b\\ c&d + \end{smallmatrix} \bigr) +\end{math} +\end{verbatim} +To show +the effect of the matrix on the surrounding lines of +a paragraph, we put it here: \begin{math} + \bigl( \begin{smallmatrix} + a&b\\ c&d + \end{smallmatrix} \bigr) +\end{math} +and follow it with enough text to ensure that there will +be at least one full line below the matrix. + +\cn{hdotsfor}\verb"{"\textit{number}\verb"}" produces a row of dots in a matrix +spanning the given number of columns: +\[W(\Phi)= \begin{Vmatrix} +\dfrac\varphi{(\varphi_1,\varepsilon_1)}&0&\dots&0\\ +\dfrac{\varphi k_{n2}}{(\varphi_2,\varepsilon_1)}& +\dfrac\varphi{(\varphi_2,\varepsilon_2)}&\dots&0\\ +\hdotsfor{5}\\ +\dfrac{\varphi k_{n1}}{(\varphi_n,\varepsilon_1)}& +\dfrac{\varphi k_{n2}}{(\varphi_n,\varepsilon_2)}&\dots& +\dfrac{\varphi k_{n\,n-1}}{(\varphi_n,\varepsilon_{n-1})}& +\dfrac{\varphi}{(\varphi_n,\varepsilon_n)} +\end{Vmatrix}\] +\begin{verbatim} +\[W(\Phi)= \begin{Vmatrix} +\dfrac\varphi{(\varphi_1,\varepsilon_1)}&0&\dots&0\\ +\dfrac{\varphi k_{n2}}{(\varphi_2,\varepsilon_1)}& +\dfrac\varphi{(\varphi_2,\varepsilon_2)}&\dots&0\\ +\hdotsfor{5}\\ +\dfrac{\varphi k_{n1}}{(\varphi_n,\varepsilon_1)}& +\dfrac{\varphi k_{n2}}{(\varphi_n,\varepsilon_2)}&\dots& +\dfrac{\varphi k_{n\,n-1}}{(\varphi_n,\varepsilon_{n-1})}& +\dfrac{\varphi}{(\varphi_n,\varepsilon_n)} +\end{Vmatrix}\] +\end{verbatim} +The spacing of the dots can be varied through use of a square-bracket +option, for example, \verb"\hdotsfor[1.5]{3}". The number in square brackets +will be used as a multiplier; the normal value is 1. + +\subsection{The \cn{substack} command} + +The \cn{substack} command can be used to produce a multiline +subscript or superscript: +for example +\begin{verbatim} +\sum_{\substack{0\le i\le m\\ 0<j<n}} P(i,j) +\end{verbatim} +produces a two-line subscript underneath the sum: +\begin{equation} +\sum_{\substack{0\le i\le m\\ 0<j<n}} P(i,j) +\end{equation} +A slightly more generalized form is the \env{subarray} environment which +allows you to specify that each line should be left-aligned instead of +centered, as here: +\begin{equation} +\sum_{\begin{subarray}{l} + 0\le i\le m\\ 0<j<n + \end{subarray}} + P(i,j) +\end{equation} +\begin{verbatim} +\sum_{\begin{subarray}{l} + 0\le i\le m\\ 0<j<n + \end{subarray}} + P(i,j) +\end{verbatim} + + +\subsection{Big-g-g delimiters} +Here are some big delimiters, first in \cn{normalsize}: +\[\biggl(\mathbf{E}_{y} + \int_0^{t_\varepsilon}L_{x,y^x(s)}\varphi(x)\,ds + \biggr) +\] +\begin{verbatim} +\[\biggl(\mathbf{E}_{y} + \int_0^{t_\varepsilon}L_{x,y^x(s)}\varphi(x)\,ds + \biggr) +\] +\end{verbatim} +and now in \cn{Large} size: +{\Large +\[\biggl(\mathbf{E}_{y} + \int_0^{t_\varepsilon}L_{x,y^x(s)}\varphi(x)\,ds + \biggr) +\]} +\begin{verbatim} +{\Large +\[\biggl(\mathbf{E}_{y} + \int_0^{t_\varepsilon}L_{x,y^x(s)}\varphi(x)\,ds + \biggr) +\]} +\end{verbatim} + +\newpage +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\makeatletter + +%% This turns on vertical rules at the right and left margins, to +%% better illustrate the spacing for certain multiple-line equation +%% structures. +\def\@makecol{\ifvoid\footins \setbox\@outputbox\box\@cclv + \else\setbox\@outputbox + \vbox{\boxmaxdepth \maxdepth + \unvbox\@cclv\vskip\skip\footins\footnoterule\unvbox\footins}\fi + \xdef\@freelist{\@freelist\@midlist}\gdef\@midlist{}\@combinefloats + \setbox\@outputbox\hbox{\vrule width\marginrulewidth + \vbox to\@colht{\boxmaxdepth\maxdepth + \@texttop\dimen128=\dp\@outputbox\unvbox\@outputbox + \vskip-\dimen128\@textbottom}% + \vrule width\marginrulewidth}% + \global\maxdepth\@maxdepth} +\newdimen\marginrulewidth +\setlength{\marginrulewidth}{.1pt} +\makeatother + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\appendix +\section{Examples of multiple-line equation structures} +\label{s:eq} + +\textbf{\large Note: Starting on this page, vertical rules are +added at the margins so that the positioning of various display elements +with respect to the margins can be seen more clearly.} + +\subsection{Split} +The \env{split} environment is not an independent environment +but should be used inside something else such as \env{equation} +or \env{align}. + +If there is not enough room for it, the equation number for a +\env{split} will be shifted to the previous line, when equation numbers are +on the left; the number shifts down to the next line when numbers are on +the right. +\begin{equation} +\begin{split} +f_{h,\varepsilon}(x,y) +&=\varepsilon\mathbf{E}_{x,y}\int_0^{t_\varepsilon} +L_{x,y_\varepsilon(\varepsilon u)}\varphi(x)\,du\\ +&= h\int L_{x,z}\varphi(x)\rho_x(dz)\\ +&\quad+h\biggl[\frac{1}{t_\varepsilon}\biggl(\mathbf{E}_{y} + \int_0^{t_\varepsilon}L_{x,y^x(s)}\varphi(x)\,ds + -t_\varepsilon\int L_{x,z}\varphi(x)\rho_x(dz)\biggr)\\ +&\phantom{{=}+h\biggl[}+\frac{1}{t_\varepsilon} + \biggl(\mathbf{E}_{y}\int_0^{t_\varepsilon}L_{x,y^x(s)} + \varphi(x)\,ds -\mathbf{E}_{x,y}\int_0^{t_\varepsilon} + L_{x,y_\varepsilon(\varepsilon s)} + \varphi(x)\,ds\biggr)\biggr]\\ +&=h\wh{L}_x\varphi(x)+h\theta_\varepsilon(x,y), +\end{split} +\end{equation} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{equation} +\begin{split} +f_{h,\varepsilon}(x,y) +&=\varepsilon\mathbf{E}_{x,y}\int_0^{t_\varepsilon} +L_{x,y_\varepsilon(\varepsilon u)}\varphi(x)\,du\\ +&= h\int L_{x,z}\varphi(x)\rho_x(dz)\\ +&\quad+h\biggl[\frac{1}{t_\varepsilon}\biggl(\mathbf{E}_{y} + \int_0^{t_\varepsilon}L_{x,y^x(s)}\varphi(x)\,ds + -t_\varepsilon\int L_{x,z}\varphi(x)\rho_x(dz)\biggr)\\ +&\phantom{{=}+h\biggl[}+\frac{1}{t_\varepsilon} + \biggl(\mathbf{E}_{y}\int_0^{t_\varepsilon}L_{x,y^x(s)} + \varphi(x)\,ds -\mathbf{E}_{x,y}\int_0^{t_\varepsilon} + L_{x,y_\varepsilon(\varepsilon s)} + \varphi(x)\,ds\biggr)\biggr]\\ +&=h\wh{L}_x\varphi(x)+h\theta_\varepsilon(x,y), +\end{split} +\end{equation} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage +Unnumbered version: +\begin{equation*} +\begin{split} +f_{h,\varepsilon}(x,y) +&=\varepsilon\mathbf{E}_{x,y}\int_0^{t_\varepsilon} +L_{x,y_\varepsilon(\varepsilon u)}\varphi(x)\,du\\ +&= h\int L_{x,z}\varphi(x)\rho_x(dz)\\ +&\quad+h\biggl[\frac{1}{t_\varepsilon}\biggl(\mathbf{E}_{y} + \int_0^{t_\varepsilon}L_{x,y^x(s)}\varphi(x)\,ds + -t_\varepsilon\int L_{x,z}\varphi(x)\rho_x(dz)\biggr)\\ +&\phantom{{=}+h\biggl[}+\frac{1}{t_\varepsilon} + \biggl(\mathbf{E}_{y}\int_0^{t_\varepsilon}L_{x,y^x(s)} + \varphi(x)\,ds -\mathbf{E}_{x,y}\int_0^{t_\varepsilon} + L_{x,y_\varepsilon(\varepsilon s)} + \varphi(x)\,ds\biggr)\biggr]\\ +&=h\wh{L}_x\varphi(x)+h\theta_\varepsilon(x,y), +\end{split} +\end{equation*} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{equation*} +\begin{split} +f_{h,\varepsilon}(x,y) +&=\varepsilon\mathbf{E}_{x,y}\int_0^{t_\varepsilon} +L_{x,y_\varepsilon(\varepsilon u)}\varphi(x)\,du\\ +&= h\int L_{x,z}\varphi(x)\rho_x(dz)\\ +&\quad+h\biggl[\frac{1}{t_\varepsilon}\biggl(\mathbf{E}_{y} + \int_0^{t_\varepsilon}L_{x,y^x(s)}\varphi(x)\,ds + -t_\varepsilon\int L_{x,z}\varphi(x)\rho_x(dz)\biggr)\\ +&\phantom{{=}+h\biggl[}+\frac{1}{t_\varepsilon} + \biggl(\mathbf{E}_{y}\int_0^{t_\varepsilon}L_{x,y^x(s)} + \varphi(x)\,ds -\mathbf{E}_{x,y}\int_0^{t_\varepsilon} + L_{x,y_\varepsilon(\varepsilon s)} + \varphi(x)\,ds\biggr)\biggr]\\ +&=h\wh{L}_x\varphi(x)+h\theta_\varepsilon(x,y), +\end{split} +\end{equation*} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage +If the option \env{centertags} is included in the options +list of the \pkg{amsmath} package, +the equation numbers for \env{split} environments will be +centered vertically on the height +of the \env{split}: +{\makeatletter\ctagsplit@true +\begin{equation} +\begin{split} + \abs{I_2}&=\left\lvert \int_{0}^T \psi(t)\left\{u(a,t)-\int_{\gamma(t)}^a + \frac{d\theta}{k(\theta,t)} + \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi\right\}dt\right\rvert\\ +&\le C_6\left\lvert \left\lvert f\int_\Omega\left\lvert \wt{S}^{-1,0}_{a,-} + W_2(\Omega,\Gamma_l)\right\rvert\right\rvert + \left\lvert \abs{u}\overset{\circ}\to W_2^{\wt{A}} + (\Omega;\Gamma_r,T)\right\rvert\right\rvert. +\end{split} +\end{equation}}% +Some text after to test the below-display spacing. + +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage +Use of \env{split} within \env{align}: +{\delimiterfactor750 +\begin{align} +\begin{split}\abs{I_1} + &=\left\lvert \int_\Omega gRu\,d\Omega\right\rvert\\ +&\le C_3\left[\int_\Omega\left(\int_{a}^x + g(\xi,t)\,d\xi\right)^2d\Omega\right]^{1/2}\\ +&\quad\times \left[\int_\Omega\left\{u^2_x+\frac{1}{k} + \left(\int_{a}^x cu_t\,d\xi\right)^2\right\} + c\Omega\right]^{1/2}\\ +&\le C_4\left\lvert \left\lvert f\left\lvert \wt{S}^{-1,0}_{a,-} + W_2(\Omega,\Gamma_l)\right\rvert\right\rvert + \left\lvert \abs{u}\overset{\circ}\to W_2^{\wt{A}} + (\Omega;\Gamma_r,T)\right\rvert\right\rvert. +\end{split}\label{eq:A}\\ +\begin{split}\abs{I_2}&=\left\lvert \int_{0}^T \psi(t)\left\{u(a,t) + -\int_{\gamma(t)}^a\frac{d\theta}{k(\theta,t)} + \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi\right\}dt\right\rvert\\ +&\le C_6\left\lvert \left\lvert f\int_\Omega + \left\lvert \wt{S}^{-1,0}_{a,-} + W_2(\Omega,\Gamma_l)\right\rvert\right\rvert + \left\lvert \abs{u}\overset{\circ}\to W_2^{\wt{A}} + (\Omega;\Gamma_r,T)\right\rvert\right\rvert. +\end{split} +\end{align}}% +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{align} +\begin{split}\abs{I_1} + &=\left\lvert \int_\Omega gRu\,d\Omega\right\rvert\\ +&\le C_3\left[\int_\Omega\left(\int_{a}^x + g(\xi,t)\,d\xi\right)^2d\Omega\right]^{1/2}\\ +&\quad\times \left[\int_\Omega\left\{u^2_x+\frac{1}{k} + \left(\int_{a}^x cu_t\,d\xi\right)^2\right\} + c\Omega\right]^{1/2}\\ +&\le C_4\left\lvert \left\lvert f\left\lvert \wt{S}^{-1,0}_{a,-} + W_2(\Omega,\Gamma_l)\right\rvert\right\rvert + \left\lvert \abs{u}\overset{\circ}\to W_2^{\wt{A}} + (\Omega;\Gamma_r,T)\right\rvert\right\rvert. +\end{split}\label{eq:A}\\ +\begin{split}\abs{I_2}&=\left\lvert \int_{0}^T \psi(t)\left\{u(a,t) + -\int_{\gamma(t)}^a\frac{d\theta}{k(\theta,t)} + \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi\right\}dt\right\rvert\\ +&\le C_6\left\lvert \left\lvert f\int_\Omega + \left\lvert \wt{S}^{-1,0}_{a,-} + W_2(\Omega,\Gamma_l)\right\rvert\right\rvert + \left\lvert \abs{u}\overset{\circ}\to W_2^{\wt{A}} + (\Omega;\Gamma_r,T)\right\rvert\right\rvert. +\end{split} +\end{align} +\end{verbatim} + +%%%%%%%%%%%%%%%%%% + +\newpage +Unnumbered \env{align}, with a number on the second \env{split}: +\begin{align*} +\begin{split}\abs{I_1}&=\left\lvert \int_\Omega gRu\,d\Omega\right\rvert\\ + &\le C_3\left[\int_\Omega\left(\int_{a}^x + g(\xi,t)\,d\xi\right)^2d\Omega\right]^{1/2}\\ +&\phantom{=}\times \left[\int_\Omega\left\{u^2_x+\frac{1}{k} + \left(\int_{a}^x cu_t\,d\xi\right)^2\right\} + c\Omega\right]^{1/2}\\ +&\le C_4\left\lvert \left\lvert f\left\lvert \wt{S}^{-1,0}_{a,-} + W_2(\Omega,\Gamma_l)\right\rvert\right\rvert + \left\lvert \abs{u}\overset{\circ}\to W_2^{\wt{A}} + (\Omega;\Gamma_r,T)\right\rvert\right\rvert. +\end{split}\\ +\begin{split}\abs{I_2}&=\left\lvert \int_{0}^T \psi(t)\left\{u(a,t) + -\int_{\gamma(t)}^a\frac{d\theta}{k(\theta,t)} + \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi\right\}dt\right\rvert\\ +&\le C_6\left\lvert \left\lvert f\int_\Omega + \left\lvert \wt{S}^{-1,0}_{a,-} + W_2(\Omega,\Gamma_l)\right\rvert\right\rvert + \left\lvert \abs{u}\overset{\circ}\to W_2^{\wt{A}} + (\Omega;\Gamma_r,T)\right\rvert\right\rvert. +\end{split}\tag{\theequation$'$} +\end{align*} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{align*} +\begin{split}\abs{I_1}&=\left\lvert \int_\Omega gRu\,d\Omega\right\rvert\\ + &\le C_3\left[\int_\Omega\left(\int_{a}^x + g(\xi,t)\,d\xi\right)^2d\Omega\right]^{1/2}\\ +&\phantom{=}\times \left[\int_\Omega\left\{u^2_x+\frac{1}{k} + \left(\int_{a}^x cu_t\,d\xi\right)^2\right\} + c\Omega\right]^{1/2}\\ +&\le C_4\left\lvert \left\lvert f\left\lvert \wt{S}^{-1,0}_{a,-} + W_2(\Omega,\Gamma_l)\right\rvert\right\rvert + \left\lvert \abs{u}\overset{\circ}\to W_2^{\wt{A}} + (\Omega;\Gamma_r,T)\right\rvert\right\rvert. +\end{split}\\ +\begin{split}\abs{I_2}&=\left\lvert \int_{0}^T \psi(t)\left\{u(a,t) + -\int_{\gamma(t)}^a\frac{d\theta}{k(\theta,t)} + \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi\right\}dt\right\rvert\\ +&\le C_6\left\lvert \left\lvert f\int_\Omega + \left\lvert \wt{S}^{-1,0}_{a,-} + W_2(\Omega,\Gamma_l)\right\rvert\right\rvert + \left\lvert \abs{u}\overset{\circ}\to W_2^{\wt{A}} + (\Omega;\Gamma_r,T)\right\rvert\right\rvert. +\end{split}\tag{\theequation$'$} +\end{align*} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage +\subsection{Multline} +Numbered version: +\begin{multline}\label{eq:E} +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\,dx\biggr\}\,dy \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\,dy +\end{multline} +To test the use of \verb=\label= and +\verb=\ref=, we refer to the number of this +equation here: (\ref{eq:E}). + +\begin{verbatim} +\begin{multline}\label{eq:E} +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\,dx\biggr\}\,dy \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\,dy +\end{multline} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Unnumbered version: +\begin{multline*} +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\,dx\biggr\}\,dy \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\,dy +\end{multline*} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{multline*} +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\,dx\biggr\}\,dy \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\,dy +\end{multline*} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\iffalse % bugfix needed, error message "Multiple \tag" + % [mjd,24-Jan-1995] +\newpage +And now an ``unnumbered'' version numbered with a literal tag: +\begin{multline*}\tag*{[a]} +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\,dx\biggr\}\,dy \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\,dy +\end{multline*} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{multline*}\tag*{[a]} +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\,dx\biggr\}\,dy \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\,dy +\end{multline*} +\end{verbatim} + +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +The same display with \verb=\multlinegap= set to zero. +Notice that the space on the left in +the first line does not change, because of the equation number, while +the second line is pushed over to the right margin. +{\setlength{\multlinegap}{0pt} +\begin{multline*}\tag*{[a]} +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\,dx\biggr\}\,dy \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\,dy +\end{multline*}}% +Some text after to test the below-display spacing. + +\begin{verbatim} +{\setlength{\multlinegap}{0pt} +\begin{multline*}\tag*{[a]} +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\,dx\biggr\}\,dy \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\,dy +\end{multline*}} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% +\fi % matches \iffalse above [mjd,24-Jan-1995] + +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage +\subsection{Gather} +Numbered version with \verb;\notag; on the second line: +\begin{gather} +D(a,r)\equiv\{z\in\mathbf{C}\colon \abs{z-a}<r\},\\ +\seg(a,r)\equiv\{z\in\mathbf{C}\colon +\Im z= \Im a,\ \abs{z-a}<r\},\notag\\ +c(e,\theta,r)\equiv\{(x,y)\in\mathbf{C} +\colon \abs{x-e}<y\tan\theta,\ 0<y<r\},\\ +C(E,\theta,r)\equiv\bigcup_{e\in E}c(e,\theta,r). +\end{gather} +\begin{verbatim} +\begin{gather} +D(a,r)\equiv\{z\in\mathbf{C}\colon \abs{z-a}<r\},\\ +\seg(a,r)\equiv\{z\in\mathbf{C}\colon +\Im z= \Im a,\ \abs{z-a}<r\},\notag\\ +c(e,\theta,r)\equiv\{(x,y)\in\mathbf{C} +\colon \abs{x-e}<y\tan\theta,\ 0<y<r\},\\ +C(E,\theta,r)\equiv\bigcup_{e\in E}c(e,\theta,r). +\end{gather} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Unnumbered version. +\begin{gather*} +D(a,r)\equiv\{z\in\mathbf{C}\colon \abs{z-a}<r\},\\ +\seg (a,r)\equiv\{z\in\mathbf{C}\colon +\Im z= \Im a,\ \abs{z-a}<r\},\\ +c(e,\theta,r)\equiv\{(x,y)\in\mathbf{C} + \colon \abs{x-e}<y\tan\theta,\ 0<y<r\},\\ +C(E,\theta,r)\equiv\bigcup_{e\in E}c(e,\theta,r). +\end{gather*} +Some text after to test the below-display spacing. +\begin{verbatim} +\begin{gather*} +D(a,r)\equiv\{z\in\mathbf{C}\colon \abs{z-a}<r\},\\ +\seg (a,r)\equiv\{z\in\mathbf{C}\colon +\Im z= \Im a,\ \abs{z-a}<r\},\\ +c(e,\theta,r)\equiv\{(x,y)\in\mathbf{C} + \colon \abs{x-e}<y\tan\theta,\ 0<y<r\},\\ +C(E,\theta,r)\equiv\bigcup_{e\in E}c(e,\theta,r). +\end{gather*} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage +\subsection{Align} +Numbered version: +\begin{align} +\gamma_x(t)&=(\cos tu+\sin tx,v),\\ +\gamma_y(t)&=(u,\cos tv+\sin ty),\\ +\gamma_z(t)&=\left(\cos tu+\frac\alpha\beta\sin tv, + -\frac\beta\alpha\sin tu+\cos tv\right). +\end{align} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{align} +\gamma_x(t)&=(\cos tu+\sin tx,v),\\ +\gamma_y(t)&=(u,\cos tv+\sin ty),\\ +\gamma_z(t)&=\left(\cos tu+\frac\alpha\beta\sin tv, + -\frac\beta\alpha\sin tu+\cos tv\right). +\end{align} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Unnumbered version: +\begin{align*} +\gamma_x(t)&=(\cos tu+\sin tx,v),\\ +\gamma_y(t)&=(u,\cos tv+\sin ty),\\ +\gamma_z(t)&=\left(\cos tu+\frac\alpha\beta\sin tv, + -\frac\beta\alpha\sin tu+\cos tv\right). +\end{align*} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{align*} +\gamma_x(t)&=(\cos tu+\sin tx,v),\\ +\gamma_y(t)&=(u,\cos tv+\sin ty),\\ +\gamma_z(t)&=\left(\cos tu+\frac\alpha\beta\sin tv, + -\frac\beta\alpha\sin tu+\cos tv\right). +\end{align*} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +A variation: +\begin{align} +x& =y && \text {by (\ref{eq:C})}\\ +x'& = y' && \text {by (\ref{eq:D})}\\ +x+x' & = y+y' && \text {by Axiom 1.} +\end{align} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{align} +x& =y && \text {by (\ref{eq:C})}\\ +x'& = y' && \text {by (\ref{eq:D})}\\ +x+x' & = y+y' && \text {by Axiom 1.} +\end{align} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage +\subsection{Align and split within gather} +When using the \env{align} environment within the \env{gather} +environment, one or the other, or both, should be unnumbered (using the +\verb"*" form); numbering both the outer and inner environment would +cause a conflict. + +Automatically numbered \env{gather} with \env{split} and \env{align*}: +\begin{gather} +\begin{split} \varphi(x,z) +&=z-\gamma_{10}x-\gamma_{mn}x^mz^n\\ +&=z-Mr^{-1}x-Mr^{-(m+n)}x^mz^n +\end{split}\\[6pt] +\begin{align*} +\zeta^0 &=(\xi^0)^2,\\ +\zeta^1 &=\xi^0\xi^1,\\ +\zeta^2 &=(\xi^1)^2, +\end{align*} +\end{gather} +Here the \env{split} environment gets a number from the outer +\env{gather} environment; numbers for individual lines of the +\env{align*} are suppressed because of the star. + +\begin{verbatim} +\begin{gather} +\begin{split} \varphi(x,z) +&=z-\gamma_{10}x-\gamma_{mn}x^mz^n\\ +&=z-Mr^{-1}x-Mr^{-(m+n)}x^mz^n +\end{split}\\[6pt] +\begin{align*} +\zeta^0 &=(\xi^0)^2,\\ +\zeta^1 &=\xi^0\xi^1,\\ +\zeta^2 &=(\xi^1)^2, +\end{align*} +\end{gather} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +The \verb"*"-ed form of \env{gather} with the non-\verb"*"-ed form of +\env{align}. +\begin{gather*} +\begin{split} \varphi(x,z) +&=z-\gamma_{10}x-\gamma_{mn}x^mz^n\\ +&=z-Mr^{-1}x-Mr^{-(m+n)}x^mz^n +\end{split}\\[6pt] +\begin{align} \zeta^0&=(\xi^0)^2,\\ +\zeta^1 &=\xi^0\xi^1,\\ +\zeta^2 &=(\xi^1)^2, +\end{align} +\end{gather*} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{gather*} +\begin{split} \varphi(x,z) +&=z-\gamma_{10}x-\gamma_{mn}x^mz^n\\ +&=z-Mr^{-1}x-Mr^{-(m+n)}x^mz^n +\end{split}\\[6pt] +\begin{align} \zeta^0&=(\xi^0)^2,\\ +\zeta^1 &=\xi^0\xi^1,\\ +\zeta^2 &=(\xi^1)^2, +\end{align} +\end{gather*} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage +\subsection{Alignat} +Numbered version: +\begin{alignat}{3} +V_i & =v_i - q_i v_j, & \qquad X_i & = x_i - q_i x_j, + & \qquad U_i & = u_i, + \qquad \text{for $i\ne j$;}\label{eq:B}\\ +V_j & = v_j, & \qquad X_j & = x_j, + & \qquad U_j & u_j + \sum_{i\ne j} q_i u_i. +\end{alignat} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{alignat}{3} +V_i & =v_i - q_i v_j, & \qquad X_i & = x_i - q_i x_j, + & \qquad U_i & = u_i, + \qquad \text{for $i\ne j$;}\label{eq:B}\\ +V_j & = v_j, & \qquad X_j & = x_j, + & \qquad U_j & u_j + \sum_{i\ne j} q_i u_i. +\end{alignat} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Unnumbered version: +\begin{alignat*}3 +V_i & =v_i - q_i v_j, & \qquad X_i & = x_i - q_i x_j, + & \qquad U_i & = u_i, + \qquad \text{for $i\ne j$;} \\ +V_j & = v_j, & \qquad X_j & = x_j, + & \qquad U_j & u_j + \sum_{i\ne j} q_i u_i. +\end{alignat*} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{alignat*}3 +V_i & =v_i - q_i v_j, & \qquad X_i & = x_i - q_i x_j, + & \qquad U_i & = u_i, + \qquad \text{for $i\ne j$;} \\ +V_j & = v_j, & \qquad X_j & = x_j, + & \qquad U_j & u_j + \sum_{i\ne j} q_i u_i. +\end{alignat*} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage +The most common use for \env{alignat} is for things like +\begin{alignat}{2} +x& =y && \qquad \text {by (\ref{eq:A})}\label{eq:C}\\ +x'& = y' && \qquad \text {by (\ref{eq:B})}\label{eq:D}\\ +x+x' & = y+y' && \qquad \text {by Axiom 1.} +\end{alignat} +Some text after to test the below-display spacing. + +\begin{verbatim} +\begin{alignat}{2} +x& =y && \qquad \text {by (\ref{eq:A})}\label{eq:C}\\ +x'& = y' && \qquad \text {by (\ref{eq:B})}\label{eq:D}\\ +x+x' & = y+y' && \qquad \text {by Axiom 1.} +\end{alignat} +\end{verbatim} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage +\setlength{\marginrulewidth}{0pt} + +\begin{thebibliography}{10} + +\bibitem{dihe:newdir} +W.~Diffie and E.~Hellman, \emph{New directions in cryptography}, IEEE +Transactions on Information Theory \textbf{22} (1976), no.~5, 644--654. + +\bibitem{fre:cichon} +D.~H. Fremlin, \emph{Cichon's diagram}, 1983/1984, presented at the +S{\'e}minaire Initiation {\`a} l'Analyse, G. Choquet, M. Rogalski, J. +Saint Raymond, at the Universit{\'e} Pierre et Marie Curie, Paris, 23e +ann{\'e}e. + +\bibitem{gouja:lagrmeth} +I.~P. Goulden and D.~M. Jackson, \emph{The enumeration of directed +closed {E}uler trails and directed {H}amiltonian circuits by +{L}angrangian methods}, European J. Combin. \textbf{2} (1981), 131--212. + +\bibitem{hapa:graphenum} +F.~Harary and E.~M. Palmer, \emph{Graphical enumeration}, Academic +Press, 1973. + +\bibitem{imlelu:oneway} +R.~Impagliazzo, L.~Levin, and M.~Luby, \emph{Pseudo-random generation +from one-way functions}, Proc. 21st STOC (1989), ACM, New York, +pp.~12--24. + +\bibitem{komiyo:unipfunc} +M.~Kojima, S.~Mizuno, and A.~Yoshise, \emph{A new continuation method +for complementarity problems with uniform p-functions}, Tech. Report +B-194, Tokyo Inst. of Technology, Tokyo, 1987, Dept. of Information +Sciences. + +\bibitem{komiyo:lincomp} +\bysame, \emph{A polynomial-time algorithm for a class of linear +complementarity problems}, Tech. Report B-193, Tokyo Inst. of +Technology, Tokyo, 1987, Dept. of Information Sciences. + +\bibitem{liuchow:formalsum} +C.~J. Liu and Yutze Chow, \emph{On operator and formal sum methods for +graph enumeration problems}, SIAM J. Algorithms Discrete Methods +\textbf{5} (1984), 384--438. + +\bibitem{mami:matrixth} +M.~Marcus and H.~Minc, \emph{A survey of matrix theory and matrix +inequalities}, Complementary Series in Math. \textbf{14} (1964), 21--48. + +\bibitem{miyoki:lincomp} +S.~Mizuno, A.~Yoshise, and T.~Kikuchi, \emph{Practical polynomial time +algorithms for linear complementarity problems}, Tech. Report~13, Tokyo +Inst. of Technology, Tokyo, April 1988, Dept. of Industrial Engineering +and Management. + +\bibitem{moad:quadpro} +R.~D. Monteiro and I.~Adler, \emph{Interior path following primal-dual +algorithms, part {II}: Quadratic programming}, August 1987, Working +paper, Dept. of Industrial Engineering and Operations Research. + +\bibitem{ste:sint} +E.~M. Stein, \emph{Singular integrals and differentiability properties +of functions}, Princeton Univ. Press, Princeton, N.J., 1970. + +\bibitem{ye:intalg} +Y.~Ye, \emph{Interior algorithms for linear, quadratic and linearly +constrained convex programming}, Ph.D. thesis, Stanford Univ., Palo +Alto, Calif., July 1987, Dept. of Engineering--Economic Systems, +unpublished. + +\end{thebibliography} + +\end{document} +\endinput |