texlive[42809] Master/texmf-dist: scalerel (29dec16)

commits+karl at tug.org commits+karl at tug.org
Fri Dec 30 14:20:48 CET 2016


Revision: 42809
          http://tug.org/svn/texlive?view=revision&revision=42809
Author:   karl
Date:     2016-12-30 14:20:48 +0100 (Fri, 30 Dec 2016)
Log Message:
-----------
scalerel (29dec16)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf
    trunk/Master/texmf-dist/doc/latex/scalerel/scalerel.tex
    trunk/Master/texmf-dist/tex/latex/scalerel/scalerel.sty

Modified: trunk/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/scalerel/scalerel.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scalerel/scalerel.tex	2016-12-30 10:21:55 UTC (rev 42808)
+++ trunk/Master/texmf-dist/doc/latex/scalerel/scalerel.tex	2016-12-30 13:20:48 UTC (rev 42809)
@@ -1,5 +1,5 @@
 \documentclass{article}
-\def\version{1.7}
+\def\version{1.8}
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -44,6 +44,12 @@
 %       and \stretchleftright{}{}{}, which had been causing overflow.
 %      -Made \hstretch and \vstretch routines more efficient, using
 %       optional arguments of \scalebox, instead of \scalerel.
+% V1.8 -Fixed divide by 0 bugs that would arise when object to be
+%       scaled fell completely below the baseline (zero height).
+%       Required revisions to \scalerelplain, \stretchrelplain,
+%       \scaleto, and \stretchto.
+%      -Fixed aspect-ratio bug, that calculated aspect for stretched object
+%       based only upon portion above baseline
 \parskip 1em
 \parindent 0em
 \newcommand\rl{\rule{2em}{0in}}
