% This is part of the book TeX for the Impatient. % Copyright (C) 2003, 2014 Paul W. Abrahams, Kathryn A. Hargreaves, Karl Berry. % See file fdl.tex for copying conditions. \input macros \chapter {Commands \linebreak for composing \linebreak math formulas} \bix^^{math} \chapterdef{math} This section covers commands for constructing math formulas. For an explanation of the conventions used in this section, see \headcit{Descriptions of the commands}{cmddesc}. \begindescriptions %========================================================================== \section {Simple parts of formulas} %========================================================================== \subsection {Greek letters} \begindesc \bix^^{Greek letters} \dothreecolumns 40 \easy\ctsdisplay alpha {} \ctsdisplay beta {} \ctsdisplay chi {} \ctsdisplay delta {} \ctsdisplay Delta {} \ctsdisplay epsilon {} \ctsdisplay varepsilon {} \ctsdisplay eta {} \ctsdisplay gamma {} \ctsdisplay Gamma {} \ctsdisplay iota {} \ctsdisplay kappa {} \ctsdisplay lambda {} \ctsdisplay Lambda {} \ctsdisplay mu {} \ctsdisplay nu {} \ctsdisplay omega {} \ctsdisplay Omega {} \ctsdisplay phi {} \ctsdisplay varphi {} \ctsdisplay Phi {} \ctsdisplay pi {} \ctsdisplay varpi {} \ctsdisplay Pi {} \ctsdisplay psi {} \ctsdisplay Psi {} \ctsdisplay rho {} \ctsdisplay varrho {} \ctsdisplay sigma {} \ctsdisplay varsigma {} \ctsdisplay Sigma {} \ctsdisplay tau {} \ctsdisplay theta {} \ctsdisplay vartheta {} \ctsdisplay Theta {} \ctsdisplay upsilon {} \ctsdisplay Upsilon {} \ctsdisplay xi {} \ctsdisplay Xi {} \ctsdisplay zeta {} \egroup \explain These commands produce Greek letters suitable for mathematics. You can only use them within a math formula, so if you need a Greek letter within ordinary text you must enclose it in dollar signs (|$|). \TeX\ does not have commands for Greek letters that look like their roman counterparts, since you can get them by using those roman counterparts. For example, you can get a lowercase ^{omicron} in a formula by writing the letter `o', i.e., `|{\rm o}|' or an uppercase ^{beta} (`B') by writing `|{\rm B}|'. Don't confuse the following letters: \ulist \compact \li |\upsilon| (`$\upsilon$'), |{\rm v}| (`v'), and |\nu| (`$\nu$'). \li |\varsigma| (`$\varsigma$') and |\zeta| (`$\zeta$'). \endulist You can get slanted capital Greek letters by using the math italic (|\mit|) \minref{font}. \TeX\ treats Greek letters as ordinary symbols when it's figuring how much space to put around them. \example If $\rho$ and $\theta$ are both positive, then $f(\theta) -{\mit \Gamma}_{\theta} < f(\rho)-{\mit \Gamma}_{\rho}$. | \produces If $\rho$ and $\theta$ are both positive, then $f(\theta)-{\mit \Gamma}_{\theta} < f(\rho)-{\mit \Gamma}_{\rho}$. \endexample \eix^^{Greek letters} \enddesc %========================================================================== \subsection {Miscellaneous ordinary math symbols} \begindesc \xrdef{specsyms} \dothreecolumns 34 \easy\ctsdisplay infty {} \ctsdisplay Re {} \ctsdisplay Im {} \ctsdisplay angle {} \ctsdisplay triangle {} \ctsdisplay backslash {} \ctsdisplay vert {} \ctsydisplay | @bar {} \ctsdisplay Vert {} \ctsdisplay emptyset {} \ctsdisplay bot {} \ctsdisplay top {} \ctsdisplay exists {} \ctsdisplay forall {} \ctsdisplay hbar {} \ctsdisplay ell {} \ctsdisplay aleph {} \ctsdisplay imath {} \ctsdisplay jmath {} \ctsdisplay nabla {} \ctsdisplay neg {} \ctsdisplay lnot {} \actdisplay ' @prime \ (apostrophe) \ctsdisplay prime {} \ctsdisplay partial {} \ctsdisplay surd {} \ctsdisplay wp {} \ctsdisplay flat {} \ctsdisplay sharp {} \ctsdisplay natural {} \ctsdisplay clubsuit {} \ctsdisplay diamondsuit {} \ctsdisplay heartsuit {} \ctsdisplay spadesuit {} \egroup \explain ^^{music symbols} ^^{card suits} These commands produce various symbols. They are called ``^{ordinary symbol}s'' to distinguish them from other classes of symbols such as relations. You can only use an ordinary symbol within a math formula, so if you need an ordinary symbol within ordinary text you must enclose it in dollar signs (|$|). The commands |\imath| and |\jmath| are useful when you need to put an accent on top of an `$i$' or a `$j$'. An apostrophe (|'|) is a short way of writing a superscript |\prime|. (The |\prime| command by itself generates a big ugly prime.) The |\!|| and ^|\Vert| commands are synonymous, as are the ^|\neg| and ^|\lnot| commands. \margin{explanation of {\tt\\vert} added} The |\vert| command produces the same result as `|!||'. \indexchar | The symbols produced by |\backslash|, |\vert|, and |\Vert| are \minref{delimiter}s. These symbols can be produced in larger sizes by using ^|\bigm| et al.\ (\xref \bigm). \example The Knave of $\heartsuit$s, he stole some tarts. | \produces The Knave of $\heartsuit$s, he stole some tarts. \nextexample If $\hat\imath < \hat\jmath$ then $i' \leq j^\prime$. | \produces If $\hat\imath < \hat\jmath$ then $i' \leq j^\prime$. \nextexample $${{x-a}\over{x+a}}\biggm\backslash{{y-b}\over{y+b}}$$ | \dproduces $${{x-a}\over{x+a}}\biggm\backslash{{y-b}\over{y+b}}$$ \endexample \enddesc %========================================================================== \subsection {Binary operations} \begindesc \bix^^{operations} \xrdef{binops} \dothreecolumns 34 \easy\ctsdisplay vee {} \ctsdisplay wedge {} \ctsdisplay amalg {} \ctsdisplay cap {} \ctsdisplay cup {} \ctsdisplay uplus {} \ctsdisplay sqcap {} \ctsdisplay sqcup {} \ctsdisplay dagger {} \ctsdisplay ddagger {} \ctsdisplay land {} \ctsdisplay lor {} \ctsdisplay cdot {} \ctsdisplay diamond {} \ctsdisplay bullet {} \ctsdisplay circ {} \ctsdisplay bigcirc {} \ctsdisplay odot {} \ctsdisplay ominus {} \ctsdisplay oplus {} \ctsdisplay oslash {} \ctsdisplay otimes {} \ctsdisplay pm {} \ctsdisplay mp {} \ctsdisplay triangleleft {} \ctsdisplay triangleright {} \ctsdisplay bigtriangledown {} \ctsdisplay bigtriangleup {} \ctsdisplay ast {} \ctsdisplay star {} \ctsdisplay times {} \ctsdisplay div {} \ctsdisplay setminus {} \ctsdisplay wr {} \egroup \explain These commands produce the symbols for various binary operations. Binary operations are one of \TeX's \minref{class}es of math symbols. \TeX\ puts different amounts of space around different classes of math symbols. When \TeX\ needs to break a line of text within a math formula, \minrefs{line break} it will consider placing the break after a binary operation---but only if the operation is at the outermost level of the formula, i.e., not enclosed in~a~group. In addition to these commands, \TeX\ also treats `|+|' and `|-|' as binary operations. It considers `|/|' to be an ordinary symbol, despite the fact that mathematically it is a binary operation, because it looks better with less space around it. \example $$z = x \div y \quad \hbox{if and only if} \quad z \times y = x \;\hbox{and}\; y \neq 0$$ | \dproduces $$z = x \div y \quad \hbox{if and only if} \quad z \times y = x \;\hbox{and}\; y \neq 0$$ \endexample \enddesc \begindesc \ctspecial * \ctsxrdef{@star} \explain The |\*| command indicates a discretionary multiplication symbol ($\times$), which is a binary operation. This multiplication symbol behaves like a discretionary hyphen when it appears in a formula within text\minrefs{text math}. That is, \TeX\ will typeset the |\times| symbol \emph{only} if the formula needs to be broken at that point. There's no point in using |\*| in a displayed formula \minrefs{display math} since \TeX\ never breaks displayed formulas on its own. \example Let $c = a\*b$. In the case that $c=0$ or $c=1$, let $\Delta$ be $(\hbox{the smallest $q$})\*(\hbox{the largest $q$})$ in the set of approximate $\tau$-values. | \produces Let $c = a\*b$. In the case that $c=0$ or $c=1$, let $\Delta$ be $(\hbox{the smallest $q$})\*(\hbox{the largest $q$})$ in the set of approximate $\tau$-values. \eix^^{operations} \endexample \enddesc %========================================================================== \subsection {Relations} \begindesc \xrdef {relations} \bix^^{relations} \dothreecolumns 39 \easy\ctsdisplay asymp {} \ctsdisplay cong {} \ctsdisplay dashv {} \ctsdisplay vdash {} \ctsdisplay perp {} \ctsdisplay mid {} \ctsdisplay parallel {} \ctsdisplay doteq {} \ctsdisplay equiv {} \ctsdisplay ge {} \ctsdisplay geq {} \ctsdisplay le {} \ctsdisplay leq {} \ctsdisplay gg {} \ctsdisplay ll {} \ctsdisplay models {} \ctsdisplay ne {} \ctsdisplay neq {} \ctsdisplay notin {} \ctsdisplay in {} \ctsdisplay ni {} \ctsdisplay owns {} \ctsdisplay prec {} \ctsdisplay preceq {} \ctsdisplay succ {} \ctsdisplay succeq {} \ctsdisplay bowtie {} \ctsdisplay propto {} \ctsdisplay approx {} \ctsdisplay sim {} \ctsdisplay simeq {} \ctsdisplay frown {} \ctsdisplay smile {} \ctsdisplay subset {} \ctsdisplay subseteq {} \ctsdisplay supset {} \ctsdisplay supseteq {} \ctsdisplay sqsubseteq {} \ctsdisplay sqsupseteq {} \egroup \explain These commands produce the symbols for various relations. Relations are one of \TeX's \minref{class}es of math symbols. \TeX\ puts different amounts of space around different \minref{class}es of math symbols. When \TeX\ needs to break a line of text within a math formula, \minrefs{line break} it will consider placing the break after a relation---but only if the relation is at the outermost level of the formula, i.e., not enclosed in a group. In addition to the commands listed here, \TeX\ treats `^|=|' and the ``arrow'' commands (\xref{arrows}) as relations. Certain relations have more than one command that you can use to produce them: \ulist \compact \li `$\ge$' (|\ge| and |\geq|). \li `$\le$' (|\le| and |\leq|). \li `$\ne$' (|\ne|, |\neq|, and |\not=|). \li `$\ni$' (|\ni| and |\owns|). \endulist \xrdef{\not} You can produce negated relations by prefixing them with |\not|, as follows: \nobreak \threecolumns 21 \basicdisplay {$\not\asymp$}{\\not\\asymp}\ctsidxref{asymp} \basicdisplay {$\not\cong$}{\\not\\cong}\ctsidxref{cong} \basicdisplay {$\not\equiv$}{\\not\\equiv}\ctsidxref{equiv} \basicdisplay {$\not=$}{\\not=}\ttidxref{=} \basicdisplay {$\not\ge$}{\\not\\ge}\ctsidxref{ge} \basicdisplay {$\not\geq$}{\\not\\geq}\ctsidxref{geq} \basicdisplay {$\not\le$}{\\not\\le}\ctsidxref{le} \basicdisplay {$\not\leq$}{\\not\\leq}\ctsidxref{leq} \basicdisplay {$\not\prec$}{\\not\\prec}\ctsidxref{prec} \basicdisplay {$\not\preceq$}{\\not\\preceq}\ctsidxref{preceq} \basicdisplay {$\not\succ$}{\\not\\succ}\ctsidxref{succ} \basicdisplay {$\not\succeq$}{\\not\\succeq}\ctsidxref{succeq} \basicdisplay {$\not\approx$}{\\not\\approx}\ctsidxref{approx} \basicdisplay {$\not\sim$}{\\not\\sim}\ctsidxref{sim} \basicdisplay {$\not\simeq$}{\\not\\simeq}\ctsidxref{simeq} \basicdisplay {$\not\subset$}{\\not\\subset}\ctsidxref{subset} \basicdisplay {$\not\subseteq$}{\\not\\subseteq}\ctsidxref{subseteq} \basicdisplay {$\not\supset$}{\\not\\supset}\ctsidxref{supset} \basicdisplay {$\not\supseteq$}{\\not\\supseteq}\ctsidxref{supseteq} \basicdisplay {$\not\sqsubseteq$}{\\not\\sqsubseteq}% \ctsidxref{sqsubseteq} \basicdisplay {$\not\sqsupseteq$}{\\not\\sqsupseteq}% \ctsidxref{sqsupseteq} \egroup \example We can show that $AB \perp AC$, and that $\triangle ABF \not\sim \triangle ACF$. | \produces We can show that $AB \perp AC$, and that $\triangle ABF \not\sim \triangle ACF$. \eix^^{relations} \endexample \enddesc %========================================================================== \subsection {Left and right delimiters} \begindesc \bix^^{delimiters} % \dothreecolumns 12 \easy\ctsdisplay lbrace {} \ctsydisplay { @lbrace {} \ctsdisplay rbrace {} \ctsydisplay } @rbrace {} \ctsdisplay lbrack {} \ctsdisplay rbrack {} \ctsdisplay langle {} \ctsdisplay rangle {} \ctsdisplay lceil {} \ctsdisplay rceil {} \ctsdisplay lfloor {} \ctsdisplay rfloor {} \egroup \explain These commands produce left and right \minref{delimiter}s. Mathematicians use delimiters to indicate the boundaries between parts of a formula. Left delimiters are also called ``^{opening}s'', and right delimiters are also called ``^{closing}s''. Openings and closings are two of \TeX's \minref{class}es of math symbols. \TeX\ puts different amounts of space around different \minref{class}es of math symbols. You might expect the space that \TeX\ puts around openings and closings to be symmetrical, but in fact it isn't. Some left and right delimiters have more than one command that you can use to produce them: \ulist\compact \li `$\{$' (|\lbrace| and |\{|) \li `$\}$' (|\rbrace| and |\}|) \li `$[$' (|\lbrack| and `|[|') \li `$]$' (|\rbrack| and `|]|') \endulist \noindent You can also use the left and right bracket characters (in either form) outside of math mode. In addition to these commands, \TeX\ treats `|(|' as a left delimiter and `|)|' as a right delimiter. You can have \TeX\ choose the size for a delimiter by using |\left| and |\right| (\xref\left). Alternatively, you can get a delimiter of a specific size by using one of the |\big|$x$ commands (see |\big| et al., \xref{\big}). \example The set $\{\,x \mid x>0\,\}$ is empty. | \produces The set $\{\,x \mid x>0\,\}$ is empty. \eix^^{delimiters} \endexample \enddesc %========================================================================== \subsection {Arrows} \begindesc \bix^^{arrows} \xrdef{arrows} % {\symbolspace=24pt \makecolumns 34/2: \easy% \ctsdisplay leftarrow {} \ctsdisplay gets {} \ctsdisplay Leftarrow {} \ctsdisplay rightarrow {} \ctsdisplay to {} \ctsdisplay Rightarrow {} \ctsdisplay leftrightarrow {} \ctsdisplay Leftrightarrow {} \ctsdisplay longleftarrow {} \ctsdisplay Longleftarrow {} \ctsdisplay longrightarrow {} \ctsdisplay Longrightarrow {} \ctsdisplay longleftrightarrow {} \ctsdisplay Longleftrightarrow {} \basicdisplay {$\Longleftrightarrow$}{\\iff}\pix\ctsidxref{iff}\xrdef{\iff} \ctsdisplay hookleftarrow {} \ctsdisplay hookrightarrow {} \ctsdisplay leftharpoondown {} \ctsdisplay rightharpoondown {} \ctsdisplay leftharpoonup {} \ctsdisplay rightharpoonup {} \ctsdisplay rightleftharpoons {} \ctsdisplay mapsto {} \ctsdisplay longmapsto {} \ctsdisplay downarrow {} \ctsdisplay Downarrow {} \ctsdisplay uparrow {} \ctsdisplay Uparrow {} \ctsdisplay updownarrow {} \ctsdisplay Updownarrow {} \ctsdisplay nearrow {} \ctsdisplay searrow {} \ctsdisplay nwarrow {} \ctsdisplay swarrow {} } \explain These commands provide arrows of different kinds. They are classified as relations (\xref{relations}). The vertical arrows in the list are also \minref{delimiter}s, so you can make them larger by using |\big| et al.\ (\xref \big). The command |\iff| differs from |\Longleftrightarrow| in that it produces extra space to the left and right of the arrow. You can place symbols or other legends on top of a left or right arrow with |\buildrel| (\xref \buildrel). \example $$f(x)\mapsto f(y) \iff x \mapsto y$$ | \dproduces $$f(x)\mapsto f(y) \iff x \mapsto y$$ \eix^^{arrows} \endexample \enddesc %========================================================================== \subsection {Named mathematical functions} \begindesc \xrdef{namedfns} \bix^^{functions, names of} {\symbolspace = 36pt \threecolumns 32 \easy\ctsdisplay cos {} \ctsdisplay sin {} \ctsdisplay tan {} \ctsdisplay cot {} \ctsdisplay csc {} \ctsdisplay sec {} \ctsdisplay arccos {} \ctsdisplay arcsin {} \ctsdisplay arctan {} \ctsdisplay cosh {} \ctsdisplay coth {} \ctsdisplay sinh {} \ctsdisplay tanh {} \ctsdisplay det {} \ctsdisplay dim {} \ctsdisplay exp {} \ctsdisplay ln {} \ctsdisplay log {} \ctsdisplay lg {} \ctsdisplay arg {} \ctsdisplay deg {} \ctsdisplay gcd {} \ctsdisplay hom {} \ctsdisplay ker {} \ctsdisplay inf {} \ctsdisplay sup {} \ctsdisplay lim {} \ctsdisplay liminf {} \ctsdisplay limsup {} \ctsdisplay max {} \ctsdisplay min {} \ctsdisplay Pr {} \egroup} \explain These commands set the names of various mathematical functions in roman type, as is customary. If you apply a superscript or subscript to one of these commands, \TeX\ will in most cases typeset it in the usual place. In display style, \TeX\ typesets superscripts and subscripts on |\det|, |\gcd|, |\inf|, |\lim|, |\liminf|, |\limsup|, |\max|, |\min|, |\Pr|, and |\sup| as though they were limits, i.e., directly above or directly below the function name. \example $\cos^2 x + \sin^2 x = 1\qquad\max_{a \in A} g(a) = 1$ | \produces $\cos^2 x + \sin^2 x = 1\qquad\max_{a \in A} g(a) = 1$ \endexample\enddesc \begindesc \cts bmod {} \explain This command produces a binary operation for indicating a ^{modulus} within a formula. \example $$x = (y+1) \bmod 2$$ | \dproduces $$x = (y+1) \bmod 2$$ \endexample \enddesc \begindesc \cts pmod {} \explain This command provides a notation for indicating a ^{modulus} in parentheses at the end of a formula. \example $$x \equiv y+1 \pmod 2$$ | \dproduces $$x \equiv y+1 \pmod 2$$ \eix^^{functions, names of} \endexample \enddesc %========================================================================== \subsection {Large operators} \begindesc \bix^^{operators//large} \threecolumns 15 \easy\ctsdoubledisplay bigcap {} \ctsdoubledisplay bigcup {} \ctsdoubledisplay bigodot {} \ctsdoubledisplay bigoplus {} \ctsdoubledisplay bigotimes {} \ctsdoubledisplay bigsqcup {} \ctsdoubledisplay biguplus {} \ctsdoubledisplay bigvee {} \ctsdoubledisplay bigwedge {} \ctsdoubledisplay coprod {} {\symbolspace = 42pt\basicdisplay {\hskip 26pt$\smallint$}% {\\smallint}\ddstrut}% \xrdef{\smallint} \pix\ctsidxref{smallint} \ctsdoubledisplay int {} \ctsdoubledisplay oint {} \ctsdoubledisplay prod {} \ctsdoubledisplay sum {} } \explain These commands produce various large operator symbols. \TeX\ produces the smaller size when it's in ^{text style} \minrefs{math mode} and the larger size when it's in ^{display style}. Operators are one of \TeX's \minref{class}es of math symbols. \TeX\ puts different amounts of space around different classes of math symbols. The large operator symbols with `|big|' in their names are different from the corresponding binary operations (see \xref{binops}) such as |\cap| ($\cap$) since they usually appear at the beginning of a formula. \TeX\ uses different spacing for a large operator than it does for a binary operation. Don't confuse `$\sum$' (|\sum|) with `$\Sigma$'^^|\Sigma| (|\Sigma|) or confuse `$\prod$' (|\prod|) with `$\Pi$' ^^|\Pi| (|\Pi|). |\Sigma| and |\Pi| produce capital Greek letters, which are smaller and have a different appearance. A large operator can have ^{limits}. The lower limit is specified as a subscript and the upper limit as a superscript. \example $$\bigcap_{k=1}^r (a_k \cup b_k)$$ | \dproduces $$\bigcap_{k=1}^r (a_k \cup b_k)$$ \endexample \interexampleskip \example $${\int_0^\pi \sin^2 ax\,dx} = {\pi \over 2}$$ | \dproduces $${\int_0^\pi \sin^2 ax\,dx} = {\pi \over 2}$$ \endexample \enddesc \begindesc \cts limits {} \explain In text style, \TeX\ normally places limits after a large operator. This command tells \TeX\ to place limits above and below a large operator rather than after it. If you specify more than one of |\limits|, |\nolimits|, and |\display!-limits|, the last command rules. \example Suppose that $\bigcap\limits_{i=1}^Nq_i$ contains at least two elements. | \produces Suppose that $\bigcap\limits_{i=1}^Nq_i$ contains at least two elements. \endexample \enddesc \begindesc \cts nolimits {} \explain In display style, \TeX\ normally places limits above and below a large operator. This command tells \TeX\ to place limits after a large operator rather than above and below it. The integral operators |\int| and |\oint| are exceptions---\TeX\ places limits after them in all cases, unless overridden, as in |\int\limits|. (\plainTeX\ defines ^|\int| and ^|\oint| as macros that specify the operator symbol followed by |\nolimits|---this is what causes them to behave differently by default.) ^^|\int//limits after| If you specify more than one of |\limits|, |\nolimits|, and |\display!-limits|, the last command rules. \example $$\bigcap\nolimits_{i=1}^Nq_i$$ | \dproduces $$\bigcap\nolimits_{i=1}^Nq_i$$ \endexample \enddesc \begindesc \cts displaylimits {} \explain This command tells \TeX\ to place limits above and below all operators (including the integrals) if in display style, and after all operators if in text style. If you specify more than one of |\limits|, |\nolimits|, and |\display!-limits|, the last command rules. \example $$a(\lambda) = {1 \over {2\pi}} \int\displaylimits _{-\infty}^{+\infty} f(x)e^{-i\lambda x}\,dx$$ | \dproduces $$a(\lambda) = {1 \over {2\pi}} \int\displaylimits _{-\infty}^{+\infty} f(x)e^{-i\lambda x}\,dx$$ \eix^^{operators//large} \endexample \enddesc %========================================================================== \subsection {Punctuation} \begindesc \bix^^{punctuation in math formulas} \cts cdotp {} \cts ldotp {} \explain These two commands respectively produce a centered dot and a dot positioned on the \minref{baseline}. They are valid only in math \minref{mode}. \TeX\ treats them as punctuation, putting no extra space in front of them but a little extra space after them. In contrast, \TeX\ puts an equal amount of space on both sides of a centered dot generated by the ^|\cdot| command (\xref \cdot). \example $x \cdotp y \quad x \ldotp y \quad x \cdot y$ | \produces $x \cdotp y \quad x \ldotp y \quad x \cdot y$ \endexample \enddesc \begindesc \cts colon {} \explain This command produces a colon punctation symbol. It is valid only in math mode. The difference between |\colon| and the colon character (|:|) is that `|:|' is an operator, so \TeX\ puts extra space to the left of it whereas it doesn't put extra space to the left of |\colon|. \example $f \colon t \quad f : t$ | \produces $f \colon t \quad f : t$ \eix^^{punctuation in math formulas} \endexample \enddesc %========================================================================== \secondprinting{\vfill\eject\null\vglue-30pt\vskip0pt} \section {Superscripts and subscripts} \begindesc \margin{Two groups of commands have been combined here.} \bix^^{superscripts} \bix^^{subscripts} \secondprinting{\vglue-12pt} \makecolumns 4/2: \easy\ctsact _ \xrdef{@underscore} {\} \cts sb {\} \ctsact ^ \xrdef{@hat} {\} \cts sp {\} \secondprinting{\vglue-4pt} \explain The commands in each column are equivalent. The commands in the first column typeset \ as a subscript, and those in the second column typeset \ as a superscript. The |\sb| and |\sp| commands are mainly useful if you're working on a terminal that lacks an underscore or caret, or if you've redefined `|_|' or `|^|' and need access to the original definition. These commands are also used for setting lower and upper limits on summations and integrals. ^^{lower limits} ^^{upper limits} If a subscript or superscript is not a single \minref{token}, you need to enclose it in a \minref{group}. \TeX\ does not prioritize subscripts or superscripts, so it will reject formulas such as |a_i_j|, |a^i^j|, or |a^i_j|. Subscripts and superscripts are normally typeset in ^{script style}, or in ^{scriptscript style} if they are second-order, e.g., a subscript on a subscript or a superscript on a a subscript. You can set \emph{any} text in a math formula in a script or scriptscript \minref{style} with the ^|\scriptstyle| and ^|\scriptscriptstyle| commands (\xref \scriptscriptstyle). You can apply a subscript or superscript to any of the commands that produce named mathematical functions in roman type (see \xref{namedfns}). In certain cases (again, see \xref{namedfns}) the subscript or superscript appears directly above or under the function name as shown in the examples of ^|\lim| and ^|\det| below. \example $x_3 \quad t_{\max} \quad a_{i_k} \quad \sum_{i=1}^n{q_i} \quad x^3\quad e^{t \cos\theta}\quad r^{x^2}\quad \int_0^\infty{f(x)\,dx}$ $$\lim_{x\leftarrow0}f(x)\qquad\det^{z\in A}\qquad\sin^2t$$ | \produces \secondprinting{\divide\abovedisplayskip by 2} $x_3 \quad t_{\max} \quad a_{i_k} \quad \sum_{i=1}^n{q_i} \quad x^3\quad e^{t \cos\theta}\quad r^{x^2}\quad \int_0^\infty{f(x)\,dx}$ $$\lim_{x \leftarrow 0} f(x)\qquad \det^{z \in A}\qquad \sin^2 t$$ \eix^^{superscripts} \eix^^{subscripts} \endexample \enddesc \secondprinting{\vfill\eject} %========================================================================== \subsection {Selecting and using styles} \begindesc \bix^^{styles} \cts textstyle {} \cts scriptstyle {} \cts scriptscriptstyle {} \cts displaystyle {} \explain ^^{text style} ^^{script style} ^^{scriptscript style} ^^{display style} These commands override the normal \minref{style} and hence the font that \TeX\ uses in setting a formula. Like font-setting commands such as |\it|, they are in effect until the end of the group containing them. They are useful when \TeX's choice of style is inappropriate for the formula you happen to be setting. \example $t+{\scriptstyle t + {\scriptscriptstyle t}}$ | \produces $t+{\scriptstyle t + {\scriptscriptstyle t}}$ \endexample \enddesc \begindesc \cts mathchoice {% \rqbraces{\} \rqbraces{\} \rqbraces{\} \rqbraces{\}} \explain This command tells \TeX\ to typeset one of the subformulas \, \, \, or \, making its choice according to the current \minref{style}. That is, if \TeX\ is in display style it sets the |\mathchoice| as \; in text style it sets it as \; in script style it sets it as \; and in scriptscript style it sets it as \. \example \def\mc{{\mathchoice{D}{T}{S}{SS}}} The strange formula $\mc_{\mc_\mc}$ illustrates a mathchoice. | \produces \def\mc{{\mathchoice{D}{T}{S}{SS}}} The strange formula $\mc_{\mc_\mc}$ illustrates a mathchoice. \endexample \enddesc \begindesc \cts mathpalette {\ \} \explain ^^{math symbols} This command provides a convenient way of producing a math construct that works in all four \minref{style}s. To use it, you'll normally need to define an additional macro, which we'll call |\build|. The call on |\math!-palette| should then have the form |\mathpalette|\allowbreak|\build|\. |\build| tests what style \TeX\ is in and typesets \ accordingly. It should be defined to have two parameters. When you call |\math!-palette|, it will in turn call |\build|, with |#1| being a command that selects the current style and |#2| being \. Thus, within the definition of |\build| you can typeset something in the current style by preceding it with `|#1|'. See \knuth{page~360} for examples of using |\mathpalette| and \knuth{page~151} for a further explanation of how it works. \eix^^{styles} \enddesc %========================================================================== \section {Compound symbols} %========================================================================== \subsection {Math accents} \begindesc \xrdef{mathaccent} ^^{accents} ^^{math//accents} % \easy\ctsx acute {^{acute accent} as in $\acute x$} \ctsx b {^{bar-under accent} as in $\b x$} \ctsx bar {^{bar accent} as in $\bar x$} \ctsx breve {^{breve accent} as in $\breve x$} \ctsx check {^{check accent} as in $\check x$} \ctsx ddot {^{double dot accent} as in $\ddot x$} \ctsx dot {^{dot accent} as in $\dot x$} \ctsx grave {^{grave accent} as in $\grave x$} \ctsx hat {^{hat accent} as in $\hat x$} \ctsx widehat {^{wide hat accent} as in $\widehat {x+y}$} \ctsx tilde {^{tilde accent} as in $\tilde x$} \ctsx widetilde {^{wide tilde accent} as in $\widetilde {z+a}$} \ctsx vec {^{vector accent} as in $\vec x$} \explain These commands produce accent marks in math formulas. You'll ordinarily need to leave a space after any one of them. A wide accent can be applied to a multicharacter subformula; \TeX\ will center the accent over the subformula. The other accents are usefully applied only to a single character. \example $\dot t^n \qquad \widetilde{v_1 + v_2}$ | \produces $\dot t^n \qquad \widetilde{v_1 + v_2}$ \endexample \begindesc \cts mathaccent {\} \explain This command tells \TeX\ to typeset a math accent whose family and character code are given by \. (\TeX\ ignores the class of the \minref{mathcode}.) See \knuth{Appendix~G} for the details of how \TeX\ positions such an accent. The usual way to use |\mathaccent| is to put it in a macro definition that gives a name to a math accent. \example \def\acute{\mathaccent "7013} | \endexample \enddesc \see ``Accents'' (\xref {accents}). \enddesc %========================================================================== \subsection {Fractions and other stacking operations} \begindesc \bix^^{fractions} \bix^^{stacking subformulas} \easy\cts over {} \cts atop {} \cts above {\} \cts choose {} \cts brace {} \cts brack {} \explain {\def\fri{\}% \def\frii{\}% These commands stack one subformula on top of another one. We will explain how |\over| works, and then relate the other commands to it. |\over| is the command that you'd normally use to produce a fraction. ^^{fractions//produced by \b\tt\\over\e} If you write something in one of the following forms: \csdisplay $$!fri\over!frii$$ $!fri\over!frii$ \left!!fri\over!frii\right! {!fri\over!frii} | you'll get a fraction with numerator \fri\ and denominator \, i.e., \fri\ over \frii. In the first three of these forms the |\over| is not implicitly contained in a group; it absorbs everything to its left and to its right until it comes to a boundary, namely, the beginning or end of a group. You can't use |\over| or any of the other commands in this group more than once in a formula. Thus a formula such as: \csdisplay $$a \over n \choose k$$ | isn't legal. This is not a severe restriction because you can always enclose one of the commands in braces. The reason for the restriction is that if you had two of these commands in a single formula, \TeX\ wouldn't know how to group them. The other commands are similar to |\over|, with the following exceptions: \ulist\compact \li |\atop| leaves out the fraction bar. \li |\above| provides a fraction bar of thickness \. \li |\choose| leaves out the fraction bar and encloses the construct in parentheses. (It's called ``choose'' because $n \choose k$ is the notation for the number of ways of choosing $k$ things out of $n$ things.) \li |\brace| leaves out the fraction bar and encloses the construct in braces. \li |\brack| leaves out the fraction bar and encloses the construct in brackets. \endulist }% \example $${n+1 \over n-1} \qquad {n+1 \atop n-1} \qquad {n+1 \above 2pt n-1} \qquad {n+1 \choose n-1} \qquad {n+1 \brace n-1} \qquad {n+1 \brack n-1}$$ | \dproduces $${n+1 \over n-1} \qquad {n+1 \atop n-1} \qquad {n+1 \above 2pt n-1} \qquad {n+1 \choose n-1} \qquad {n+1 \brace n-1} \qquad {n+1 \brack n-1}$$ \endexample \enddesc \begindesc \cts overwithdelims {\ \} \cts atopwithdelims {\ \} \cts abovewithdelims {\ \ \} \explain Each of these commands stacks one subformula on top of another one and surrounds the entire construct with \ on the left and \ on the right. These commands follow the same rules as |\over|, |\atop|, and |\above|. The \ in |\abovewithdelims| specifies the thickness of the fraction bar. \example $${m \overwithdelims () n}\qquad {m \atopwithdelims !|!| n}\qquad {m \abovewithdelims \{\} 2pt n}$$ | \dproduces $${m \overwithdelims () n}\qquad {m \atopwithdelims || n}\qquad {m \abovewithdelims \{\} 2pt n}$$ \endexample \enddesc \begindesc \cts cases {} \explain ^^{combinations, notation for} This command produces the mathematical form that denotes a choice among several cases. Each case has two parts, separated by `|&|'. \TeX\ treats the first part as a math formula and the second part as ordinary text. Each case must be followed by |\cr|. \example $$g(x,y) = \cases{f(x,y),&if $xy$\cr 0,&otherwise.\cr}$$ | \dproduces $$g(x,y) = \cases{f(x,y),&if $xy$\cr 0,&otherwise.\cr}$$ \endexample \enddesc \begindesc \cts underbrace {\} \cts overbrace {\} \cts underline {\} \cts overline {\} \cts overleftarrow {\} \cts overrightarrow {\} \explain These commands place extensible ^{braces}, lines, or ^{arrows} over or under the subformula given by \. \TeX\ will make these constructs as wide as they need to be for the context. When \TeX\ produces the extended braces, lines, or arrows, it considers only the dimensions of the \minref{box} containing \. If you use more than one of these commands in a single formula, the braces, lines, or arrows they produce may not line up properly with each other. You can use the |\mathstrut| command (\xref \mathstrut) to overcome this difficulty. \example $$\displaylines{ \underbrace{x \circ y}\qquad \overbrace{x \circ y}\qquad \underline{x \circ y}\qquad \overline{x \circ y}\qquad \overleftarrow{x \circ y}\qquad \overrightarrow{x \circ y}\cr {\overline r + \overline t}\qquad {\overline {r \mathstrut} + \overline {t \mathstrut}}\cr }$$ | \dproduces $$\displaylines{ \underbrace{x \circ y}\qquad \overbrace{x \circ y}\qquad \underline{x \circ y}\qquad \overline{x \circ y}\qquad \overleftarrow{x \circ y}\qquad \overrightarrow{x \circ y}\cr {\overline r + \overline t}\qquad {\overline {r \mathstrut} + \overline {t \mathstrut}}\cr }$$ \endexample \enddesc \begindesc\secondprinting{\vglue-.5\baselineskip\vskip0pt} \cts buildrel {\ {\bt \\over} \} \explain ^^{relations//putting formulas above} This command produces a \minref{box} in which \ is placed on top of \. \TeX\ treats the result as a relation for spacing purposes \seeconcept{class}. \example $\buildrel \rm def \over \equiv$ | \produces $\buildrel \rm def \over \equiv$ \eix^^{fractions} \eix^^{stacking subformulas} \endexample \enddesc \secondprinting{\vfill\eject} %========================================================================== \subsection {Dots} \begindesc \bix^^{dots} \easy\cts ldots {} \cts cdots {} \explain These commands produce three ^{dots} in a row. For |\ldots|, the dots are on the baseline; for |\cdots|, the dots are centered with respect to the axis (see the explanation of |\vcenter|, \xref\vcenter). \example $t_1 + t_2 + \cdots + t_n \qquad x_1,x_2, \ldots\,, x_r$ | \produces $t_1 + t_2 + \cdots + t_n \qquad x_1,x_2, \ldots\,, x_r$ \endexample \enddesc \begindesc \easy\cts vdots {} \explain This command produces three vertical dots. \example $$\eqalign{f(\alpha_1)& = f(\beta_1)\cr \noalign{\kern -4pt}% &\phantom{a}\vdots\cr % moves the dots right a bit f(\alpha_k)& = f(\beta_k)\cr}$$ | \dproduces $$\eqalign{f(\alpha_1)& = f(\beta_1)\cr \noalign{\kern -4pt}% &\phantom{a}\vdots\cr f(\alpha_k)& = f(\beta_k)\cr}$$ \endexample \enddesc \begindesc \cts ddots {} \explain This command produces three dots on a diagonal. Its most common use is to indicate repetition along the diagonal of a matrix. \example $$\pmatrix{0&\ldots&0\cr \vdots&\ddots&\vdots\cr 0&\ldots&0\cr}$$ | \dproduces $$\pmatrix{0&\ldots&0\cr \vdots&\ddots&\vdots\cr 0&\ldots&0\cr}$$ \eix^^{dots} \endexample \enddesc \see |\dots| \ctsref\dots. %========================================================================== \subsection {Delimiters} \begindesc \bix^^{delimiters} % \cts lgroup {} \cts rgroup {} \explain These commands produce large left and right ^{parentheses} that are defined as opening and closing \minref{delimiter}s. The smallest available size for these delimiters is |\Big|. If you use smaller sizes, you'll get weird characters. \example $$\lgroup\dots\rgroup\qquad\bigg\lgroup\dots\bigg\rgroup$$ | \dproduces $$\lgroup\dots\rgroup\qquad\bigg\lgroup\dots\bigg\rgroup$$ \endexample \enddesc \begindesc \margin{{\tt\\vert} and {\tt\\Vert} were explained elsewhere.} \easy\cts left {} \cts right {} \explain These commands must be used together in the pattern: \display {{\bt \\left} \ \ {\bt \\right} \} This construct causes \TeX\ to produce \, enclosed in the \minref{delimiter}s \ and \. The vertical size of the delimiter is adjusted to fit the vertical size (height plus depth) of \. \ and \ need not correspond. For instance, you could use `|]|' as a left delimiter and `|(|' as a right delimiter in a single use of |\left| and |\right|. |\left| and |\right| have the important property that they define a group, i.e., they act like left and right braces. This grouping property is particularly useful when you put ^|\over| (\xref{\over}) or a related command between |\left| and |\right|, since you don't need to put braces around the fraction constructed by |\over|. If you want a left delimiter but not a right delimiter, you can use `|.|' in place of the delimiter you don't want and it will turn into empty space (of width ^|\nulldelimiterspace|). \example $$\left\Vert\matrix{a&b\cr c&d\cr}\right\Vert \qquad \left\uparrow q_1\atop q_2\right.$$ | \dproduces $$\left\Vert\matrix{a&b\cr c&d\cr}\right\Vert \qquad \left\uparrow q_1\atop q_2\right.$$ \endexample \enddesc \begindesc \cts delimiter {\} \explain This command produces a delimiter whose characteristics are given by \. \ is normally written in hexadecimal notation. You can use the |\delimiter| command instead of a character in any context where \TeX\ expects a delimiter (although the command is rarely used outside of a macro definition). Suppose that \ is the hexadecimal number $cs_1s_2s_3 l_1l_2l_3$. Then \TeX\ takes the delimiter to have \minref{class} $c$, small variant $s_1s_2s_3$, and large variant $l_1l_2l_3$. Here $s_1s_2s_3$ indicates the math character found in position $s_2s_3$ of family $s_1$, and similarly for $l_1l_2l_3$. This is the same convention as the one used for ^|\mathcode| (\xref\mathcode). \example \def\vert{\delimiter "026A30C} % As in plain TeX. | \endexample \enddesc \begindesc \margin{{\tt\\delcode} was explained in two places. The combined explanation is now in `General operations'.} \cts delimiterfactor {\param{number}} \cts delimitershortfall {\param{number}} \explain ^^{delimiters//height of} These parameters together tell \TeX\ how the height of a \minref{delimiter} should be related to the vertical size of the subformula with which the delimiter is associated. |\delimiterfactor| gives the minimum ratio of the delimiter size to the vertical size of the subformula, and |\delimitershortfall| gives the maximum by which the height of the delimiter will be reduced from that of the vertical size of the subformula. Suppose that the \minref{box} containing the subformula has height $h$ and depth $d$, and let $y=2\,\max(h,d)$. Let the value of |\delimiterfactor| be $f$ and the value of |\delimitershortfall| be $\delta$. Then \TeX\ takes the minimum delimiter size to be at least $y \cdot f/1000$ and at least $y-\delta$. In particular, if |\delimiterfactor| is exactly $1000$ then \TeX\ will try to make a delimiter at least as tall as the formula to which it is attached. See \knuth{page~152 and page~446 (Rule 19)} for the exact details of how \TeX\ uses these parameters. \PlainTeX\ sets |\delimiter!-factor| to $901$ and |\delimiter!-shortfall| to |5pt|. \enddesc \see |\delcode| (\xref\delcode), |\vert|, |\Vert|, and |\backslash| (\xref\vert). \eix^^{delimiters} %========================================================================== \subsection {Matrices} \begindesc \cts matrix {{\bt \rqbraces{\ \\cr $\ldots$ \ \\cr}}} \cts pmatrix {{\bt \rqbraces{\ \\cr $\ldots$ \ \\cr}}} \cts bordermatrix {{\bt \rqbraces{\ \\cr $\ldots$ \ \\cr}}} \explain Each of these three commands produces a ^{matrix}. The elements of each row of the input matrix are separated by `|&|' and each row in turn is ended by |\cr|. (This is the same form that is used for an \minref{alignment}.) The commands differ in the following ways: \ulist\compact \li |\matrix| produces a matrix without any surrounding or inserted \minref{delimiter}s. \li |\pmatrix| produces a matrix surrounded by parentheses. \li |\bordermatrix| produces a matrix in which the first row and the first column are treated as labels. (The first element of the first row is usually left blank.) The rest of the matrix is enclosed in parentheses. \endulist \TeX\ can make the parentheses for |\pmatrix| and |\bordermatrix| as large as they need to be by inserting vertical extensions. If you want a matrix to be surrounded by delimiters other than parentheses, you should use |\matrix| in conjunction with |\left| and |\right| (\xref \left). \example $$\displaylines{ \matrix{t_{11}&t_{12}&t_{13}\cr t_{21}&t_{22}&t_{23}\cr t_{31}&t_{32}&t_{33}\cr}\qquad \left\{\matrix{t_{11}&t_{12}&t_{13}\cr t_{21}&t_{22}&t_{23}\cr t_{31}&t_{32}&t_{33}\cr}\right\}\cr \pmatrix{t_{11}&t_{12}&t_{13}\cr t_{21}&t_{22}&t_{23}\cr t_{31}&t_{32}&t_{33}\cr}\qquad \bordermatrix{&c_1&c_2&c_3\cr r_1&t_{11}&t_{12}&t_{13}\cr r_2&t_{21}&t_{22}&t_{23}\cr r_3&t_{31}&t_{32}&t_{33}\cr}\cr}$$ | \dproduces $$\displaylines{ \matrix{t_{11}&t_{12}&t_{13}\cr t_{21}&t_{22}&t_{23}\cr t_{31}&t_{32}&t_{33}\cr}\qquad \left\{\matrix{t_{11}&t_{12}&t_{13}\cr t_{21}&t_{22}&t_{23}\cr t_{31}&t_{32}&t_{33}\cr}\right\}\cr \pmatrix{t_{11}&t_{12}&t_{13}\cr t_{21}&t_{22}&t_{23}\cr t_{31}&t_{32}&t_{33}\cr}\qquad \bordermatrix{&c_1&c_2&c_3\cr r_1&t_{11}&t_{12}&t_{13}\cr r_2&t_{21}&t_{22}&t_{23}\cr r_3&t_{31}&t_{32}&t_{33}\cr}\cr}$$ \endexample \enddesc %========================================================================== \subsection {Roots and radicals} \begindesc \easy\cts sqrt {\} \explain This command produces the notation for the square root of \. \example $$x = {-b\pm\sqrt{b^2-4ac} \over 2a}$$ | \dproduces $$x = {-b\pm\sqrt{b^2-4ac} \over 2a}$$ \endexample \enddesc \begindesc \easy\cts root {\ {\bt \\of} \} \explain This command produces the notation for a root of \, where the root is given by \. \example $\root \alpha \of {r \cos \theta}$ | \produces $\root \alpha \of {r \cos \theta}$ \endexample \enddesc \begindesc \cts radical {\} \explain This command produces a radical sign whose characteristics are given by \. It uses the same representation as the delimiter code ^^{delimiter codes} in the ^|\delcode| command (\xref \delcode). \example \def\sqrt{\radical "270370} % as in plain TeX | \endexample \enddesc %========================================================================== \section {Equation numbers} \begindesc \easy\cts eqno {} \cts leqno {} \explain These commands attach an equation number to a displayed formula. |\eqno| puts the equation number on the right and |\leqno| puts it on the left. The commands must be given at the end of the formula. If you have a multiline display and you want to number more than one of the lines, use the |\eq!-alignno| or |\leq!-alignno| command (\xref \eqalignno). These commands are valid only in display math mode. \example $$e^{i\theta} = \cos \theta + i \sin \theta\eqno{(11)}$$ | \produces $$e^{i\theta} = \cos \theta + i \sin \theta\eqno{(11)}$$ \endexample \example $$\cos^2 \theta + \sin^2 \theta = 1\leqno{(12)}$$ | \produces \abovedisplayskip = -\baselineskip $$\cos^2 \theta + \sin^2 \theta = 1\leqno{(12)}$$ \endexample \enddesc %========================================================================== \section {Multiline displays} \begindesc \bix^^{displays//multiline} \cts displaylines {{\bt \rqbraces{\\ths\\cr$\ldots$\\ths\\cr}}} \explain This command produces a multiline math display in which each line is centered independently of the other lines. You can use the |\noalign| command (\xref \noalign) to change the amount of space between two lines of a multiline display. If you want to attach equation numbers to some or all of the equations in a multiline math display, you should use |\eqalignno| or |\leqalignno|. \example $$\displaylines{(x+a)^2 = x^2+2ax+a^2\cr (x+a)(x-a) = x^2-a^2\cr}$$ | \dproduces\centereddisplays $$\displaylines{ (x+a)^2 = x^2+2ax+a^2\cr (x+a)(x-a) = x^2-a^2\cr }$$ \endexample \enddesc \begindesc \cts eqalign {} {{\bt \rqbraces{\ \\cr $\ldots$ \ \\cr}}} \cts eqalignno {} {{\bt \rqbraces{\ \\cr $\ldots$ \ \\cr}}} \cts leqalignno {} {{\bt \rqbraces{\ \\cr $\ldots$ \ \\cr}}} \explain ^^{equation numbers} These commands produce a multiline math display in which certain corresponding parts of the lines are lined up vertically. The |\eqalignno| and |\leqalignno| commands also let you provide equation numbers for some or all of the lines. |\eqalignno| puts the equation numbers on the right and |\leqalignno| puts them on the left. Each line in the display is ended by |\cr|. Each of the parts to be aligned (most often an equals sign) is preceded by `|&|'. An `|&|' also precedes each equation number, which comes at the end of a line. You can put more than one of these commands in a single display in order to produce several groups of equations. In this case, only the rightmost or leftmost group can be produced by |\eqalignno| or |\leqalignno|. You can use the |\noalign| command (\xref \noalign) to change the amount of space between two lines of a multiline display. \example $$\left\{\eqalign{f_1(t) &= 2t\cr f_2(t) &= t^3\cr f_3(t) &= t^2-1\cr}\right\} \left\{\eqalign{g_1(t) &= t\cr g_2(t) &= 1}\right\}$$ | \dproduces $$\left\{\eqalign{f_1(t) &= 2t\cr f_2(t) &= t^3\cr f_3(t) &= t^2-1\cr}\right\} \left\{\eqalign{g_1(t) &= t\cr g_2(t) &= 1}\right\}$$ \nextexample $$\eqalignno{ \sigma^2&=E(x-\mu)^2&(12)\cr &={1 \over n}\sum_{i=0}^n (x_i - \mu)^2&\cr &=E(x^2)-\mu^2\cr}$$ | \produces \abovedisplayskip = -\baselineskip $$\eqalignno{ \sigma^2&=E(x-\mu)^2&(12)\cr &={1 \over n}\sum_{i=0}^n (x_i - \mu)^2&\cr &=E(x^2)-\mu^2\cr}$$ \nextexample $$\leqalignno{ \sigma^2&=E(x-\mu)^2&(6)\cr &=E(x^2)-\mu^2&(7)\cr}$$ | \produces \abovedisplayskip = -\baselineskip $$\leqalignno{ \sigma^2&=E(x-\mu)^2&(6)\cr &=E(x^2)-\mu^2&(7)\cr}$$ \nextexample $$\eqalignno{ &(x+a)^2 = x^2+2ax+a^2&(19)\cr &(x+a)(x-a) = x^2-a^2\cr}$$ % same effect as \displaylines but with an equation number | \dproduces $$\eqalignno{ &(x+a)^2 = x^2+2ax+a^2&(19)\cr &(x+a)(x-a) = x^2-a^2\cr }$$ % same effect as \displaylines but with an equation number \eix^^{displays//multiline} \endexample \enddesc %========================================================================== \section {Fonts in math formulas} \begindesc ^^{fonts} \xrdef{mathfonts} % \easy\ctsx cal {use calligraphic uppercase font} \ctsx mit {use math italic font} \ctsx oldstyle {use old style digit font} \explain These commands cause \TeX\ to typeset the following text in the specified font. You can only use them in \minref{math mode}. The |\mit| command is useful for producing slanted capital ^{Greek letters}. You can also use the commands given in \headcit{Selecting fonts}{selfont} to change fonts in math mode. \example ${\cal XYZ} \quad {\mit AaBb\Gamma \Delta \Sigma} \quad {\oldstyle 0123456789}$ | \produces ${\cal XYZ} \quad {\mit AaBb\Gamma \Delta \Sigma} \quad {\oldstyle 0123456789}$ \endexample \enddesc ^^{type styles} \begindesc \ctsx itfam {family for italic type} \ctsx bffam {family for boldface type} \ctsx slfam {family for slanted type} \ctsx ttfam {family for typewriter type} \explain These commands define type families \minrefs{family} for use in \minref{math mode}. Their principal use is in defining the |\it|, |\bf|, |\sl|, and |\tt| commands so that they work in math mode. \enddesc \begindesc \cts fam {\param{number}} \explain When \TeX\ is in \minref{math mode}, it ordinarily typesets a character using the font family ^^{class} given in its \minref{mathcode}. ^^{family//given by \b\tt\\fam\e} However, when \TeX\ is in math mode and encounters a character whose \minref{class} is $7$ (Variable), it typesets that character using the font \minref{family} given by the value of |\fam|, provided that the value of |\fam| is between $0$ and $15$. If the value of |\fam| isn't in that range, \TeX\ uses the family in the character's mathcode as in the ordinary case. \TeX\ sets |\fam| to $-1$ whenever it enters math mode. Outside of math mode, |\fam| has no effect. By assigning a value to |\fam| you can change the way that \TeX\ typesets ordinary characters such as variables. For instance, by setting |\fam| to |\ttfam|, you cause \TeX\ to typeset variables using a typewriter font. \PlainTeX\ defines |\tt| as a \minref{macro} that, among other things, sets |\fam| to |\ttfam|. \example \def\bf{\fam\bffam\tenbf} % As in plain TeX. | \endexample \enddesc \begindesc \cts textfont {\\param{fontname}} \cts scriptfont {\\param{fontname}} \cts scriptscriptfont {\\param{fontname}} \explain ^^{text style} ^^{script style} ^^{scriptscript style} Each of these parameters specifies the font that \TeX\ is to use for typesetting the indicated \minref{style} in the indicated \minref{family}. These choices have no effect outside of \minref{math mode}. \example \scriptfont2 = \sevensy % As in plain TeX. | \endexample \enddesc \see ``Type styles'' (\xref{seltype}). %========================================================================== \section {Constructing math symbols} %========================================================================== \subsection {Making delimiters bigger} \begindesc \makecolumns 16/4: \easy\cts big {} \cts bigl {} \cts bigm {} \cts bigr {} \cts Big {} \cts Bigl {} \cts Bigm {} \cts Bigr {} \cts bigg {} \cts biggl {} \cts biggm {} \cts biggr {} \cts Bigg {} \cts Biggl {} \cts Biggm {} \cts Biggr {} \explain ^^{delimiters//enlarging} These commands make \minref{delimiter}s bigger than their normal size. The commands in the four columns produce successively larger sizes. The difference between |\big|, |\bigl|, |\bigr|, and |bigm| has to do with the \minref{class} of the enlarged delimiter: \ulist\compact \li |\big| produces an ordinary symbol. \li |\bigl| produces an opening symbol. \li |\bigr| produces a closing symbol. \li |\bigm| produces a relation symbol. \endulist \noindent \TeX\ uses the class of a symbol in order to decide how much space to put around that symbol. These commands, unlike |\left| and |\right|, do \emph{not} define a group. \example $$(x) \quad \bigl(x\bigr) \quad \Bigl(x\Bigr) \quad \biggl(x\biggr) \quad \Biggl(x\Biggr)\qquad [x] \quad \bigl[x\bigr] \quad \Bigl[x\Bigr] \quad \biggl[x\biggr] \quad \Biggl[x\Biggr]$$ | \dproduces $$(x) \quad \bigl(x\bigr) \quad \Bigl(x\Bigr) \quad \biggl(x\biggr) \quad \Biggl(x\Biggr)\qquad [x] \quad \bigl[x\bigr] \quad \Bigl[x\Bigr] \quad \biggl[x\biggr] \quad \Biggl[x\Biggr]$$ \endexample \enddesc %========================================================================== \subsection {Parts of large symbols} \begindesc \cts downbracefill {} \cts upbracefill {} \explain These commands respectively produce upward-pointing and downward-pointing extensible ^{horizontal braces}. ^^{braces} \TeX\ will make the braces as wide as necessary. These commands are used in the definitions of ^|\overbrace| and ^|\underbrace| (\xref \overbrace). \example $$\hbox to 1in{\downbracefill} \quad \hbox to 1in{\upbracefill}$$ | \dproduces $$\hbox to 1in{\downbracefill} \quad \hbox to 1in{\upbracefill}$$ \endexample \enddesc \begindesc \cts arrowvert {} \cts Arrowvert {} \cts lmoustache {} \cts rmoustache {} \cts bracevert {} \explain These commands produce portions of certain large delimiters ^^{delimiters//parts of} and can themselves be used as delimiters. They refer to characters in the ^|cmex10| math font. \example $$\cdots \Big\arrowvert \cdots \Big\Arrowvert \cdots \Big\lmoustache \cdots \Big\rmoustache \cdots \Big\bracevert \cdots$$ | \dproduces $$\cdots \Big\arrowvert \cdots \Big\Arrowvert \cdots \Big\lmoustache \cdots \Big\rmoustache \cdots \Big\bracevert \cdots$$ \endexample \enddesc %========================================================================== \section {Aligning parts of a formula} %========================================================================== \subsection {Aligning accents} \begindesc \bix^^{accents//aligning} \cts skew {\ \ \} \explain This command shifts the accent \ by \ \minref{mathematical unit}s to the right of its normal position with respect to \. The most common use of this command is for modifying the position of an accent that's over another accent. \example $$\skew 2\bar{\bar z}\quad\skew 3\tilde{\tilde y}\quad \skew 4\tilde{\hat x}$$ | \dproduces $$\skew 2\bar{\bar z}\quad\skew 3\tilde{\tilde y}\quad \skew 4\tilde{\hat x}$$ \endexample \enddesc \begindesc \cts skewchar {\\param{number}} \explain The |\skewchar| of a font is the character in the font whose kerns, as defined in the font's metrics file, determine the positions of math accents. That is, suppose that \TeX\ is applying a math accent to the character `|x|'. \TeX\ checks if the character pair `|x\skewchar|' has a kern; if so, it moves the accent by the amount of that kern. The complete algorithm that \TeX\ uses to position math accents (which involves many more things) is in \knuth{Appendix~G}. If the value of |\skewchar| is not in the range $0$--$255$, \TeX\ takes the kern value to be zero. Note that \ is a control sequence that names a font, not a \ that names font files. Beware: an assignment to |\skewchar| is \emph{not} undone at the end of a group. If you want to change |\skewchar| locally, you'll need to save and restore its original value explicitly. \enddesc \begindesc \cts defaultskewchar {\param{number}} \explain When \TeX\ reads the metrics file ^^{metrics file//default skew character in} for a font in response to a ^|\font| command, it sets the font's ^|\skewchar| to |\default!-skewchar|. If the value of |\default!-skewchar| is not in the range $0$--$255$, \TeX\ does not assign any skew characters by default. \PlainTeX\ sets |\defaultskewchar| to $-1$, and it's usually best to leave it there. \margin{Misleading example deleted.} \eix^^{accents//aligning} \enddesc %========================================================================== \subsection {Aligning material vertically} \begindesc \cts vcenter {\rqbraces{\}} \ctsbasic {\\vcenter to \ \rqbraces{\}}{} \ctsbasic {\\vcenter spread \ \rqbraces{\}}{} \explain Every math formula has an invisible ``^{axis}'' that \TeX\ treats as a kind of horizontal centering line for that formula. For instance, the axis of a formula consisting of a fraction is at the center of the fraction bar. The |\vcenter| command tells \TeX\ to place the \ in a \minref{vbox} and to center the vbox with respect to the axis of the formula it is currently constructing. The first form of the command centers the material as given. The second and third forms expand or shrink the material vertically as in the |\vbox| command (\xref \vbox). \example $${n \choose k} \buildrel \rm def \over \equiv \> \vcenter{\hsize 1.5 in \noindent the number of combinations of $n$ things taken $k$ at a time}$$ | \dproduces $${n \choose k} \buildrel \rm def \over \equiv \> \vcenter{\hsize 1.5 in \noindent the number of combinations of $n$ things taken $k$ at a time}$$ \endexample \enddesc %========================================================================== \section {Producing spaces} %========================================================================== \subsection {Fixed-width math spaces} \begindesc \bix^^{space//in math formulas} \ctspecial ! \ctsxrdef{@shriek} \ctspecial , \ctsxrdef{@comma} \ctspecial > \ctsxrdef{@greater} \ctspecial ; \ctsxrdef{@semi} \explain These commands produce various amounts of ^{extra space} in formulas. They are defined in terms of \minref{mathematical unit}s, so \TeX\ adjusts the amount of space according to the current \minref{style}. \ulist \li |\!!| produces a negative thin space, i.e., it reduces the space between its neighboring subformulas by the amount of a thin space. \li |\,| produces a thin space. \li |\>| produces a medium space. \li |\;| produces a thick space. \endulist \example $$00\quad0\!!0\quad0\,0\quad0\>0\quad0\;0\quad {\scriptstyle 00\quad0\!!0\quad0\,0\quad0\>0\quad0\;0}$$ | \dproduces $$00\quad0\!0\quad0\,0\quad0\>0\quad0\;0\quad {\scriptstyle 00\quad0\!0\quad0\,0\quad0\>0\quad0\;0}$$ \endexample \enddesc \begindesc \cts thinmuskip {\param{muglue}} \cts medmuskip {\param{muglue}} \cts thickmuskip {\param{muglue}} \explain These parameters define thin, medium, and thick spaces in math mode. \example $00\quad0\mskip\thinmuskip0\quad0\mskip\medmuskip0 \quad0\mskip\thickmuskip0$ | \produces $00\quad0\mskip\thinmuskip0\quad0\mskip\medmuskip0 \quad0\mskip\thickmuskip0$ \endexample \enddesc \begindesc \cts jot {\param{dimen}} \explain This parameter defines a distance that is equal to three points (unless you change it). The |\jot| is a convenient unit of measure for opening up \hbox{math displays}. \enddesc %========================================================================== \subsection {Variable-width math spaces} \begindesc \cts mkern {\} \explain ^^{kerns//in math formulas} This command produces a \minref{kern}, i.e., blank space, of width \. The kern is measured in \minref{mathematical unit}s, which vary according to the style. Aside from its unit of measurement, this command behaves just like |\kern| (\xref \kern) does in horizontal mode. \example $0\mkern13mu 0 \qquad {\scriptscriptstyle 0 \mkern13mu 0}$ | \produces $0\mkern13mu 0 \qquad {\scriptscriptstyle 0 \mkern13mu 0}$ \endexample \enddesc \begindesc \cts mskip {\ {\bt plus} \ {\bt minus} \} \explain ^^{glue} This command produces horizontal \minref{glue} that has natural width \, stretch \, and shrink \. The glue is measured in \minref{mathematical unit}s, which vary according to the style. Aside from its units of measurement, this command behaves just like |\hskip| (\xref \hskip). \example $0\mskip 13mu 0 \quad {\scriptscriptstyle 0 \mskip 13mu 0}$ | \produces $0\mskip 13mu 0 \quad {\scriptscriptstyle 0 \mskip 13mu 0}$ \endexample \enddesc \begindesc \cts nonscript {} \explain When \TeX\ is currently typesetting in script or scriptscript \minref{style} and encounters this command immediately in front of glue or a kern, it cancels the glue or kern. |\nonscript| has no effect in the other styles. This command provides a way of ``tightening up'' the spacing in script and scriptscript styles, which generally are set in smaller type. It is of little use outside of macro definitions. \example \def\ab{a\nonscript\; b} $\ab^{\ab}$ | \produces \def\ab{a\nonscript\; b} $\ab^{\ab}$ \endexample \enddesc \see |\kern| (\xref\kern), |\hskip| (\xref\hskip). \eix^^{space//in math formulas} %========================================================================== \subsection {Spacing parameters for displays} \begindesc \bix^^{displays//spacing parameters for} \cts displaywidth {\param{dimen}} \explain This parameter specifies the maximum width that \TeX\ allows for a math display. If \TeX\ cannot fit the display into a space of this width, it sets an overfull \minref{hbox} and complains. \TeX\ sets the value of |\displaywidth| when it encounters the `|$$|' that starts the display. This initial value is |\hsize| (\xref \hsize) unless it's overridden by changes to the paragraph shape. See \knuth{pages~188--189} for a more detailed explanation of this parameter. \enddesc \begindesc \cts displayindent {\param{dimen}} \explain This parameter specifies the space by which \TeX\ indents a math display. \TeX\ sets the value of |\displayindent| when it encounters the `|$$|' that starts the display. Usually this initial value is zero, but if the paragraph shape indicates that the display should be shifted by an amount $s$, \TeX\ will set |\displayindent| to $s$. See \knuth{pages~188--189} for a more detailed explanation of this parameter. \enddesc \begindesc \cts predisplaysize {\param{dimen}} \explain \TeX\ sets this parameter to the width of the line preceding a math display. \TeX\ uses |\predisplaysize| to determine whether or not the display starts to the left of where the previous line ends, i.e., whether or not it visually overlaps the previous line. If there is overlap, it uses the |\abovedisplayskip| and |\belowdisplayskip| glue in setting the display; otherwise it uses the |\abovedisplay!-shortskip| and |\belowdisplay!-shortskip| glue. See \knuth{pages~188--189} for a more detailed explanation of this parameter. \enddesc \begindesc \cts abovedisplayskip {\param{glue}} \explain This parameter specifies the amount of vertical glue that \TeX\ inserts before a display when the display starts to the left of where the previous line ends, i.e., when it visually overlaps the previous line. \PlainTeX\ sets |\abovedisplayskip| to |12pt plus3pt minus9pt|. See \knuth{pages~188--189} for a more detailed explanation of this parameter. \enddesc \begindesc \cts belowdisplayskip {\param{glue}} \explain This parameter specifies the amount of vertical glue that \TeX\ inserts after a display when the display starts to the left of where the previous line ends, i.e., when it visually overlaps the previous line. \PlainTeX\ sets |\belowdisplay!-skip| to |12pt plus3pt minus9pt|. See \knuth{pages~188--189} for a more detailed explanation of this parameter. \enddesc \begindesc \cts abovedisplayshortskip {\param{glue}} \explain This parameter specifies the amount of vertical glue that \TeX\ inserts before a math display when the display starts to the right of where the previous line ends, i.e., when it does not visually overlap the previous line. \PlainTeX\ sets |\abovedisplay!-shortskip| to |0pt plus3pt|. See \knuth{pages~188--189} for a more detailed explanation of this parameter. \enddesc \begindesc \cts belowdisplayshortskip {\param{glue}} \explain This parameter specifies the amount of vertical glue that \TeX\ inserts after a display when the display starts to the right of where the previous line ends, i.e., when it does not visually overlap the previous line. \PlainTeX\ sets |\belowdisplay!-shortskip| to |7pt plus3pt minus4pt|. See \knuth{pages~188--189} for a more detailed explanation of this parameter. \eix^^{displays//spacing parameters for} \enddesc %========================================================================== \subsection {Other spacing parameters for math} \begindesc \cts mathsurround {\param{dimen}} \explain This parameter specifies the amount of space that \TeX\ inserts before and after a math formula in text mode (i.e., a formula surrounded by single |$|'s). See \knuth{page~162} for further details about its behavior. \PlainTeX\ leaves |\mathsurround| at |0pt|. \enddesc \begindesc \cts nulldelimiterspace {\param{dimen}} \explain ^^{delimiters//null, space for} This parameter specifies the width of the space produced by a null \minref{delimiter}. \PlainTeX\ sets |\nulldelimiterspace| to |1.2pt|. \enddesc \begindesc \cts scriptspace {\param{dimen}} \explain This parameter specifies the amount of space that \TeX\ inserts before and after a subscript or superscript. The |\nonscript| command (\xref\nonscript) ^^|\nonscript| after a subscript or superscript cancels this space. \PlainTeX\ sets |\script!-space| to |0.5pt|. \enddesc %========================================================================== \section {Categorizing math constructs} \begindesc \makecolumns 7/2: \cts mathord {} \cts mathop {} \cts mathbin {} \cts mathrel {} \cts mathopen {} \cts mathclose {} \cts mathpunct {} \explain These commands tell \TeX\ to treat the construct that follows as belonging to a particular ^{class} (see \knuth{page~154} for the definition of the classes). They are listed here in the order of the class numbers, from $0$ to $6$. Their primary effect is to adjust the spacing around the construct to be whatever it is for the specified class. \example $\mathop{\rm minmax}\limits_{t \in A \cup B}\,t$ % By treating minmax as a math operator, we can get TeX to % put something underneath it. | \produces $\mathop{\rm minmax}\limits_{t \in A \cup B}\,t$ \endexample \enddesc \begindesc \cts mathinner {} \explain This command tells \TeX\ to treat the construct that follows as an ``inner formula'', e.g., a fraction, for spacing purposes. It resembles the class commands given just above. \enddesc %========================================================================== \section {Special actions for math formulas} \begindesc \cts everymath {\param{token list}} \cts everydisplay {\param{token list}} \explain ^^{displays//actions for every display} These parameters specify \minref{token} lists that \TeX\ inserts at the start of every text math or display math formula, respectively. You can take special actions at the start of each math formula by assigning those actions to |\everymath| or |\everydisplay|. Don't forget that if you want both kinds of formulas to be affected, you need to set \emph{both} parameters. \example \everydisplay={\heartsuit\quad} \everymath = {\clubsuit} $3$ is greater than $2$ for large values of $3$. $$4>3$$ | \produces \everydisplay={\heartsuit\quad} \everymath = {\clubsuit} $3$ is greater than $2$ for large values of $3$. $$4>3$$ \endexample \enddesc \enddescriptions \eix^^{math} \endchapter \byebye