summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/scalerel
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-05-17 22:28:33 +0000
committerKarl Berry <karl@freefriends.org>2013-05-17 22:28:33 +0000
commitdd0d5abd5e26de03a924f16d65300c202884afa9 (patch)
tree40fe1923f5ded73fecb419e4d587bec36f0781c8 /Master/texmf-dist/tex/latex/scalerel
parent7b47572c533451aae0bd41e0480845a715bd3bce (diff)
scalerel (17may13)
git-svn-id: svn://tug.org/texlive/trunk@30531 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/scalerel')
-rw-r--r--Master/texmf-dist/tex/latex/scalerel/scalerel.sty56
1 files changed, 40 insertions, 16 deletions
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