@@ -58,7 +64,7 @@
 \marginparwidth 1.6in
 \newcommand\margtt[1]{\marginpar{\hfill\ttfamily#1}}
 \newcommand\margcmd[1]{\marginpar{\hfill\ttfamily\char'134#1}}
-
+\newcommand\cmd[1]{\texttt{\char'134#1}}
 \begin{document}
 \begin{center}
 \LARGE The \textsf{scalerel} Package\\
@@ -70,46 +76,47 @@
 v\version
 \end{center}
 
-{\footnotesize
-Note for V1.7 users: If you are noticing compilation efficiency issues
-with your use of the \sr{} package, please see section~\ref{s:nm}.
-\par}
+\section{Commands and Description}
 
-\section{Commands and Description}
 The \textsf{scalerel} package is used to scale and vertically stretch
-objects, either relative to other objects, or in absolute terms.  Its
-commands may be invoked in either math mode or text mode (if there is no
-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
-\vb|{$object$}|, instead of the usual \vb|{object}|.
+  objects, either relative to other objects, or in absolute terms.  
+Its commands may be invoked in either math mode or text mode (if there 
+  is no 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 
+  [non-intuitively] specifying arguments as \vb|{$object$}|, instead
+  of the usual \vb|{object}|.
 
 There are four basic commands with the \textsf{scalerel} package, two
 of which have star variants:
 \begin{verbatim}
   \scalerel[*][max_width]{object}{reference}
-  \stretchrel[*][min_aspect]{object}{reference}
+  \stretchrel[*][narrowest_aspect]{object}{reference}
   \scaleto[max_width]{object}{height}
-  \stretchto[min_aspect]{object}{height}
+  \stretchto[narrowest_aspect]{object}{height}
 \end{verbatim} 
 In addition, there are a number of added commands that have been
 implemented as composites of the four basic commands, they are
 \begin{verbatim}
   \scaleleftright[max_width]{left-obj.}{reference}{right-obj.}
-  \stretchleftright[min_aspect]{left-obj.}{reference}{right-obj.}
+  \stretchleftright[narrowest_aspect]{left-obj.}{reference}{right-obj.}
   \hstretch{scale}{object}
   \vstretch{scale}{object}
   \scaleobj{scale}{object}
 \end{verbatim}
 Unless delimited for text mode, \texttt{object} is assumed to be a math
-object and wil be processed in the \textit{current} math style.  On the
-other hand, \texttt{reference} will take on the current mode (text
-or math).  If in math mode, \texttt{reference} will likewise be taken in the 
-current math style.
+  object and will be processed in the \textit{current} math style.%
+\footnote{By \LaTeX{} math styles, we mean \cmd{displaystyle}, \cmd{textstyle},
+  \cmd{scriptstyle}, and \cmd{scriptscriptstyle}.}
+On the other hand, \texttt{reference} will take on the current mode (text
+  or math).  
+If in math mode, \texttt{reference} will likewise be taken in the current
+  math style.
 
 There are also several auxiliary commands, useful in their own
-right and, in some cases, supporting backward compatibility:
+right:
 \begin{verbatim}
   \ThisStyle{...\SavedStyle...}
   \LMex
@@ -121,7 +128,7 @@
   \discernmathstyle
 \end{verbatim}
 
-In all cases, \vb|object| is the object to be scaled or 
+In the case of all \sr{} macros, \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, \vb|reference| is
@@ -134,28 +141,36 @@
 the \vb|reference| object.
 
 In cases of scaling or stretching \textit{to} a specified size,
-\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 \vb|reference| object, the baseline of
-manipulated \vb|object| remains unchanged.
+  \vb|height| will be the \textit{total} vertical height${}+{}$depth of 
+  the \vb|object| following a scale or stretch manipulation.  
+Since scaling or stretching to an
+  absolute size provides no \vb|reference| object, the baseline of
+  the manipulated \vb|object| remains unchanged.
 
 In cases of scaling (relative or absolute), the constraint
-\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
-\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.
+  \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
+  \vb|object| width is reduced to meet this limit.  
+If the \vb|object| width is reduced, 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 \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 \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
-\vb|min_aspect| must be an integer.
+By definition, vertical stretching will increase the (height-to-width) 
+  aspect ratio
+  of an object.  
+In the case of stretching (relative or absolute), the constraint
+  \vb|narrowest_aspect| is the narrowest aspect ratio allowed by the
+  stretch.%
+\footnote{Prior to V1.8 of the package, the limiting aspect ratio was
+  erroneously based on that portion of the stretched object 
+  \textit{above} the baseline, rather than the object's full vertical extent.}  
+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 \vb|object|'s 
+  aspect ratio to become more narrow than (\textit{i.e.}, larger 
+  than) this value, the width of the manipulated \vb|object| is 
+  increased to meet this threshold.  
+The value of \vb|narrowest_aspect| must be an integer.
 
 Because \textit{relative} scaling or stretching is done
 \textit{relative} to a reference object, the \vb|\scalerel| and
@@ -282,7 +297,8 @@
 
 \subsection{The $\backslash$\texttt{scalerel} Command}
 
-Now we employ \vb|$\scalerel{\preblob}{\blob}$|
+Now we employ \vb|$\scalerel{\preblob}{\blob}$| to scale the summation 
+  to match the size of the acted-upon term:
 
     \rl$\scalerel{\preblob}{\blob}$
 
@@ -291,8 +307,9 @@
 
     \rl$\scalerel[3ex]{\preblob}{\blob}$
 
-Of course, if the manipulated object contains text symbols, a width
-constraint will change their aspect ratio, which may not be desirable.
+Of course, if the manipulated object contains text symbols (as in
+  this case), a width constraint will change their aspect ratio, 
+  which is generally not desirable.
 
 Now let's say you wanted to introduce notation to bound mathematical
 expressions by triangles. After defining
@@ -322,27 +339,29 @@
 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 
-\vb|$\left\{\blob\right.$| and \vb|$\stretchrel[400]{\{}{\blob}$|, to
+\vb|$\left\{\blob\right.$| and \vb|$\stretchrel[550]{\{}{\blob}$|, to
 see how the aspect-ratio limiting option can be employed to avoid an
-overly stretched manipulation:
+overly stretched (narrow) manipulation:
 
-\rl$\left\{\blob\right.$  ~~~~~ $\stretchrel[400]{\{}{\blob}$
+\rl$\left\{\blob\right.$  ~~~~~ $\stretchrel[550]{\{}{\blob}$
 
-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 \vb|\left| nomenclature will not work,
-\vb|\stretchrel| provides a viable alternative, as shown in this
-stick-figure example:\\
-\vb|3m $\stretchrel[500]{\updownarrow\,}|\\
+The expression on the right uses a standard \{ character, which has 
+  been vertically stretched, but limited to an aspect ratio no 
+  narrower than 5.5.  
+To use symbols for which the \vb|\left| nomenclature will not work,
+  \vb|\stretchrel| provides a viable alternative, as shown in this
+  stick-figure example:
+
+\vb|3m $\stretchrel[600]{\updownarrow\,}|\\
 \vb|{\fbox{\rule[-1.8em]{0ex}{4em}Work Table}}$|
 
-\rl3m $\stretchrel[500]{\updownarrow\,}
+\rl3m $\stretchrel[600]{\updownarrow\,}
   {\fbox{\rule[-1.8em]{0ex}{4em}Work Table}}$
 
-or in this use, \vb|$\stretchrel[225]{\int}{\blob} dx$|, of the
-stretched integral sign (aspect limited to 2.25):
+or in this use, \vb|$\stretchrel[350]{\int}{\blob} dx$|, of the
+stretched integral sign (aspect limited to 3.5):
 
-\rl$\stretchrel[225]{\int}{\blob} dx$
+\rl$\stretchrel[350]{\int}{\blob} dx$
 
 
 \subsection{Baseline Shifts of \textit{Relative} Scales and Stretches}
@@ -353,33 +372,37 @@
 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}}
+\fbox{$\scalerel{i}{\blob}$}\underline{\scaleto{i}{35pt}}
 
 The first case of the large letter ``i'' was generated with 
-\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 \vb|\fbox| to show the extent of
-the objects.  For comparison, an ``i'' of the samesize was then placed
-using a \vb|\scaleto| command, which does not change the baseline of
-the original object.
+  \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 \vb|\fbox| to show the extent of
+  the objects.  
+For comparison, an ``i'', scaled to 35pt, was then placed
+  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 \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 \vb|\scalerel| and \vb|\stretchrel|
-to constrain the width and/or the aspect ratio, respectively, of the
-manipulated object.
+  \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 (\textit{i.e.}, height${}+{}$depth),
+  specified with units.  
+These commands use 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 \vb|\scaleto| and \vb|\stretchto|.  Because
-there is no reference object employed with these commands, there is no
-need for starred (\vb|*|) versions of these commands, which would
-otherwise suppress the printing of the reference object.
+  the \textit{relative} scale/stretch commands is that an object's 
+  baseline is not 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 (\vb|*|) versions of these commands,
+  which would otherwise suppress the printing of the reference object.
 
 Examples follow the established pattern established in prior sections.
 First, we scale the equation blob used as an example in this
@@ -388,7 +411,7 @@
 
 \rl\vb|$\scaleto{\blob}{80pt}$      | $\scaleto{\blob}{80pt}$
 
-Then, we stretch the Greek letter, capital phi, to 60pt, but constrain
+Below, we stretch the Greek letter, capital phi, to 60pt, but constrain
 the aspect ratio to no less than 1.75.
 
 \rl\vb|$\stretchto[175]{\Phi}{60pt}$      | $\stretchto[175]{\Phi}{80pt}$
@@ -398,7 +421,7 @@
 
 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 of mathmode, using 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
@@ -609,8 +632,7 @@
 
 \subsection{Extra-Wide Oversymbols}
 
-Refs:
-http://tex.stackexchange.com/questions/86036/use-overarc-to-represent-an-arc/101539\#101539,
+Ref:\\
 http://tex.stackexchange.com/questions/100574/really-wide-hat-symbol/101136\#101136
 
 There are many oversymbols defined to stand over a single-letter
@@ -620,70 +642,55 @@
 
 With these definitions,
 \begin{verbatim}
-\newcommand\reallywidehat[1]{%
-\begin{array}{c}%
-\stretchto{%
+\usepackage{scalerel,stackengine}
+
+\newcommand\reallywidehat[1]{\ensurestackMath{%
+\savestack{\tmpbox}{\stretchto{%
   \scaleto{%
-    \scalerel*[\widthof{#1}]{\bigwedge}%
-    {\rule[-\textheight/2]{1ex}{\textheight}}% WIDTH-LIMITED
-%                                              BIG WEDGE
-  }{1.25\textheight}%  THIS STRETCHES THE WEDGE A LITTLE EXTRA
-%                      WIDE
-}{0.9ex}\\%            THIS SQUEEZES THE WEDGE TO 0.9ex HEIGHT
-#1\\%                  THIS STACKS THE WEDGE ATOP THE ARGUMENT
-\rule{0ex}{.01ex}%
-\end{array}%
-}
+    \scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\bigwedge\kern-.6pt}%
+    {\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG WEDGE
+  }{\textheight}% 
+}{0.5ex}}%
+\stackon[1pt]{#1}{\tmpbox}%
+}}
 
-
-\newcommand\reallywideparen[1]{%
-\begin{array}{c}%
-\stretchto{%
+\newcommand\reallywideparen[1]{\ensurestackMath{%
+\savestack{\tmpbox}{\stretchto{%
   \scaleto{%
-    \scalerel*[\widthof{#1}]{\frown}%
-    {\rule[-\textheight/2]{1ex}{\textheight}}% WIDTH-LIMITED
-%                                              BIG WEDGE
-  }{1.25\textheight}%  THIS STRETCHES THE WEDGE A LITTLE EXTRA
-%                      WIDE
-}{0.6ex}\\%            THIS SQUEEZES THE WEDGE TO 0.6ex HEIGHT
-#1\\%                  THIS STACKS THE WEDGE ATOP THE ARGUMENT
-\rule{0ex}{.01ex}%
-\end{array}%
-}
+    \scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\frown\kern-.6pt}%
+    {\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG FROWN
+  }{\textheight}% 
+}{0.9ex}}%
+\stackon[-.5pt]{#1}{\tmpbox}%
+}}
 \end{verbatim}
 arbitrarily wide oversymbols may be constructed:
 
-\newcommand\reallywidehat[1]{%
-\begin{array}{c}%
-\stretchto{%
+\newcommand\reallywidehat[1]{\ensurestackMath{%
+\savestack{\tmpbox}{\stretchto{%
   \scaleto{%
-    \scalerel*[\widthof{#1}]{\bigwedge}%
-    {\rule[-\textheight/2]{1ex}{\textheight}}% WIDTH-LIMITED BIG WEDGE
-  }{1.25\textheight}%  THIS STRETCHES THE WEDGE A LITTLE EXTRA WIDE
-}{0.9ex}\\%            THIS SQUEEZES THE WEDGE TO 0.9ex HEIGHT
-#1\\%                  THIS STACKS THE WEDGE ATOP THE ARGUMENT
-\rule{0ex}{.01ex}%
-\end{array}%
-}
+    \scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\bigwedge\kern-.6pt}%
+    {\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG WEDGE
+  }{\textheight}% 
+}{0.5ex}}%
+\stackon[1pt]{#1}{\tmpbox}%
+}}
 
-\newcommand\reallywideparen[1]{%
-\begin{array}{c}%
-\stretchto{%
+\newcommand\reallywideparen[1]{\ensurestackMath{%
+\savestack{\tmpbox}{\stretchto{%
   \scaleto{%
-    \scalerel*[\widthof{#1}]{\frown}%
-    {\rule[-\textheight/2]{1ex}{\textheight}}% WIDTH-LIMITED BIG WEDGE
-  }{1.25\textheight}%  THIS STRETCHES THE WEDGE A LITTLE EXTRA WIDE
-}{0.6ex}\\%            THIS SQUEEZES THE WEDGE TO 0.6ex HEIGHT
-#1\\%                  THIS STACKS THE WEDGE ATOP THE ARGUMENT
-\rule{0ex}{.01ex}%
-\end{array}%
-}
+    \scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\frown\kern-.6pt}%
+    {\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG FROWN
+  }{\textheight}% 
+}{0.9ex}}%
+\stackon[-.5pt]{#1}{\tmpbox}%
+}}
 
 \rl
 $\reallywideparen{POQ}$ $+ \reallywidehat{QOR} + \reallywidehat{ROP}=
 2\pi r$
 
-\rl $\reallywidehat{zbcdefghijklm}$
+\rl $\reallywidehat{zbcdefghijklm} \ne \reallywideparen{zbcdefghijklm}$
 
 \section{Future Development}
 

Modified: trunk/Master/texmf-dist/tex/latex/scalerel/scalerel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/scalerel/scalerel.sty	2016-12-30 10:21:55 UTC (rev 42808)
+++ trunk/Master/texmf-dist/tex/latex/scalerel/scalerel.sty	2016-12-30 13:20:48 UTC (rev 42809)
@@ -1,5 +1,5 @@
 \ProvidesPackage{scalerel}
-[2015/02/18 v1.7
+[2016/12/29 v1.8
  Routines for constrained scaling and stretching of objects,
  relative to a reference object or in absolute terms]
 %
@@ -45,6 +45,12 @@
 %       and \stretchleftright{}{}{}, which had been causing overflow.
 %      -Made \hstretch and \vstretch routines more efficient, using
 %       optional arguments of \scalebox, instead of \scalerel.
+% V1.8 -Fixed divide by 0 bugs that would arise when object to be
+%       scaled fell completely below the baseline (zero height).
+%       Required revisions to \scalerelplain, \stretchrelplain,
+%       \scaleto, and \stretchto.
+%      -Fixed aspect-ratio bug, that calculated aspect for stretched object
+%       based only upon portion above baseline
 
 \usepackage{calc}
 \usepackage{graphicx}
@@ -54,7 +60,6 @@
 \global\newlength\srblobheight
 \global\newlength\srblobdepth
 \global\newlength\mnxsrwidth
-\newsavebox{\prebox}
 \newlength\LMex
 \newlength\LMpt
 \def\scriptstyleScaleFactor{.7}
@@ -63,17 +68,16 @@
 \newcommand\scalerel{\@ifstar{\scalerelplain}{\scalerelplus}}
 
 \newcommand\scalerelplain[3][99in]{\ThisStyle{%
-  \sbox{\prebox}{\@obj{#2}}%
   \setbox0\hbox{\@obj{#3}}%
   \setlength\srblobheight{\ht0+\dp0}%
   \setlength\srblobdepth{\dp0}%
-  \setbox0\hbox{\@obj{#2}}%
-  \setlength\thesrwidth{\wd0*\ratio{\srblobheight}{\ht0+\dp0}}%
-  \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0+\dp0}}%
+  \setbox2\hbox{\@obj{#2}}%
+  \setbox0\hbox{\raisebox{\dp2}{\@obj{#2}}}%
+  \setlength\thesrwidth{\wd0*\ratio{\srblobheight}{\ht0}}%
+  \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0}}%
   \setlength\mnxsrwidth{#1}%
   \ifdim\thesrwidth>\mnxsrwidth\setlength\thesrwidth{\mnxsrwidth}\fi%
-  \raisebox{-\srblobdepth+\dp0*\ratio{\srblobheight}{\ht0+\dp0}}%
-           {\resizebox{\thesrwidth}{\thesrheight}{\usebox{\prebox}}}%
+  \raisebox{-\srblobdepth}{\resizebox{\thesrwidth}{\thesrheight}{\copy0}}%
   }%
 }
 
@@ -82,17 +86,16 @@
 \newcommand\stretchrel{\@ifstar{\stretchrelplain}{\stretchrelplus}}
 
 \newcommand\stretchrelplain[3][10000]{\ThisStyle{%
-  \sbox{\prebox}{\@obj{#2}}%
   \setbox0\hbox{\@obj{#3}}%
   \setlength\srblobheight{\ht0+\dp0}%
   \setlength\srblobdepth{\dp0}%
-  \setbox0\hbox{\@obj{#2}}%
+  \setbox2\hbox{\@obj{#2}}%
+  \setbox0\hbox{\raisebox{\dp2}{\@obj{#2}}}%
   \setlength\thesrwidth{\wd0}%
-  \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0+\dp0}}%
+  \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0}}%
   \setlength\mnxsrwidth{\thesrheight*100/#1}%
   \ifdim\thesrwidth<\mnxsrwidth\setlength\thesrwidth{\mnxsrwidth}\fi%
-  \raisebox{-\srblobdepth+\dp0*\ratio{\srblobheight}{\ht0+\dp0}}%
-           {\resizebox{\thesrwidth}{\thesrheight}{\usebox{\prebox}}}%
+  \raisebox{-\srblobdepth}{\resizebox{\thesrwidth}{\thesrheight}{\copy0}}%
   }%
 }
 
@@ -99,32 +102,28 @@
 \newcommand\stretchrelplus[3][10000]{\stretchrelplain[#1]{#2}{#3}#3}
 
 \newcommand\scaleto[3][99in]{\ThisStyle{%
-  \sbox{\prebox}{\@obj{#2}}%
   \setlength\srblobheight{#3}%
-  \setlength\srblobdepth{0pt}%
-  \setbox0\hbox{\@obj{#2}}%
-  \setlength\thesrwidth{\wd0*\ratio{\srblobheight}{\ht0+\dp0}}%
-  \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0+\dp0}}%
+  \setbox2\hbox{\@obj{#2}}%
+  \setbox0\hbox{\raisebox{\dp2}{\@obj{#2}}}%
+  \setlength\thesrwidth{\wd0*\ratio{\srblobheight}{\ht0}}%
+  \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0}}%
   \setlength\mnxsrwidth{#1}%
   \ifdim\thesrwidth>\mnxsrwidth\setlength\thesrwidth{\mnxsrwidth}\fi%
-  \setlength\srblobdepth{\dp0*\ratio{\srblobheight}{\ht0+\dp0}}%
-  \raisebox{-\srblobdepth+\dp0*\ratio{\srblobheight}{\ht0+\dp0}}%
-           {\resizebox{\thesrwidth}{\thesrheight}{\usebox{\prebox}}}%
+  \setlength\srblobdepth{\dp2*\ratio{\srblobheight}{\ht0}}%
+  \raisebox{-\srblobdepth}{\resizebox{\thesrwidth}{\thesrheight}{\copy0}}%
   }%
 }
 
 \newcommand\stretchto[3][10000]{\ThisStyle{%
-  \sbox{\prebox}{\@obj{#2}}%
   \setlength\srblobheight{#3}%
-  \setlength\srblobdepth{0pt}%
-  \setbox0\hbox{\@obj{#2}}%
+  \setbox2\hbox{\@obj{#2}}%
+  \setbox0\hbox{\raisebox{\dp2}{\@obj{#2}}}%
   \setlength\thesrwidth{\wd0}%
-  \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0+\dp0}}%
+  \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0}}%
   \setlength\mnxsrwidth{\thesrheight*100/#1}%
   \ifdim\thesrwidth<\mnxsrwidth\setlength\thesrwidth{\mnxsrwidth}\fi%
-  \setlength\srblobdepth{\dp0*\ratio{\srblobheight}{\ht0+\dp0}}%
-  \raisebox{-\srblobdepth+\dp0*\ratio{\srblobheight}{\ht0+\dp0}}%
-           {\resizebox{\thesrwidth}{\thesrheight}{\usebox{\prebox}}}%
+  \setlength\srblobdepth{\dp2*\ratio{\srblobheight}{\ht0}}%
+  \raisebox{-\srblobdepth}{\resizebox{\thesrwidth}{\thesrheight}{\copy0}}%
   }%
 }
 



More information about the tex-live-commits mailing list