diff options
author | Karl Berry <karl@freefriends.org> | 2013-03-02 01:12:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-03-02 01:12:44 +0000 |
commit | 36f9061a512acdc9fa1866e89fa967b0bae3464c (patch) | |
tree | 0c6c8dbe8468ef6a3f827f28166fa35c5ef93b99 /Master/texmf-dist/tex | |
parent | 6b9ce3b95f36f4da56f4ed73515ce224f956e7f5 (diff) |
scalerel (28feb13)
git-svn-id: svn://tug.org/texlive/trunk@29261 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/scalerel/scalerel.sty | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/scalerel/scalerel.sty b/Master/texmf-dist/tex/latex/scalerel/scalerel.sty new file mode 100644 index 00000000000..58552198bc9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/scalerel/scalerel.sty @@ -0,0 +1,88 @@ +\ProvidesPackage{scalerel}[2013/02/27] +%% Copyright 2013 Steven B. Segletes +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Steven B. Segletes. + +\usepackage{calc} +\usepackage{tikz} +\global\newlength\thesrwidth +\global\newlength\thesrheight +\global\newlength\srblobheight +\global\newlength\srblobdepth +\global\newlength\mnxsrwidth +\newsavebox{\prebox} + +\newcommand\scalerel{\@ifstar{\scalerelplain}{\scalerelplus}} + +\newcommand\scalerelplain[3][99in]{% + \sbox{\prebox}{$#2$}% + \setbox0\hbox{$#3$}% + \setlength\srblobheight{\ht0+\dp0}% + \setlength\srblobdepth{\dp0}% + \setbox0\hbox{$#2$}% + \setlength\thesrwidth{\wd0*\ratio{\srblobheight}{\ht0+\dp0}}% + \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0+\dp0}}% + \setlength\mnxsrwidth{#1}% + \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]{% + \sbox{\prebox}{$#2$}% + \setbox0\hbox{$#3$}% + \setlength\srblobheight{\ht0+\dp0}% + \setlength\srblobdepth{\dp0}% + \setbox0\hbox{$#2$}% + \setlength\thesrwidth{\wd0}% + \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0+\dp0}}% + \setlength\mnxsrwidth{\thesrheight*100/#1} + \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]{% + \sbox{\prebox}{$#2$}% + \setlength\srblobheight{#3}% + \setlength\srblobdepth{0pt}% + \setbox0\hbox{$#2$}% + \setlength\thesrwidth{\wd0*\ratio{\srblobheight}{\ht0+\dp0}}% + \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0+\dp0}}% + \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}}}% +} + +\newcommand\stretchto[3][10000]{% + \sbox{\prebox}{$#2$}% + \setlength\srblobheight{#3}% + \setlength\srblobdepth{0pt}% + \setbox0\hbox{$#2$}% + \setlength\thesrwidth{\wd0}% + \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0+\dp0}}% + \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}}}% +} + +\endinput |