From 0c7bf14c7bad3782b103efabe8fc303c0e0f8087 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 11 Mar 2013 23:22:19 +0000 Subject: scalerel (11mar13) git-svn-id: svn://tug.org/texlive/trunk@29344 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/scalerel/scalerel.pdf | Bin 187074 -> 229407 bytes Master/texmf-dist/doc/latex/scalerel/scalerel.tex | 189 +++++++++++++++++++++- Master/texmf-dist/tex/latex/scalerel/scalerel.sty | 9 +- 3 files changed, 192 insertions(+), 6 deletions(-) diff --git a/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf b/Master/texmf-dist/doc/latex/scalerel/scalerel.pdf index f7f4bc78681..444861629c0 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 1355ef516d4..cd0f42b5186 100644 --- a/Master/texmf-dist/doc/latex/scalerel/scalerel.tex +++ b/Master/texmf-dist/doc/latex/scalerel/scalerel.tex @@ -1,16 +1,34 @@ \documentclass{article} -\def\version{1.0} +\def\version{1.1} +%% 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. + +% V1.01 Correct typos in documentation +% V1.1 Corrected usepackage dependencies; Significant doc rewrite. \parskip 1em \parindent 0em \newcommand\rl{\rule{3em}{0in}} \usepackage{scalerel} \usepackage{verbatim} +\usepackage[only,llbracket,rrbracket,llparenthesis,rrparenthesis]{stmaryrd} +\usepackage{accsupp} % for ensuring the right Unicode codepoint upon pasting \begin{document} \begin{center} \LARGE The \textsf{scalerel} Package\\ \rule{0em}{.7em}\small Routines for constrained scaling and stretching -of objects, either relative to a reference object or in absolute terms\\ +of objects,\\relative to a reference object or in absolute terms\\ \rule{0em}{2.7em}\large Steven B. Segletes\\ steven.b.segletes.civ@mail.mil\\ \rule{0em}{1.7em}\today\\ @@ -79,7 +97,7 @@ 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. -\section{Examples} +\section{Usage Examples} Now for a few examples. Let us define \begin{verbatim} @@ -159,7 +177,7 @@ stretched integral sign (aspect limited to 2.25): \rl$\stretchrel[225]{\int}{\blob} dx$ -\subsection{Baseline Shifts of \textit{Relative} Scales and Shifts} +\subsection{Baseline Shifts of \textit{Relative} Scales and Stretches} It was mentioned that when \verb|\scalerel| and \verb|\stretchrel| are employed, the manipulated object gets vertically shifted to match the @@ -207,6 +225,169 @@ the aspect ratio to no less than 1.75. \rl\verb|$\stretchto[175]{\Phi}{60pt}$ | $\stretchto[175]{\Phi}{80pt}$ +\section{Real World Application} + +\subsection{White Curly Brackets} + +Ref: http://tex.stackexchange.com/questions/100966/defining-scalable-white-curly-brackets-and-and + +\newcommand*{\llbrace}{% + \BeginAccSupp{method=hex,unicode,ActualText=2983}% + \textnormal{\usefont{OMS}{lmr}{m}{n}\char102}% + \mathchoice{\mkern-4.05mu}{\mkern-4.05mu}{\mkern-4.3mu}{\mkern-4.8mu}% + \textnormal{\usefont{OMS}{lmr}{m}{n}\char106}% + \EndAccSupp{}% +} +\newcommand*{\rrbrace}{% + \BeginAccSupp{method=hex,unicode,ActualText=2984}% + \textnormal{\usefont{OMS}{lmr}{m}{n}\char106}% + \mathchoice{\mkern-4.05mu}{\mkern-4.05mu}{\mkern-4.3mu}{\mkern-4.8mu}% + \textnormal{\usefont{OMS}{lmr}{m}{n}\char103}% + \EndAccSupp{}% +} + +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: + +\def\wbrace{\scalebox{5}{$\llbrace x\rrbrace$}} +\indent\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 +scaled up to match prior figure's height): + +\def\tinywbrace{\scalebox{3}{\tiny$\llbrace x\rrbrace$}} +\indent$\scalerel*{\tinywbrace}{\wbrace}$ + +This happens because font designers don't merely scale their fonts when +shrunk down in size, but they do things (like thickening up lines and +changing aspect ratios) in an attempt to retain legibility. In this +case, the font's auto-adjustment at smaller scale caused this composite +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 +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| +and scale it down to the vertical height of the malformed tiny +\verb|\llbrace|, and substitute for it. Here, we show the result at +both normal size and tiny size: + +\newsavebox{\lXbrace} +\savebox{\lXbrace}{$\llbrace$} +\newsavebox{\rXbrace} +\savebox{\rXbrace}{$\rrbrace$} +\def\lxbrace{\scalerel*{\usebox{\lXbrace}}{\llbrace}} +\def\rxbrace{\scalerel*{\usebox{\rXbrace}}{\rrbrace}} +\indent$\scalerel*{\lxbrace x\rxbrace$\tiny$\lxbrace x\rxbrace}{\wbrace}$ + +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. + +Likewise, the \verb|\left| and \verb|\right| features of equation mode +cannot be used with the white braces, + +\indent \(\llbrace \left\llbracket\left\{\left[(a) \cdot +bc^{2^3}\right]^4\right\}^5\right\rrbracket \rrbrace\) + +but \textsf{scalerel} can fix that, too: + +\def\core{ \left\llbracket\left\{\left[(a) \cdot +bc^{2^3}\right]^4\right\}^5\right\rrbracket}% +\indent +\(\scalerel[1.5ex]{\lxbrace}{\core}\scalerel*[1.5ex]{\rxbrace}{\core}\) + +with +\begin{verbatim} +\(\scalerel[1.5ex]{\lxbrace}{\core}% + \scalerel*[1.5ex]{\rxbrace}{\core}\) +\end{verbatim} +where \verb|\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. + +\subsection{Extra-Wide Oversymbols} + +Refs: +http://tex.stackexchange.com/questions/86036/use-overarc-to-represent-an-arc/101539\#101539, +http://tex.stackexchange.com/questions/100574/really-wide-hat-symbol/101136\#101136 + +There are many oversymbols defined to stand over a single-letter +variable. There are a smaller number of extra-wide oversymbols to +extend over small groups of symbols. Occasionally, however, a need +arises for an oversymbol to stretch over a larger group of symbols. + +With these definitions, +\begin{verbatim} +\newcommand\reallywidehat[1]{% +\begin{array}{c}% +\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}% +} + + +\newcommand\reallywideparen[1]{% +\begin{array}{c}% +\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}% +} +\end{verbatim} +arbitrarily wide oversymbols may be constructed: + +\newcommand\reallywidehat[1]{% +\begin{array}{c}% +\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}% +} + +\newcommand\reallywideparen[1]{% +\begin{array}{c}% +\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}% +} + +\indent +$\reallywideparen{POQ}$ $+ \reallywidehat{QOR} + \reallywidehat{ROP}= +2\pi r$ + +\indent $\reallywidehat{zbcdefghijklm}$ + \section{Future Development} It would be relatively straightforward to extend this approach to diff --git a/Master/texmf-dist/tex/latex/scalerel/scalerel.sty b/Master/texmf-dist/tex/latex/scalerel/scalerel.sty index 58552198bc9..d7cb4baa52c 100644 --- a/Master/texmf-dist/tex/latex/scalerel/scalerel.sty +++ b/Master/texmf-dist/tex/latex/scalerel/scalerel.sty @@ -1,4 +1,7 @@ -\ProvidesPackage{scalerel}[2013/02/27] +\ProvidesPackage{scalerel} +[2013/03/11 v1.1 + Routines for constrained scaling and stretching of objects, + relative to a reference object or in absolute terms] %% Copyright 2013 Steven B. Segletes % % This work may be distributed and/or modified under the @@ -13,8 +16,10 @@ % % The Current Maintainer of this work is Steven B. Segletes. +% V1.01 Correct typos in documentation +% V1.1 Corrected usepackage dependencies; Significant doc rewrite. \usepackage{calc} -\usepackage{tikz} +\usepackage{graphicx} \global\newlength\thesrwidth \global\newlength\thesrheight \global\newlength\srblobheight -- cgit v1.2.3