diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/scalerel/scalerel.pdf | bin | 243550 -> 245461 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/scalerel/scalerel.tex | 212 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/scalerel/scalerel.sty | 56 |
3 files changed, 159 insertions, 109 deletions
diff --git a/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf b/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf Binary files differindex e66d782c307..a7916e39f86 100644 --- a/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf +++ b/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf diff --git a/Master/texmf-dist/doc/latex/scalerel/scalerel.tex b/Master/texmf-dist/doc/latex/scalerel/scalerel.tex index cd153d1fa66..ad4793bc2b2 100644 --- a/Master/texmf-dist/doc/latex/scalerel/scalerel.tex +++ b/Master/texmf-dist/doc/latex/scalerel/scalerel.tex @@ -1,5 +1,5 @@ \documentclass{article} -\def\version{1.4} +\def\version{1.5} %% Copyright 2013 Steven B. Segletes % % This work may be distributed and/or modified under the @@ -27,6 +27,8 @@ % -Added \Isnextbyte as a supplemental routine % -Added \scaleobj (like \scalebox, but defaults to math mode % using current display style). +% V1.5 -Eliminated mathstyle package because of incompatibilites with +% many other packages. Implemented \mathchoice approach instead. \parskip 1em \parindent 0em \newcommand\rl{\rule{2em}{0in}} @@ -35,6 +37,11 @@ \usepackage[only,llbracket,rrbracket,llparenthesis,rrparenthesis]{stmaryrd} \usepackage{accsupp} % for ensuring the right Unicode codepoint upon pasting \def\sr{\textsf{scalerel}} +\let\vb\verb +\reversemarginpar +\marginparwidth 1.6in +\newcommand\margtt[1]{\marginpar{\hfill\ttfamily#1}} +\newcommand\margcmd[1]{\marginpar{\hfill\ttfamily\char'134#1}} \begin{document} \begin{center} @@ -55,7 +62,7 @@ math in the objects to manipulate); however, the objects it manipulates will, by default, be processed in math mode. Nonetheless, one may process the objects in text mode (assuming they do not contain math-specific characters or commands) by specifying arguments as -\verb|{$object$}|, instead of the usual \verb|{object}|. +\vb|{$object$}|, instead of the usual \vb|{object}|. There are four basic commands with the \textsf{scalerel} package, two of which have star variants: @@ -79,88 +86,108 @@ compatibility, \textit{etc.}: \begin{verbatim} \ignoremathstyle \discernmathstyle + \ThisStyle{...\SavedStyle...} \Isnextbyte[[v] OR q]{test byte}{string} \end{verbatim} -In all cases, \verb|object| is the object to be scaled or +In all cases, \vb|object| is the object to be scaled or stretched. It can be as simple as a symbol, like a summation sign ($\sum$), or it can be an object of complex description. Likewise, in -cases of \textit{relative} scaling and stretching, \verb|reference| is +cases of \textit{relative} scaling and stretching, \vb|reference| is the reference object in relation to which the manipulated -\verb|object| is scaled or vertically stretched. The \verb|reference| +\vb|object| is scaled or vertically stretched. The \vb|reference| may likewise be of complex description (such as a mathematical -expression). When an \verb|object| is scaled or stretched -\textit{relative} to a \verb|reference| object, it is also vertically +expression). When an \vb|object| is scaled or stretched +\textit{relative} to a \vb|reference| object, it is also vertically shifted, if necessary, so that its vertical extent conforms to that of -the \verb|reference| object. +the \vb|reference| object. In cases of scaling or stretching \textit{to} a specified size, -\verb|height| will the final vertical height of \verb|object| following +\vb|height| will the final vertical height of \vb|object| following a scale or stretch manipulation. Since scaling or stretching to an -absolute size provides no \verb|reference| object, the baseline of -manipulated \verb|object| remains unchanged. +absolute size provides no \vb|reference| object, the baseline of +manipulated \vb|object| remains unchanged. In cases of scaling (relative or absolute), the constraint -\verb|max_width| is optionally specified as the maximum width allowable +\vb|max_width| is optionally specified as the maximum width allowable for the manipulated object. If the manipulated width would otherwise exceed this limit, the -\verb|object| width is scaled back to this limit. If the \verb|object| +\vb|object| width is scaled back to this limit. If the \vb|object| width is scaled back, its aspect ratio will change with respect to its original shape. By definition, vertical stretching will change the aspect ratio of an object. In the case of stretching (relative or absolute), the -constraint \verb|min_aspect| is the minimum aspect ratio allowed by the +constraint \vb|min_aspect| is the minimum aspect ratio allowed by the stretch. Its value is given in \%, such that a parameter value of \texttt{100} indicates 100\% or an aspect ratio of 1. If the stretch -would otherwise cause the manipulated \verb|object|'s aspect ratio to -fall below this value, the width of the manipulated \verb|object| is +would otherwise cause the manipulated \vb|object|'s aspect ratio to +fall below this value, the width of the manipulated \vb|object| is increased to meet this minimum threshold. The value of -\verb|min_aspect| must be an integer. +\vb|min_aspect| must be an integer. Because \textit{relative} scaling or stretching is done -\textit{relative} to a reference object, the \verb|\scalerel| and -\verb|\stretchrel| commands will, by default, print out the -manipulated \verb|object| followed immediately by the \verb|reference| +\textit{relative} to a reference object, the \vb|\scalerel| and +\margcmd{scalerel}\margcmd{stretchrel}% +\vb|\stretchrel| commands will, by default, print out the +manipulated \vb|object| followed immediately by the \vb|reference| object. Because this may not always be desired, the star (*) version of -these commands suppresses the output of the \verb|reference| object, so -that only the \verb|object| that was manipulated is output. +these commands suppresses the output of the \vb|reference| object, so +that only the \vb|object| that was manipulated is output. -The \verb|\scaleleftright| and \verb|\stretchleftright| commands are -intended to provide the functional capability of the \verb|\left| and -\verb|\right| commands in math mode, for delimiting symbols not +The \vb|\scaleleftright| and \vb|\stretchleftright| commands +\margcmd{scaleleftright}\margcmd{stretchleftright}% +are intended to provide the functional capability of the \vb|\left| and +\vb|\right| commands in math mode, for delimiting symbols not otherwise supported by those commands. -The \verb|\hstretch| and \verb|\vstretch commands| merely take the +The \vb|\hstretch| and \vb|\vstretch commands| merely take the +\margcmd{hstretch}\margcmd{vstretch}% second argument and either horizontally or vertically stretch it by a scale factor given by the first argument. The scale is not given in percent, like some aforementioned commands. Remember also, that these commands are, by default processed in math mode. In a like manner, -\verb|\scaleobj| performs a scale of the object. It is like the -\verb|\scalebox| command of the \textsf{graphicx} package, except that +\margcmd{scaleobj}% +\vb|\scaleobj| performs a scale of the object. It is like the +\vb|\scalebox| command of the \textsf{graphicx} package, except that its argument (like others in this package) defaults to math mode, and is displayed in the current math display style. As of version 1.4, {\sr} commands will autodetect the current math display style and process its arguments in the same mode. However, this improvement could ``break'' a prior (rare but) accepted usage of the -package in which the {\sr} \verb|object| is given in mixed mode -(containing \verb|$| characters in the middle of the \verb|object|. In +package in which the {\sr} \vb|object| is given in mixed mode +(containing \vb|$| characters in the middle of the \vb|object|. In order to maintain backward compatibility, the user may invoke -\verb|\ignoremathstyle|. Thereafter, {\sr} objects will be processed in +\margcmd{ignoremathstyle}% +\vb|\ignoremathstyle|. Thereafter, {\sr} objects will be processed in the prior (pre-version 1.4) manner, until the command -\verb|\discernmathstyle| is later invoked to restore the more modern +\margcmd{discernmathstyle} +\vb|\discernmathstyle| is later invoked to restore the more modern package settings. -A service routine \verb|\Isnextbyte| was employed by this package. +A useful auxiliary command \vb|\ThisStyle{}| has been introduced for +\margcmd{ThisStyle}% +remembering the current math style. When invoked, this command will +remember the math style present at the time of its invocation and then +execute its argument. Within the extent of its argument, an invocation +\margcmd{SavedStyle}% +of the macro \vb|\SavedStyle| will reinstate the math style that was +active upon invocation. This command is very useful when \LaTeX{} boxes +are being set within the math environment, since the prevailing math +style does not carry into the box, without the use of +\vb|\SavedStyle|. + +A service routine \vb|\Isnextbyte| was employed by this package. +\margcmd{Isnextbyte}% Because of its more general utility, it is made accessible to the user. -It is an improved version of the command \verb|\isnextbyte| from the +It is an improved version of the command \vb|\isnextbyte| from the \textsf{stringstrings} package. It will determine if the first byte from a passed string argument matches a specified -\textit{match}-character. It produces a \verb|T| or \verb|F| result, -which is printed out by default. With the use of the \verb|q| optional +\textit{match}-character. It produces a \vb|T| or \vb|F| result, +which is printed out by default. With the use of the \vb|q| optional argument, the output can be suppressed, with the result instead being -stored in a macro \verb|\theresult|. +stored in a macro \vb|\theresult|. \section{Usage Examples} @@ -175,18 +202,18 @@ Now for a few examples. Let us define \def\blob{\displaystyle\frac{\displaystyle\frac{x^3}{z+r^3}}% {\displaystyle\frac{y}{x^2}}% } -Here are the raw definitions of \verb|$\preblob\blob$|, unscaled: +Here are the raw definitions of \vb|$\preblob\blob$|, unscaled: \rl$\preblob\blob$ \subsection{The $\backslash$\texttt{scalerel} Command} -Now we employ \verb|$\scalerel{\preblob}{\blob}$| +Now we employ \vb|$\scalerel{\preblob}{\blob}$| \rl$\scalerel{\preblob}{\blob}$ If we wish constrain the width of the summation to 3ex, we employ\\ -\verb|$\scalerel[3ex]{\preblob}{\blob}$| +\vb|$\scalerel[3ex]{\preblob}{\blob}$| \rl$\scalerel[3ex]{\preblob}{\blob}$ @@ -195,15 +222,15 @@ constraint will change their aspect ratio, which may not be desirable. Now let's say you wanted to introduce notation to bound mathematical expressions by triangles. After defining -\verb|\blob| as before, you could use\\ -\verb|$\scalerel[3ex]{\triangleleft}{\blob}|\\ -\verb|\scalerel*[3ex]{\triangleright}{\blob}$| +\vb|\blob| as before, you could use\\ +\vb|$\scalerel[3ex]{\triangleleft}{\blob}|\\ +\vb|\scalerel*[3ex]{\triangleright}{\blob}$| \rl% $\scalerel[3ex]{\triangleleft}{\blob}\scalerel*[3ex]{\triangleright}{\blob}$ -Here, the second call to \verb|\scalerel| was with the star (\verb|*|) -option, indicating that \verb|\blob| should not be printed out following +Here, the second call to \vb|\scalerel| was with the star (\vb|*|) +option, indicating that \vb|\blob| should not be printed out following the right-hand delimiter. A less-tall expression would appear in those same delimiters as @@ -211,17 +238,17 @@ same delimiters as $\scalerel[3ex]{\triangleleft}{Q}\scalerel*[3ex]{\triangleright}{Q}$ Because the width limit had not been reached, no horizontal compression -of the object was required. Note: see the \verb|\scaleleftright| and -\verb|\stretchleftright| commands for a more direct way to employ these +of the object was required. Note: see the \vb|\scaleleftright| and +\vb|\stretchleftright| commands for a more direct way to employ these sort of transformations. \subsection{The $\backslash$\texttt{stretchrel} Command} -In its most simple application \verb|\stretchrel| can be used in the -fashion of a \verb|\left\{| in math mode. While there is no reason to +In its most simple application \vb|\stretchrel| can be used in the +fashion of a \vb|\left\{| in math mode. While there is no reason to replace that more efficient usage supplied by \LaTeX{}, it is nonetheless instructional to see a comparison of -\verb|$\left\{\blob\right.$| and \verb|$\stretchrel[400]{\{}{\blob}$|, to +\vb|$\left\{\blob\right.$| and \vb|$\stretchrel[400]{\{}{\blob}$|, to see how the aspect-ratio limiting option can be employed to avoid an overly stretched manipulation: @@ -229,16 +256,16 @@ overly stretched manipulation: The expression on the right uses a standard \{ character, which has been vertically stretched, but limited to an aspect ratio of 4. To use -symbols for which the \verb|\left| nomenclature will not work, -\verb|\stretchrel| provides a viable alternative, as shown in this +symbols for which the \vb|\left| nomenclature will not work, +\vb|\stretchrel| provides a viable alternative, as shown in this stick-figure example:\\ -\verb|3m $\stretchrel[500]{\updownarrow\,}|\\ -\verb|{\fbox{\rule[-1.8em]{0ex}{4em}Work Table}}$| +\vb|3m $\stretchrel[500]{\updownarrow\,}|\\ +\vb|{\fbox{\rule[-1.8em]{0ex}{4em}Work Table}}$| \rl3m $\stretchrel[500]{\updownarrow\,} {\fbox{\rule[-1.8em]{0ex}{4em}Work Table}}$ -or in this use, \verb|$\stretchrel[225]{\int}{\blob} dx$|, of the +or in this use, \vb|$\stretchrel[225]{\int}{\blob} dx$|, of the stretched integral sign (aspect limited to 2.25): \rl$\stretchrel[225]{\int}{\blob} dx$ @@ -246,38 +273,38 @@ stretched integral sign (aspect limited to 2.25): \subsection{Baseline Shifts of \textit{Relative} Scales and Stretches} -It was mentioned that when \verb|\scalerel| and \verb|\stretchrel| are +It was mentioned that when \vb|\scalerel| and \vb|\stretchrel| are employed, the manipulated object gets vertically shifted to match the extent of the reference object. To see how this works, we provide the -following example, that employs some inline math. and scaling. +following example, that employs some inline math and scaling. \rl\underline{The baseline is the line that runs under this text} \fbox{$\scalerel{i}{\blob}$}\underline{\scaleto{i}{43.32pt}} The first case of the large letter ``i'' was generated with -\verb|\scalerel|, and so the baseline of the ``i'', normally not a +\vb|\scalerel|, and so the baseline of the ``i'', normally not a descending letter, was dropped to conform to the descended reference -equation. All of this was set in an \verb|\fbox| to show the extent of +equation. All of this was set in an \vb|\fbox| to show the extent of the objects. For comparison, an ``i'' of the samesize was then placed -using a \verb|\scaleto| command, which does not change the baseline of +using a \vb|\scaleto| command, which does not change the baseline of the original object. \subsection{The $\backslash$\texttt{scaleto} and $\backslash$\texttt{stretchto} Commands} -The \verb|\scaleto| and \verb|\stretchto| commands are comparable to the -\verb|\scalerel| and \verb|\stretchrel| commands, except they do not +The \vb|\scaleto| and \vb|\stretchto| commands are comparable to the +\vb|\scalerel| and \vb|\stretchrel| commands, except they do not accept a reference object as their second mandatory argument. Rather, they take an absolute height (specified with units). These commands use -the same optional arguments as \verb|\scalerel| and \verb|\stretchrel| +the same optional arguments as \vb|\scalerel| and \vb|\stretchrel| to constrain the width and/or the aspect ratio, respectively, of the manipulated object. As was mentioned in the prior section, a difference between these and the \textit{relative} commands is that an object's baseline is not -altered with the use of \verb|\scaleto| and \verb|\stretchto|. Because +altered with the use of \vb|\scaleto| and \vb|\stretchto|. Because there is no reference object employed with these commands, there is no -need for starred (\verb|*|) versions of these commands, which would +need for starred (\vb|*|) versions of these commands, which would otherwise suppress the printing of the reference object. Examples follow the established pattern established in prior sections. @@ -285,31 +312,31 @@ First, we scale the equation blob used as an example in this documentation to a vertical extent of 80pt, preserving the original aspect ratio, -\rl\verb|$\scaleto{\blob}{80pt}$ | $\scaleto{\blob}{80pt}$ +\rl\vb|$\scaleto{\blob}{80pt}$ | $\scaleto{\blob}{80pt}$ Then, we stretch the Greek letter, capital phi, to 60pt, but constrain the aspect ratio to no less than 1.75. -\rl\verb|$\stretchto[175]{\Phi}{60pt}$ | $\stretchto[175]{\Phi}{80pt}$ +\rl\vb|$\stretchto[175]{\Phi}{60pt}$ | $\stretchto[175]{\Phi}{80pt}$ \subsection{The $\backslash$\texttt{scaleleftright} and $\backslash$\texttt{stretchleftright}\\Commands} -These commands are composites of several \verb|\scalerel| and -\verb|\stretchrel| commands, intended to provide the functionality of -the \verb|\left ...\right| syntax of mathmode, for symbols for which -the \verb|\left ...\right| syntax does not work. It uses the same -optional arguments as \verb|\scalerel| and \verb|\stretchrel| in order +These commands are composites of several \vb|\scalerel| and +\vb|\stretchrel| commands, intended to provide the functionality of +the \vb|\left ...\right| syntax of mathmode, for symbols for which +the \vb|\left ...\right| syntax does not work. It uses the same +optional arguments as \vb|\scalerel| and \vb|\stretchrel| in order to limit the width or aspect ratio of the respective manipulated objects. If one of the symbols on the left or right end of the enclosed reference block is to be blank, these commands support the use of the -period argument \verb|{.}| as a blank placeholder, in a fashion -analogous to the \verb|\left ...\right| syntax of mathmode. +period argument \vb|{.}| as a blank placeholder, in a fashion +analogous to the \vb|\left ...\right| syntax of mathmode. -\rl\verb|$\scaleleftright[3ex]{\prod}{\blob}{\coprod}$ | +\rl\vb|$\scaleleftright[3ex]{\prod}{\blob}{\coprod}$ | $\scaleleftright[3ex]{\prod}{\blob}{\coprod}$ -\rl\verb|$\stretchleftright[450]{.}{\blob}{\in}$ | +\rl\vb|$\stretchleftright[450]{.}{\blob}{\in}$ | $\stretchleftright[450]{.}{\blob}{\in}$ \subsection{The $\backslash$\texttt{hstretch}, @@ -322,14 +349,14 @@ If the stretch factor is greater than 1, the stretched length is larger than the original. If less than one, it is compressed with respect to the original. -\rl\verb|$\otimes\hstretch{3}{\otimes}\hstretch{0.5}{\otimes}$ | +\rl\vb|$\otimes\hstretch{3}{\otimes}\hstretch{0.5}{\otimes}$ | $\otimes\hstretch{3}{\otimes}\hstretch{0.5}{\otimes}$ -\rl\verb|$\otimes\vstretch{3}{\otimes}\vstretch{0.5}{\otimes}$ | +\rl\vb|$\otimes\vstretch{3}{\otimes}\vstretch{0.5}{\otimes}$ | $\otimes\vstretch{3}{\otimes}\vstretch{0.5}{\otimes}$ -The \verb|\scaleobj| command performs scaling in the fashion of a -\verb|\scalebox| command, except that its argument is processed in math +The \vb|\scaleobj| command performs scaling in the fashion of a +\vb|\scalebox| command, except that its argument is processed in math mode of the current math display style, by default. Thus, the difference between the following two invocations: \begin{verbatim} @@ -363,15 +390,15 @@ scalable-white- curly-brackets-and-and } A user defined two new symbols made by combining the font glyphs of a -brace and a vertical strut, calling them \verb|\llbrace| and -\verb|\rrbrace|, to look as follows around an argument (in this case +brace and a vertical strut, calling them \vb|\llbrace| and +\vb|\rrbrace|, to look as follows around an argument (in this case $x$): \def\wbrace{\scalebox{5}{$\llbrace x\rrbrace$}} \rl\wbrace But they found that when represented in reduced size fonts, the symbol -glyphs of the brace and the strut separated (note: \verb|\tiny| font has +glyphs of the brace and the strut separated (note: \vb|\tiny| font has been scaled up to match prior figure's height): \def\tinywbrace{\scalebox{3}{\tiny$\llbrace x\rrbrace$}} @@ -386,16 +413,16 @@ representation to change in unacceptable ways. The \textsf{scalerel} solution was to use the image from the normal-size representation and to shrink it down as needed. So, in this case, a normal-sized copy of the braces were stored in boxes called -\verb|\lXbrace| and \verb|\rXbrace|, resepctively. Then the following +\vb|\lXbrace| and \vb|\rXbrace|, resepctively. Then the following terms were defined: \begin{verbatim} \def\lxbrace{\scalerel*{\usebox{\lXbrace}}{\llbrace}} \def\rxbrace{\scalerel*{\usebox{\rXbrace}}{\rrbrace}} \end{verbatim} -Now, in lieu of using \verb|\llbrace| directly, the use of -\verb|\lxbrace| would take a copy of the normal-sized \verb|\lXbrace| +Now, in lieu of using \vb|\llbrace| directly, the use of +\vb|\lxbrace| would take a copy of the normal-sized \vb|\lXbrace| and scale it down to the vertical height of the malformed tiny -\verb|\llbrace|, and substitute for it. Here, we show the result at +\vb|\llbrace|, and substitute for it. Here, we show the result at both normal size and tiny size: \newsavebox{\lXbrace} @@ -412,7 +439,7 @@ brace in both cases, even as the $x$ adjusts to the fontsize reduction. If one wanted the default braces narrower (to match the look of the comparable symbols in the literature), one could use -\verb|\hstretch| in the definitions to achieve that quickly as +\vb|\hstretch| in the definitions to achieve that quickly as \begin{verbatim} \def\lxbrace{% \hstretch{0.6}{\scalerel*{\usebox{\lXbrace}}{\llbrace}}} @@ -427,7 +454,7 @@ to give the following \rl$\scalerel*{\lxbrace x\rxbrace}{\wbrace}$ {\tiny$\scalerel*{\lxbrace x\rxbrace}{\wbrace}$} -Likewise, the \verb|\left| and \verb|\right| features of equation mode +Likewise, the \vb|\left| and \vb|\right| features of equation mode cannot be used with the white braces, \rl \(\llbrace \left\llbracket\left\{\left[(a) \cdot @@ -438,14 +465,13 @@ but \textsf{scalerel} can fix that, too: \def\core{ \left\llbracket\left\{\left[(a) \cdot bc^{2^3}\right]^4\right\}^5\right\rrbracket}% \rl -\(\scalerel[1.5ex]{\lxbrace}{\core}\scalerel*[1.5ex]{\rxbrace}{\core}\) +\(\scaleleftright[1.5ex]{\lxbrace}{\core}{\rxbrace}\) with \begin{verbatim} -\(\scalerel[1.5ex]{\lxbrace}{\core}% - \scalerel*[1.5ex]{\rxbrace}{\core}\) + \(\scaleleftright[1.5ex]{\lxbrace}{\core}{\rxbrace}\) \end{verbatim} -where \verb|\core| is the core inner equation to which the white braces +where \vb|\core| is the core inner equation to which the white braces need to be scaled. In this case, the scaled white braces were width-limited to 1.5ex. diff --git a/Master/texmf-dist/tex/latex/scalerel/scalerel.sty b/Master/texmf-dist/tex/latex/scalerel/scalerel.sty index 77504b214c5..fdc528e917d 100644 --- a/Master/texmf-dist/tex/latex/scalerel/scalerel.sty +++ b/Master/texmf-dist/tex/latex/scalerel/scalerel.sty @@ -1,5 +1,5 @@ \ProvidesPackage{scalerel} -[2013/05/07 v1.4 +[2013/05/16 v1.5 Routines for constrained scaling and stretching of objects, relative to a reference object or in absolute terms] %% Copyright 2013 Steven B. Segletes @@ -28,10 +28,11 @@ % -Added \Isnextbyte as a supplemental routine % -Added \scaleobj (like \scalebox, but defaults to math mode % using current display style). +% V1.5 -Eliminated mathstyle package because of incompatibilites with +% many other packages. Implemented \mathchoice approach instead. \usepackage{calc} \usepackage{graphicx} -\usepackage{mathstyle} \usepackage{ifthen} \global\newlength\thesrwidth \global\newlength\thesrheight @@ -42,8 +43,7 @@ \newcommand\scalerel{\@ifstar{\scalerelplain}{\scalerelplus}} -\newcommand\scalerelplain[3][99in]{% - \get@mmode% +\newcommand\scalerelplain[3][99in]{\ThisStyle{% \sbox{\prebox}{\@obj{#2}}% \setbox0\hbox{\@obj{#3}}% \setlength\srblobheight{\ht0+\dp0}% @@ -55,13 +55,14 @@ \ifdim\thesrwidth>\mnxsrwidth\setlength\thesrwidth{\mnxsrwidth}\fi% \raisebox{-\srblobdepth+\dp0*\ratio{\srblobheight}{\ht0+\dp0}}% {\resizebox{\thesrwidth}{\thesrheight}{\usebox{\prebox}}}% + }% } + \newcommand\scalerelplus[3][99in]{\scalerelplain[#1]{#2}{#3}#3} \newcommand\stretchrel{\@ifstar{\stretchrelplain}{\stretchrelplus}} -\newcommand\stretchrelplain[3][10000]{% - \get@mmode% +\newcommand\stretchrelplain[3][10000]{\ThisStyle{% \sbox{\prebox}{\@obj{#2}}% \setbox0\hbox{\@obj{#3}}% \setlength\srblobheight{\ht0+\dp0}% @@ -73,12 +74,12 @@ \ifdim\thesrwidth<\mnxsrwidth\setlength\thesrwidth{\mnxsrwidth}\fi% \raisebox{-\srblobdepth+\dp0*\ratio{\srblobheight}{\ht0+\dp0}}% {\resizebox{\thesrwidth}{\thesrheight}{\usebox{\prebox}}}% + }% } \newcommand\stretchrelplus[3][10000]{\stretchrelplain[#1]{#2}{#3}#3} -\newcommand\scaleto[3][99in]{% - \get@mmode% +\newcommand\scaleto[3][99in]{\ThisStyle{% \sbox{\prebox}{\@obj{#2}}% \setlength\srblobheight{#3}% \setlength\srblobdepth{0pt}% @@ -90,10 +91,10 @@ \setlength\srblobdepth{\dp0*\ratio{\srblobheight}{\ht0+\dp0}}% \raisebox{-\srblobdepth+\dp0*\ratio{\srblobheight}{\ht0+\dp0}}% {\resizebox{\thesrwidth}{\thesrheight}{\usebox{\prebox}}}% + }% } -\newcommand\stretchto[3][10000]{% - \get@mmode% +\newcommand\stretchto[3][10000]{\ThisStyle{% \sbox{\prebox}{\@obj{#2}}% \setlength\srblobheight{#3}% \setlength\srblobdepth{0pt}% @@ -105,6 +106,7 @@ \setlength\srblobdepth{\dp0*\ratio{\srblobheight}{\ht0+\dp0}}% \raisebox{-\srblobdepth+\dp0*\ratio{\srblobheight}{\ht0+\dp0}}% {\resizebox{\thesrwidth}{\thesrheight}{\usebox{\prebox}}}% + }% } \def\bl@nk{\rule{-.01ex}{1ex}} @@ -120,11 +122,14 @@ \stretchrel[#1]{\leftarg}{#3}\stretchrel*[#1]{\rightarg}{#3}% } -\newcommand\hstretch[2]{\get@mmode\stretchrel*{\scalebox{#1}{\@obj{#2}}}{#2}} +\newcommand\hstretch[2]{% + \ThisStyle{\stretchrel*{\scalebox{#1}{\@obj{#2}}}{#2}}} -\newcommand\vstretch[2]{\get@mmode\stretchrel*{#2}{\scalebox{#1}{\@obj{#2}}}} +\newcommand\vstretch[2]{% + \ThisStyle{\stretchrel*{#2}{\scalebox{#1}{\@obj{#2}}}}} -\newcommand\scaleobj[2]{\get@mmode\scalebox{#1}{\@obj{#2}}} +\newcommand\scaleobj[2]{% + \ThisStyle{\scalebox{#1}{\@obj{#2}}}} % DETERMINE IF THE SCALEREL ROUTINE WAS CALLED IN MATH MODE. % IF SO, USE THE PROPER MATH DISPLAY STYLE FOR THE CALL, @@ -134,7 +139,7 @@ \if T\@mmode% \Isnextbyte[q]{$}{#1}% \if F\theresult% - $\mathpalette{}{#1}$% + $\SavedStyle#1$% \else% $#1$% \fi% @@ -151,7 +156,27 @@ % DOLLAR ($) DELIMITERS IN THE *MIDDLE* OF A scalerel ARGUMENT \newcommand\ignoremathstyle{\renewcommand\@obj[1]{$##1$}} -\def\get@mmode{\ifmmode\gdef\@mmode{T}\else\gdef\@mmode{F}\fi} +\def\@mstyleD{\displaystyle} +\def\@mstyleT{\textstyle} +\def\@mstyleS{\scriptstyle} +\def\@mstyles{\scriptscriptstyle} +% +\def\SavedStyle{\csname @mstyle\m@switch\endcsname} +% +\newcommand\ThisStyle[1]{% + \ifmmode% + \def\@mmode{T}\mathchoice% + {\edef\m@switch{D}#1}% + {\edef\m@switch{T}#1}% + {\edef\m@switch{S}#1}% + {\edef\m@switch{s}#1}% + \else% + \def\@mmode{F}% + \edef\m@switch{T}#1% + \fi% +} +% +%\newcommand\get@mmode{\ifmmode\def\@mmode{T}\else\def\@mmode{F}\fi} \def\PrimarySignalChar{@} \def\SecondarySignalChar{`} @@ -168,7 +193,6 @@ {\protected@edef\theresult{\@x}}% {\protected@edef\theresult{T}}% \if q#1\else\theresult\fi% -%\edef\theresult{T}% } \endinput |