From cc6a974dc0c0e376fea2434265b38e70a55ad562 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 21 Mar 2013 23:23:45 +0000 Subject: scalerel (21mar13) git-svn-id: svn://tug.org/texlive/trunk@29465 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/scalerel/scalerel.pdf | Bin 233706 -> 234908 bytes Master/texmf-dist/doc/latex/scalerel/scalerel.tex | 45 +++++++++++++++++++++- Master/texmf-dist/tex/latex/scalerel/scalerel.sty | 12 ++++-- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf b/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf index 64e455e4b8b..1e081a9877c 100644 Binary files a/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf and b/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf differ diff --git a/Master/texmf-dist/doc/latex/scalerel/scalerel.tex b/Master/texmf-dist/doc/latex/scalerel/scalerel.tex index 45e1673116c..ec38c1b77c8 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.2} +\def\version{1.3} %% Copyright 2013 Steven B. Segletes % % This work may be distributed and/or modified under the @@ -18,6 +18,8 @@ % V1.1 Corrected usepackage dependencies; Significant doc rewrite. % V1.11 Corrected typo in documentation % V1.2 Added \scaleleftright and \stretchleftright; revised docs. +% V1.3 Corrected missing % in stretch routines, added \hstretch and +% \vstretch commands; fixed version number in .sty file \parskip 1em \parindent 0em \newcommand\rl{\rule{3em}{0in}} @@ -55,11 +57,13 @@ of which have star variants: \scaleto[max_width]{object}{height} \stretchto[min_aspect]{object}{height} \end{verbatim} -In addition, there are two added commands that have been implemented as +In addition, there are four 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.} + \hstretch{scale}{object} + \vstretch{scale}{object} \end{verbatim} In all cases, \verb|object| is the object to be scaled or vertically @@ -111,6 +115,12 @@ intended to provide the functional capability of the \verb|\left| and \verb|\right| commands in math mode, for delimiting symbols not otherwise supported by those commands. +The \verb|\hstretch| and \verb|\vstretch commands| merely take the +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. + \section{Usage Examples} Now for a few examples. Let us define @@ -261,6 +271,21 @@ $\scaleleftright[3ex]{\prod}{\blob}{\coprod}$ \rl\verb|$\stretchleftright[450]{.}{\blob}{\in}$ | $\stretchleftright[450]{.}{\blob}{\in}$ +\subsection{The $\backslash$\texttt{hstretch} and + $\backslash$\texttt{vstretch} Commands} + +These commands simply perform horizontal or vertical stretching, +respectively. They use a scale factor, rather than an absolute length. +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}$ | +$\otimes\hstretch{3}{\otimes}\hstretch{0.5}{\otimes}$ + +\rl\verb|$\otimes\vstretch{3}{\otimes}\vstretch{0.5}{\otimes}$ | +$\otimes\vstretch{3}{\otimes}\vstretch{0.5}{\otimes}$ + \section{Real World Application} \subsection{White Curly Brackets} @@ -330,6 +355,22 @@ both normal size and tiny size: Note that the brace is the properly formed scale of the normal-sized 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 +\begin{verbatim} +\def\lxbrace{% + \hstretch{0.6}{\scalerel*{\usebox{\lXbrace}}{\llbrace}}} +\def\rxbrace{% + \hstretch{0.6}{\scalerel*{\usebox{\rXbrace}}{\rrbrace}}} +\end{verbatim} + +to give the following + +\def\lxbrace{\hstretch{0.6}{\scalerel*{\usebox{\lXbrace}}{\llbrace}}} +\def\rxbrace{\hstretch{0.6}{\scalerel*{\usebox{\rXbrace}}{\rrbrace}}} +\indent$\scalerel*{\lxbrace x\rxbrace$\tiny$\lxbrace x\rxbrace}{\wbrace}$ + Likewise, the \verb|\left| and \verb|\right| features of equation mode cannot be used with the white braces, diff --git a/Master/texmf-dist/tex/latex/scalerel/scalerel.sty b/Master/texmf-dist/tex/latex/scalerel/scalerel.sty index 998095a2a45..54beb15dce2 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/03/11 v1.1 +[2013/03/20 v1.3 Routines for constrained scaling and stretching of objects, relative to a reference object or in absolute terms] %% Copyright 2013 Steven B. Segletes @@ -19,6 +19,8 @@ % V1.01 Correct typos in documentation % V1.1 Corrected usepackage dependencies; Significant doc rewrite. % V1.2 Added \scaleleftright and \stretchleftright; revised docs. +% V1.3 Corrected missing % in stretch routines, added \hstretch and +% \vstretch commands; fixed version number in .sty file \usepackage{calc} \usepackage{graphicx} \global\newlength\thesrwidth @@ -55,7 +57,7 @@ \setbox0\hbox{$#2$}% \setlength\thesrwidth{\wd0}% \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0+\dp0}}% - \setlength\mnxsrwidth{\thesrheight*100/#1} + \setlength\mnxsrwidth{\thesrheight*100/#1}% \ifdim\thesrwidth<\mnxsrwidth\setlength\thesrwidth{\mnxsrwidth}\fi% \raisebox{-\srblobdepth+\dp0*\ratio{\srblobheight}{\ht0+\dp0}}% {\resizebox{\thesrwidth}{\thesrheight}{\usebox{\prebox}}}% @@ -84,7 +86,7 @@ \setbox0\hbox{$#2$}% \setlength\thesrwidth{\wd0}% \setlength\thesrheight{\ht0*\ratio{\srblobheight}{\ht0+\dp0}}% - \setlength\mnxsrwidth{\thesrheight*100/#1} + \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}}% @@ -104,4 +106,8 @@ \stretchrel[#1]{\leftarg}{#3}\stretchrel*[#1]{\rightarg}{#3}% } +\newcommand\hstretch[2]{\stretchrel*{\scalebox{#1}{$#2$}}{#2}} + +\newcommand\vstretch[2]{\stretchrel*{#2}{\scalebox{#1}{$#2$}}} + \endinput -- cgit v1.2.3