[392] | 1 | %% |
---|
| 2 | %% This is file `setstack.sty', created by VIK 15 Dec 1998 |
---|
| 3 | %% Reproduces useful macros from amsmath.sty, thus avoiding the need to load the entire |
---|
| 4 | %% amsmath.sty and run into conflicts |
---|
| 5 | %% Adds definitions for \overset, \underset, \sideset, \substack, \boxed, \leftroot, |
---|
| 6 | %% \uproot, \dddot, \ddddot, \varrow, \harrow (see The LateX Companion, pp 225-227) |
---|
| 7 | \NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) |
---|
| 8 | [1998/12/15]% LaTeX date must December 1998 or later |
---|
| 9 | \ProvidesPackage{setstack} |
---|
| 10 | \DeclareRobustCommand{\text}{% |
---|
| 11 | \ifmmode\expandafter\text@\else\expandafter\mbox\fi} |
---|
| 12 | \let\nfss@text\text |
---|
| 13 | \def\text@#1{\mathchoice |
---|
| 14 | {\textdef@\displaystyle\f@size{#1}}% |
---|
| 15 | {\textdef@\textstyle\tf@size{\firstchoice@false #1}}% |
---|
| 16 | {\textdef@\textstyle\sf@size{\firstchoice@false #1}}% |
---|
| 17 | {\textdef@\textstyle \ssf@size{\firstchoice@false #1}}% |
---|
| 18 | \check@mathfonts |
---|
| 19 | } |
---|
| 20 | \def\textdef@#1#2#3{\hbox{{% |
---|
| 21 | \everymath{#1}% |
---|
| 22 | \let\f@size#2\selectfont #3}}} |
---|
| 23 | |
---|
| 24 | % adds underset, overset, sideset and |
---|
| 25 | % substack features from amsmath.sty (Companion p. 226) |
---|
| 26 | |
---|
| 27 | \def\invalid@tag#1{\@amsmath@err{#1}{\the\tag@help}\gobble@tag} |
---|
| 28 | \def\dft@tag{\invalid@tag{\string\tag\space not allowed here}} |
---|
| 29 | \def\default@tag{\let\tag\dft@tag} |
---|
| 30 | |
---|
| 31 | \def\Let@{\let\\\math@cr} |
---|
| 32 | \def\restore@math@cr{\def\math@cr@@@{\cr}} |
---|
| 33 | |
---|
| 34 | \def\overset#1#2{\binrel@{#2}% |
---|
| 35 | \binrel@@{\mathop{\kern\z@#2}\limits^{#1}}} |
---|
| 36 | \def\underset#1#2{\binrel@{#2}% |
---|
| 37 | \binrel@@{\mathop{\kern\z@#2}\limits_{#1}}} |
---|
| 38 | \def\sideset#1#2#3{% |
---|
| 39 | \@mathmeasure\z@\displaystyle{#3}% |
---|
| 40 | \global\setbox\@ne\vbox to\ht\z@{}\dp\@ne\dp\z@ |
---|
| 41 | \setbox\tw@\box\@ne |
---|
| 42 | \@mathmeasure4\displaystyle{\copy\tw@#1}% |
---|
| 43 | \@mathmeasure6\displaystyle{#3\nolimits#2}% |
---|
| 44 | \dimen@-\wd6 \advance\dimen@\wd4 \advance\dimen@\wd\z@ |
---|
| 45 | \hbox to\dimen@{}\mathop{\kern-\dimen@\box4\box6}% |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | \newenvironment{subarray}[1]{% |
---|
| 49 | \vcenter\bgroup |
---|
| 50 | \Let@ \restore@math@cr \default@tag |
---|
| 51 | \baselineskip\fontdimen10 \scriptfont\tw@ |
---|
| 52 | \advance\baselineskip\fontdimen12 \scriptfont\tw@ |
---|
| 53 | \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ |
---|
| 54 | \lineskiplimit\lineskip |
---|
| 55 | \ialign\bgroup\ifx c#1\hfil\fi |
---|
| 56 | $\m@th\scriptstyle##$\hfil\crcr |
---|
| 57 | }{% |
---|
| 58 | \crcr\egroup\egroup |
---|
| 59 | } |
---|
| 60 | \newcommand{\substack}[1]{\subarray{c}#1\endsubarray} |
---|
| 61 | |
---|
| 62 | % definitions of dddot and ddddot(p. 225) |
---|
| 63 | |
---|
| 64 | \def\dddot#1{{\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@ |
---|
| 65 | \hbox{\normalfont ...}\vss}}}} |
---|
| 66 | \def\ddddot#1{{\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@ |
---|
| 67 | \hbox{\normalfont....}\vss}}}} |
---|
| 68 | |
---|
| 69 | % definitions of leftroot, uproot (p.225) |
---|
| 70 | |
---|
| 71 | \begingroup \catcode`\"=12 |
---|
| 72 | \gdef\@@sqrt#1{\radical"270370 {#1}} |
---|
| 73 | \endgroup |
---|
| 74 | |
---|
| 75 | \def\leftroot{\@amsmath@err{\Invalid@@\leftroot}\@eha} |
---|
| 76 | \def\uproot{\@amsmath@err{\Invalid@@\uproot}\@eha} |
---|
| 77 | \newcount\uproot@ |
---|
| 78 | \newcount\leftroot@ |
---|
| 79 | \def\root{\relaxnext@ |
---|
| 80 | \DN@{\ifx\@let@token\uproot\let\next@\nextii@\else |
---|
| 81 | \ifx\@let@token\leftroot\let\next@\nextiii@\else |
---|
| 82 | \let\next@\plainroot@\fi\fi\next@}% |
---|
| 83 | \def\nextii@\uproot##1{\uproot@##1\relax\FN@\nextiv@}% |
---|
| 84 | \def\nextiv@{\ifx\@let@token\@sptoken\DN@. {\FN@\nextv@}\else |
---|
| 85 | \DN@.{\FN@\nextv@}\fi\next@.}% |
---|
| 86 | \def\nextv@{\ifx\@let@token\leftroot\let\next@\nextvi@\else |
---|
| 87 | \let\next@\plainroot@\fi\next@}% |
---|
| 88 | \def\nextvi@\leftroot##1{\leftroot@##1\relax\plainroot@}% |
---|
| 89 | \def\nextiii@\leftroot##1{\leftroot@##1\relax\FN@\nextvii@}% |
---|
| 90 | \def\nextvii@{\ifx\@let@token\@sptoken |
---|
| 91 | \DN@. {\FN@\nextviii@}\else |
---|
| 92 | \DN@.{\FN@\nextviii@}\fi\next@.}% |
---|
| 93 | \def\nextviii@{\ifx\@let@token\uproot\let\next@\nextix@\else |
---|
| 94 | \let\next@\plainroot@\fi\next@}% |
---|
| 95 | \def\nextix@\uproot##1{\uproot@##1\relax\plainroot@}% |
---|
| 96 | \bgroup\uproot@\z@\leftroot@\z@\FN@\next@} |
---|
| 97 | \def\plainroot@#1\of#2{\setbox\rootbox\hbox{% |
---|
| 98 | $\m@th\scriptscriptstyle{#1}$}% |
---|
| 99 | \mathchoice{\r@@t\displaystyle{#2}}{\r@@t\textstyle{#2}} |
---|
| 100 | {\r@@t\scriptstyle{#2}}{\r@@t\scriptscriptstyle{#2}}\egroup} |
---|
| 101 | \def\r@@t#1#2{\setboxz@h{$\m@th#1\@@sqrt{#2}$}% |
---|
| 102 | \dimen@\ht\z@\advance\dimen@-\dp\z@ |
---|
| 103 | \setbox\@ne\hbox{$\m@th#1\mskip\uproot@ mu$}% |
---|
| 104 | \advance\dimen@ by1.667\wd\@ne |
---|
| 105 | \mkern-\leftroot@ mu\mkern5mu\raise.6\dimen@\copy\rootbox |
---|
| 106 | \mkern-10mu\mkern\leftroot@ mu\boxz@} |
---|
| 107 | |
---|
| 108 | % definition of \boxed (math in frame, no dollars) p 225 |
---|
| 109 | |
---|
| 110 | \def\boxed#1{\fbox{\m@th$\displaystyle#1$}} |
---|
| 111 | |
---|
| 112 | % definition of \smash for top and bottom parts of expression in braces (p.227) |
---|
| 113 | \renewcommand{\smash}[2][tb]{% |
---|
| 114 | \def\smash@{#1}% |
---|
| 115 | \ifmmode\@xp\mathpalette\@xp\mathsm@sh\else |
---|
| 116 | \@xp\makesm@sh\fi{#2}} |
---|
| 117 | |
---|
| 118 | % additional difinitions for arrows |
---|
| 119 | % zero mm wide #2 mm long vertical arrow shifted 1 mm to left, 1 mm up |
---|
| 120 | \newcommand{\varrow}[2]{% |
---|
| 121 | \unitlength=1mm |
---|
| 122 | \begin{picture}(0,6) % (0,0) |
---|
| 123 | % - for #1 to point arrow down,+ to point arrow up |
---|
| 124 | \end{picture}% |
---|
| 125 | \put(0,6){\vector(0,#1 3){#2}} % 6,- for down, 0, + for up |
---|
| 126 | } |
---|
| 127 | % 1 mm high #2 mm long horizontal arrow shifted 1 mm up (0,-1) |
---|
| 128 | \newcommand{\harrow}[2]{% |
---|
| 129 | \unitlength=1mm |
---|
| 130 | \begin{picture}(8,1)(0,-1) % |
---|
| 131 | % 1 mm distance between arrow and stackreled object over it (8,1) |
---|
| 132 | \put(0,0){\vector(#1 2,0){#2}} % - to point arrow left, + right |
---|
| 133 | \end{picture}% |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | \endinput |
---|
| 137 | %% end of setstack.sty |
---|
| 138 | %% Corrections history: |
---|
| 139 | %% |
---|