From b2ca732dee27faa563c88f7bbb49f0b86f76d4ed Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 27 Nov 2009 18:53:34 +0000 Subject: separate relsize into its own package git-svn-id: svn://tug.org/texlive/trunk@16203 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/ltxmisc/relsize.sty | 393 ----------------------- Master/texmf-dist/tex/latex/relsize/relsize.sty | 393 +++++++++++++++++++++++ Master/tlpkg/bin/tlpkg-ctan-check | 2 +- Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 + Master/tlpkg/tlpsrc/relsize.tlpsrc | 0 5 files changed, 395 insertions(+), 394 deletions(-) delete mode 100644 Master/texmf-dist/tex/latex/ltxmisc/relsize.sty create mode 100644 Master/texmf-dist/tex/latex/relsize/relsize.sty create mode 100644 Master/tlpkg/tlpsrc/relsize.tlpsrc (limited to 'Master') diff --git a/Master/texmf-dist/tex/latex/ltxmisc/relsize.sty b/Master/texmf-dist/tex/latex/ltxmisc/relsize.sty deleted file mode 100644 index febbf0ac7a8..00000000000 --- a/Master/texmf-dist/tex/latex/ltxmisc/relsize.sty +++ /dev/null @@ -1,393 +0,0 @@ -% relsize.sty 3.1 July 4, 2003 -% This software is contributed to the public domain. - -% LaTex2e version by Donald Arseneau and -% Matt Swift . -% Original LaTex2.09 smaller.sty author: Bernie Cosell -% -% Setting the font size relative to the current size -% -% commands are: -% \relsize{n} where n gives the number of steps ("mag-step" = factor of 1.2) -% to change the size by; n = 3 changes from \normalsize to -% \LARGE size. Negative n selects smaller fonts. -% \smaller == \relsize{-1} -% \larger == \relsize{1} -% \textsmaller{text}, \textlarger{text} - versions that take an argument -% -% \relscale{f} is equivalent to \relsize, but instead of scale-steps, -% the parameter is a scale factor, such as .75 -% \textscale{f}{text} -% -% The font-size command nearest the requested size will be used, and if -% the size error is more than \RSpercentTolerance, then the size will -% be adjusted more precisely. (The default empty \RSpercentTolerance -% signals automatic handling, choosing the tolerance based on the -% font declarations.) -% -% \mathsmaller{A}, \mathlarger{B} - math versions -% (The math versions are entirely different from the text versions.) -% -% There are more instructions at the end of this file (after \endinput). - -\ProvidesPackage{relsize}[2003/07/04 ver 3.1] - -% The next two aren't the real initializations! The real ones are done -% in \@tempb below. The user can change them afterwards. - -\def\RSsmallest{999pt} -\def\RSlargest{1pt} - -% First, right now, we assemble a list of the font sizes - -\def\rs@size{\noexpand\rs@size\noexpand} -\def\rs@fontsizes{} -\def\@tempa#1{\ifx\@undefined#1\else - \expandafter\@tempb#1\delimiter{#1}\fi} -\def\@absVal#1{\ifnum#1<\z@-\fi#1} -% parse definition of font-size command (like \large) -% #1 = \@setfontsize #2 = the command (\large) #3 = size #4 = rest -\def\@tempb#1#2#3#4\delimiter#5{% - \@tempdimb\z@ - \ifx\@setfontsize#1\relax\ifx#5#2\@firstofone\relax - \afterassignment\strip@prefix \@tempdimb #3pt>% - \fi\fi - \ifdim\@tempdimb=\z@ - \def\rs@fontsizes{}% - \let\@tempa\@gobble - \else - \edef\rs@fontsizes{\rs@fontsizes\rs@size#2{\the\@tempdimb}}% - \ifdim\@tempdimb<\RSsmallest \edef\RSsmallest{\the\@tempdimb}\fi - \ifdim\@tempdimb>\RSlargest \edef\RSlargest{\the\@tempdimb}\fi - \fi} - -% examine each (expected) pre-defined font size -\@tempa\normalsize -\@tempa\small -\@tempa\footnotesize -\@tempa\large -\@tempa\Large -\@tempa\LARGE -\@tempa\scriptsize -\@tempa\tiny -\@tempa\huge -\@tempa\Huge -\@tempa\HUGE % moresize.sty -\@tempa\ssmall - -\ifx\rs@fontsizes\@empty % ---------------------------------------------- - -\PackageWarning{relsize}{Failed to get list of font sizes.\MessageBreak - Falling back to old definition.} - -\DeclareRobustCommand\relsize[1]{% -\ifmmode \@nomath\relsize\else - \begingroup - \@tempcnta % assign number representing current font size - \ifx\@currsize\normalsize 4\else % funny order is to have most ... - \ifx\@currsize\small 3\else % ...likely sizes checked first - \ifx\@currsize\footnotesize 2\else - \ifx\@currsize\large 5\else - \ifx\@currsize\Large 6\else - \ifx\@currsize\LARGE 7\else - \ifx\@currsize\scriptsize 1\else - \ifx\@currsize\tiny 0\else - \ifx\@currsize\huge 8\else - \ifx\@currsize\Huge 9\else - 4\rs@unknown@warning % unknown state: \normalsize as starting point - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi -% Change the number by the given increment: - \advance\@tempcnta#1\relax -% watch out for size underflow: - \ifnum\@tempcnta<\z@ \rs@size@warning{small}{\string\tiny}\@tempcnta\z@ \fi - \expandafter\endgroup - \ifcase\@tempcnta % set new size based on altered number - \tiny \or \scriptsize \or \footnotesize \or \small \or \normalsize \or - \large \or \Large \or \LARGE \or \huge \or \Huge \else - \rs@size@warning{large}{\string\Huge}\Huge -\fi\fi} - -\else % ---------------------------------------------- - -\DeclareRobustCommand\relsize[1]{% -\ifmmode \@nomath\relsize\else - \begingroup - % number of demi-magsteps -> \@tempcnta - \@tempdima#1\p@ \@tempdima2.0002\@tempdima \divide\@tempdima\p@ - \@tempcnta\@tempdima - % \message{^^JChange \the\@tempcnta\space half-magsteps from \f@size. }% - % calculate desired target size -> \@tempdimb - \@tempdimb\f@size\p@ - \ifnum\@tempcnta<\z@ - \def\@tempa{.912871}\@tempcnta=-\@tempcnta - \else - \def\@tempa{1.09545}% - \fi - \@whilenum {\@tempcnta>\z@}\do {% - \advance\@tempcnta\m@ne - \@tempdimb\@tempa\@tempdimb}% - % \message{ target size \the\@tempdimb. }% - \rs@scaleToB -\fi} - -\DeclareRobustCommand\relscale[1]{% -\ifmmode \@nomath\relscale\else - \begingroup - \@tempdimb\f@size\p@ \@tempdimb#1\@tempdimb - \rs@scaleToB -\fi} - -\DeclareRobustCommand\textscale[2]{\leavevmode - \begingroup\relscale{#1}#2\endgroup} - -% Change font size to \@tempdimb. Follows from \relsize or \relscale -\def\rs@scaleToB{% - % perform automatic tolerance adjustment, if requested - \ifx\RSpercentTolerance\@empty \rs@autoTol \fi - % apply limits - \ifdim\@tempdimb<\RSsmallest \@tempdimb=\RSsmallest - \rs@size@warning{small}{\RSsmallest}\fi - \ifdim\@tempdimb>\RSlargest \@tempdimb=\RSlargest - \rs@size@warning{large}{\RSlargest}\fi - % look up that size in list of pre-defined sizes. Puts error of - % closest match in \@tempdima - \let\@tempa\relax \@tempdima\maxdimen - \let\rs@size\rs@lookup \rs@fontsizes - % \message{ Look up best as \expandafter\string\@tempa\space - % (off by \the\@tempdima}% - % See how close match was (abs difference -> \@tempdima) - \ifdim\@tempdima<\z@ \@tempdima-\@tempdima\fi - % ... percentage error in \@tempdima (as a count) - \@tempdima 100\@tempdima \divide\@tempdima\@tempdimb - % if error is beyond tolerance, append \fontsize adjustment - % \message{ or \number\@tempdima \expandafter\@gobble\string\%). }% - \ifnum\@tempdima>\RSpercentTolerance - % \message{ adjust size to \strip@pt\@tempdimb. }% - \@tempdima1.2\@tempdimb % baselineskip - \edef\@tempa{\expandafter\noexpand\@tempa \noexpand\fontsize - {\strip@pt\@tempdimb}{\strip@pt\@tempdima}\noexpand\selectfont}\fi - % Now execute size-change command \@tempa - \expandafter\endgroup\@tempa} - -% For each defined font size, compare its actual size to the desired -% size (\@tempdimb) and the error of the best previous match (\@tempdima). -% Record this command (\@tempa) if it is closer. -\def\rs@lookup#1#2{% #1=command #2=size - \begingroup - \advance\@tempdimb-#2\relax - \ifdim\@absVal\@tempdimb<\@absVal\@tempdima % improvement - \endgroup - \def\@tempa{#1}% - \@tempdima#2\relax \advance\@tempdima-\@tempdimb - \else - \endgroup - \fi} - -\fi % ---------------------------------------------- - - -% Tolerance for size mis-match (%). The empty definition triggers -% automatic selection: 5 for scalable fonts, 30 otherwise. - -\def\RSpercentTolerance{} - -\def\rs@autoTol{% - \expandafter\expandafter\expandafter\rs@autoTOL - \expandafter\meaning - \csname\f@encoding/\f@family/\f@series/\f@shape\endcsname-\delimiter -} -\def\rs@autoTOL#1>#2-#3\delimiter{% - \ifx\delimiter#3\delimiter % no - - \def\RSpercentTolerance{30}% - \else % font size def has -, assume it covers continuum - \def\RSpercentTolerance{5}% - \fi - % \message{ Automatic tolerance is \RSpercentTolerance. }% -} - -% Warning messages - -\newcommand\rs@size@warning[2]{\PackageWarning{relsize}{% - Size requested is too #1.\MessageBreak Using #2 instead}} - -\newcommand\rs@unknown@warning{\PackageWarning{relsize}{Current font size - is unknown! (Why?!?)\MessageBreak Assuming \string\normalsize}} - -% derived commands - -\DeclareRobustCommand\larger[1][\@ne]{\relsize{+#1}} -\DeclareRobustCommand\smaller[1][\@ne]{\relsize{-#1}} -\DeclareRobustCommand\textlarger[2][\@ne]{{\relsize{+#1}#2}} -\DeclareRobustCommand\textsmaller[2][\@ne]{{\relsize{-#1}#2}} - -% math commands (completely different) - -\DeclareRobustCommand\mathsmaller[1]{\bgroup - \let\rs@makechoice\rs@makesmallerchoice - \def\rs@mathatom{#1}% - \futurelet\@tempa\rs@collect@decor -} -\DeclareRobustCommand\mathlarger[1]{\bgroup - \let\rs@makechoice\rs@makelargerchoice - \def\rs@mathatom{#1}% - \futurelet\@tempa\rs@collect@decor -} - -% math so far is in \rs@mathatom; next tok is \@tempa; continuation is \@tempb -% Don't nest \ifs because token may be \if or \fi or \or... -\def\rs@collect@decor{% - \let\@tempb\rs@makechoice - \ifx\@tempa\limits \let\@tempb\rs@collect@one@decor \fi - \ifx\@tempa\displaylimits \let\@tempb\rs@collect@one@decor \fi - \ifx\@tempa\nolimits \let\@tempb\rs@collect@one@decor \fi - \if\noexpand\@tempa^\let\@tempb\rs@collect@two@decor \fi - \if\noexpand\@tempa_\let\@tempb\rs@collect@two@decor \fi - \ifx\@tempa\sp \let\@tempb\rs@collect@two@decor \fi - \ifx\@tempa\sb \let\@tempb\rs@collect@two@decor \fi - \@tempb} -\def\rs@collect@one@decor#1{% - \expandafter\def\expandafter\rs@mathatom\expandafter{\rs@mathatom#1}% - \futurelet\@tempa\rs@collect@decor} -\def\rs@collect@two@decor#1#2{\expandafter - \def\expandafter\rs@mathatom\expandafter{\rs@mathatom#1{\rs@sstyle{#2}}}% - \futurelet\@tempa\rs@collect@decor} -\let\rs@sstyle\@firstofone - -\def\rs@makesmallerchoice{\mathchoice - {\textstyle \let\rs@sstyle\scriptstyle \rs@mathatom}% - {\scriptstyle \let\rs@sstyle\scriptstyle \rs@mathatom}% - {\scriptscriptstyle \let\rs@sstyle\scriptscriptstyle \rs@mathatom}% - {\scriptscriptstyle \let\rs@sstyle\scriptscriptstyle \rs@mathatom}% - \egroup} -\def\rs@makelargerchoice{\mathchoice - {\protected@edef\rs@sstyle##1{% - \protect\set@fontsize {1}{\f@size}{\f@baselineskip}\protect\selectfont - \hbox{$\scriptstyle ##1\m@th$}}% - \mbox{\larger$\displaystyle\rs@mathatom\m@th$}}% - {\displaystyle \let\rs@sstyle\scriptstyle \rs@mathatom}% - {\textstyle \let\rs@sstyle\scriptscriptstyle \rs@mathatom}% - {\scriptstyle \let\rs@sstyle\scriptscriptstyle \rs@mathatom}% - \egroup} - -\endinput -========================================================== - -R E L S I Z E . S T Y ver 3.1 July 4, 2003 - -by Donald Arseneau, asnd@triumf.ca, Vancouver, Canada -origianally based on smaller.sty by Bernie Cosell, cosell@WILMA.BBN.COM, -and combined with the version by Matt Swift, swift@bu.edu. - - -It is frequently the case that something should be typeset somewhat larger -or smaller than the surrounding text, whatever that size happens to be. -Specifying such sizing commands explicitly makes it difficult to modify the -font sizes of a document at a later time, and makes it hard to write macros -that work at arbitrary sizes. Relsize.sty defines several commands for LaTeX -to set font sizes relative to the current size. - -To refresh your memory, the font sizing commands in LaTeX are, in order: -\tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, -\LARGE, \huge, \Huge (package moresize adds \ssmall and \HUGE). The main -new command provided by relsize.sty is \relsize, which takes one (positive -or negative) number as its argument; the number specifies how many "steps" -by which to change the font size, where each step is a scaling factor of -1.2, corresponding to the usual difference between the size commands. For -example, if "{\relsize{-2} smaller}" appears in normal sized text, the word -"smaller" is printed in script size type. If the same command appears in a -\Large section title, then "smaller" is printed in normal size. - -There are also the commands \larger and \smaller, which normally change the -font size by one step in the obvious direction; \larger is an abbreviation -for \relsize{+1}, and \smaller is an abbreviation for \relsize{-1}. For -example, {\large... \larger{WOW!}} prints "WOW" in \Large type. You can -also specify bigger steps as an optional argument for \larger and \smaller: -\larger[3] is equivalent to \relsize{3}; \smaller[2] is \relsize{-2}. -Both \larger and \smaller accept negative arguments, but please don't make -things so obscure! If you want to change size by several steps it is -much better to give an increment than to string several \larger commands -together; i.e., \relsize{3} or \larger[3], but not \larger\larger\larger. - -All of the \relsize, \larger, and \smaller commands are "switches" just -like the regular sizing commands. That is, they change the size for all -following text until the scope is ended by a closing brace. There are -alternate versions called \textlarger and \textsmaller that take some text -as an argument and apply the size change to only that text: -\textlarger{big}. - -Using the number of "magnification steps" to indicate font size can -be confusing to some people, and limiting in certain uses. There are -commands with syntax \textscale{factor}{text} and \relscale{factor} to -select the size based on a scale factor, like {0.75}. - -If the size requested is too small or too large, a warning is given, and -the size will only change as far as appropriate, typically \tiny or \Huge. -These limits are controlled by the commands \RSsmallest and \RSlargest, which -get set automatically when relsize.sty is loaded, but you can redefine them -to other length values: \renewcommand\RSlargest{50pt}. - -Fine point: The combination \relsize{n}\relsize{-n} is not guaranteed to -restore the current font size! That is because the increment "n" may be -enough to overflow the range of sizes. Say you are in \huge text already, -and you do \relsize{4}. There is nothing bigger than \Huge so that is the -size you get. Then an ensuing \relsize{-4} will take four steps smaller -and change the size to \large. You should use grouping to undo relative -size changes because it is unsafe to counteract one change with an "equal" -change in the opposite direction. - -Typically, the font-size commands do not select fonts at regular size -intervals. \relsize (and the others) will select, and execute, the command -for the size closest to the desired size. Then, if the relative difference -from the target size is more than \RSpercentTolerance a further font-size -selection is made. By default, \RSpercentTolerance is an empty macro, which -causes automatic selection: "30" (30%) when the current "fontshape" definition -is composed of only discrete sizes, and "5" when the fontshape definition -covers ranges of sizes. The higher setting for discrete fonts ensures -only the pre-defined sizes get used. (By default LaTeX uses Computer -Modern fonts at discrete sizes; you get full coverage of sizes by using -\usepackage{type1cm}.) For special uses, or when the font shape definitions -are not parsed properly, you can redefine the percent tolerance: -\renewcommand\RSpercentTolerance{10}. - -All of the commands described above are text commands; they cannot be used -in math mode. There are special \mathsmaller and \mathlarger commands -provided, but these do not use the same sizes that the text versions use. -Instead, they step between the usual math "styles" which you can explicitly -set using the commands \displaystyle, \textstyle, \scriptstyle, and -\scriptscriptstyle [see Lamport, LaTeX/Manual (1st ed, p.54); GMS The LaTeX -Companion, p.255]. However, the \mathlarger command will also increase the -size beyond regular \displaystyle by selecting a larger regular font size -(using \larger). (Yes, this is a kludge, and doesn't work very well, but -it can still be useful.) If you want to use this to create big integral -signs, then you must also load the package "exscale" so that math symbols -can change size. The sizes selected are: - -Current style \mathsmaller gives \mathlarger gives ---------------- ---------------------- ------------------------ -\displaystyle \textstyle (almost same) \displaystyle in a \larger font -\textstyle \scriptstyle \displaystyle (almost same) -\scriptstyle \scriptscriptstyle \textstyle -\scriptscriptstyle \scriptscriptstyle (same) \scriptstyle - -For example, try $\frac{\mathlarger{E}}{E}$. Note that, for most symbols, -\displaystyle and \textstyle are the same size, so $N \mathlarger{N}$ -gives two identical N's, but \sum and \int do get bigger in display style: -$\int\mathlarger{\int}$, and fractions are treated differently too: -$\frac{1}{2} \mathlarger{\frac{1}{2}}$. As you might have guessed, -\mathlarger and \mathsmaller should only be used in math mode. - -These commands will attempt to attach superscripts and subscripts to the -symbol as if the symbol were used alone: $\mathlarger{\int}_{0}^{\infty}$ -but math accents and the math spacing behave as if the symbol is enclosed -in braces (which it is). Comparing -\[ -| \times | {\times} | \mathlarger{\times} | \mathbin{\mathlarger{\times}} | -\] -shows that operators must be explicitly declared to use the right operator -type (\mathrel, \mathbin, \mathop) to get the correct spacing. - -Due to their oddities, the math larger/smaller commands should not be -trusted blindly, and they will not be useful in every instance. - - -Donald Arseneau asnd@triumf.ca diff --git a/Master/texmf-dist/tex/latex/relsize/relsize.sty b/Master/texmf-dist/tex/latex/relsize/relsize.sty new file mode 100644 index 00000000000..febbf0ac7a8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/relsize/relsize.sty @@ -0,0 +1,393 @@ +% relsize.sty 3.1 July 4, 2003 +% This software is contributed to the public domain. + +% LaTex2e version by Donald Arseneau and +% Matt Swift . +% Original LaTex2.09 smaller.sty author: Bernie Cosell +% +% Setting the font size relative to the current size +% +% commands are: +% \relsize{n} where n gives the number of steps ("mag-step" = factor of 1.2) +% to change the size by; n = 3 changes from \normalsize to +% \LARGE size. Negative n selects smaller fonts. +% \smaller == \relsize{-1} +% \larger == \relsize{1} +% \textsmaller{text}, \textlarger{text} - versions that take an argument +% +% \relscale{f} is equivalent to \relsize, but instead of scale-steps, +% the parameter is a scale factor, such as .75 +% \textscale{f}{text} +% +% The font-size command nearest the requested size will be used, and if +% the size error is more than \RSpercentTolerance, then the size will +% be adjusted more precisely. (The default empty \RSpercentTolerance +% signals automatic handling, choosing the tolerance based on the +% font declarations.) +% +% \mathsmaller{A}, \mathlarger{B} - math versions +% (The math versions are entirely different from the text versions.) +% +% There are more instructions at the end of this file (after \endinput). + +\ProvidesPackage{relsize}[2003/07/04 ver 3.1] + +% The next two aren't the real initializations! The real ones are done +% in \@tempb below. The user can change them afterwards. + +\def\RSsmallest{999pt} +\def\RSlargest{1pt} + +% First, right now, we assemble a list of the font sizes + +\def\rs@size{\noexpand\rs@size\noexpand} +\def\rs@fontsizes{} +\def\@tempa#1{\ifx\@undefined#1\else + \expandafter\@tempb#1\delimiter{#1}\fi} +\def\@absVal#1{\ifnum#1<\z@-\fi#1} +% parse definition of font-size command (like \large) +% #1 = \@setfontsize #2 = the command (\large) #3 = size #4 = rest +\def\@tempb#1#2#3#4\delimiter#5{% + \@tempdimb\z@ + \ifx\@setfontsize#1\relax\ifx#5#2\@firstofone\relax + \afterassignment\strip@prefix \@tempdimb #3pt>% + \fi\fi + \ifdim\@tempdimb=\z@ + \def\rs@fontsizes{}% + \let\@tempa\@gobble + \else + \edef\rs@fontsizes{\rs@fontsizes\rs@size#2{\the\@tempdimb}}% + \ifdim\@tempdimb<\RSsmallest \edef\RSsmallest{\the\@tempdimb}\fi + \ifdim\@tempdimb>\RSlargest \edef\RSlargest{\the\@tempdimb}\fi + \fi} + +% examine each (expected) pre-defined font size +\@tempa\normalsize +\@tempa\small +\@tempa\footnotesize +\@tempa\large +\@tempa\Large +\@tempa\LARGE +\@tempa\scriptsize +\@tempa\tiny +\@tempa\huge +\@tempa\Huge +\@tempa\HUGE % moresize.sty +\@tempa\ssmall + +\ifx\rs@fontsizes\@empty % ---------------------------------------------- + +\PackageWarning{relsize}{Failed to get list of font sizes.\MessageBreak + Falling back to old definition.} + +\DeclareRobustCommand\relsize[1]{% +\ifmmode \@nomath\relsize\else + \begingroup + \@tempcnta % assign number representing current font size + \ifx\@currsize\normalsize 4\else % funny order is to have most ... + \ifx\@currsize\small 3\else % ...likely sizes checked first + \ifx\@currsize\footnotesize 2\else + \ifx\@currsize\large 5\else + \ifx\@currsize\Large 6\else + \ifx\@currsize\LARGE 7\else + \ifx\@currsize\scriptsize 1\else + \ifx\@currsize\tiny 0\else + \ifx\@currsize\huge 8\else + \ifx\@currsize\Huge 9\else + 4\rs@unknown@warning % unknown state: \normalsize as starting point + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi +% Change the number by the given increment: + \advance\@tempcnta#1\relax +% watch out for size underflow: + \ifnum\@tempcnta<\z@ \rs@size@warning{small}{\string\tiny}\@tempcnta\z@ \fi + \expandafter\endgroup + \ifcase\@tempcnta % set new size based on altered number + \tiny \or \scriptsize \or \footnotesize \or \small \or \normalsize \or + \large \or \Large \or \LARGE \or \huge \or \Huge \else + \rs@size@warning{large}{\string\Huge}\Huge +\fi\fi} + +\else % ---------------------------------------------- + +\DeclareRobustCommand\relsize[1]{% +\ifmmode \@nomath\relsize\else + \begingroup + % number of demi-magsteps -> \@tempcnta + \@tempdima#1\p@ \@tempdima2.0002\@tempdima \divide\@tempdima\p@ + \@tempcnta\@tempdima + % \message{^^JChange \the\@tempcnta\space half-magsteps from \f@size. }% + % calculate desired target size -> \@tempdimb + \@tempdimb\f@size\p@ + \ifnum\@tempcnta<\z@ + \def\@tempa{.912871}\@tempcnta=-\@tempcnta + \else + \def\@tempa{1.09545}% + \fi + \@whilenum {\@tempcnta>\z@}\do {% + \advance\@tempcnta\m@ne + \@tempdimb\@tempa\@tempdimb}% + % \message{ target size \the\@tempdimb. }% + \rs@scaleToB +\fi} + +\DeclareRobustCommand\relscale[1]{% +\ifmmode \@nomath\relscale\else + \begingroup + \@tempdimb\f@size\p@ \@tempdimb#1\@tempdimb + \rs@scaleToB +\fi} + +\DeclareRobustCommand\textscale[2]{\leavevmode + \begingroup\relscale{#1}#2\endgroup} + +% Change font size to \@tempdimb. Follows from \relsize or \relscale +\def\rs@scaleToB{% + % perform automatic tolerance adjustment, if requested + \ifx\RSpercentTolerance\@empty \rs@autoTol \fi + % apply limits + \ifdim\@tempdimb<\RSsmallest \@tempdimb=\RSsmallest + \rs@size@warning{small}{\RSsmallest}\fi + \ifdim\@tempdimb>\RSlargest \@tempdimb=\RSlargest + \rs@size@warning{large}{\RSlargest}\fi + % look up that size in list of pre-defined sizes. Puts error of + % closest match in \@tempdima + \let\@tempa\relax \@tempdima\maxdimen + \let\rs@size\rs@lookup \rs@fontsizes + % \message{ Look up best as \expandafter\string\@tempa\space + % (off by \the\@tempdima}% + % See how close match was (abs difference -> \@tempdima) + \ifdim\@tempdima<\z@ \@tempdima-\@tempdima\fi + % ... percentage error in \@tempdima (as a count) + \@tempdima 100\@tempdima \divide\@tempdima\@tempdimb + % if error is beyond tolerance, append \fontsize adjustment + % \message{ or \number\@tempdima \expandafter\@gobble\string\%). }% + \ifnum\@tempdima>\RSpercentTolerance + % \message{ adjust size to \strip@pt\@tempdimb. }% + \@tempdima1.2\@tempdimb % baselineskip + \edef\@tempa{\expandafter\noexpand\@tempa \noexpand\fontsize + {\strip@pt\@tempdimb}{\strip@pt\@tempdima}\noexpand\selectfont}\fi + % Now execute size-change command \@tempa + \expandafter\endgroup\@tempa} + +% For each defined font size, compare its actual size to the desired +% size (\@tempdimb) and the error of the best previous match (\@tempdima). +% Record this command (\@tempa) if it is closer. +\def\rs@lookup#1#2{% #1=command #2=size + \begingroup + \advance\@tempdimb-#2\relax + \ifdim\@absVal\@tempdimb<\@absVal\@tempdima % improvement + \endgroup + \def\@tempa{#1}% + \@tempdima#2\relax \advance\@tempdima-\@tempdimb + \else + \endgroup + \fi} + +\fi % ---------------------------------------------- + + +% Tolerance for size mis-match (%). The empty definition triggers +% automatic selection: 5 for scalable fonts, 30 otherwise. + +\def\RSpercentTolerance{} + +\def\rs@autoTol{% + \expandafter\expandafter\expandafter\rs@autoTOL + \expandafter\meaning + \csname\f@encoding/\f@family/\f@series/\f@shape\endcsname-\delimiter +} +\def\rs@autoTOL#1>#2-#3\delimiter{% + \ifx\delimiter#3\delimiter % no - + \def\RSpercentTolerance{30}% + \else % font size def has -, assume it covers continuum + \def\RSpercentTolerance{5}% + \fi + % \message{ Automatic tolerance is \RSpercentTolerance. }% +} + +% Warning messages + +\newcommand\rs@size@warning[2]{\PackageWarning{relsize}{% + Size requested is too #1.\MessageBreak Using #2 instead}} + +\newcommand\rs@unknown@warning{\PackageWarning{relsize}{Current font size + is unknown! (Why?!?)\MessageBreak Assuming \string\normalsize}} + +% derived commands + +\DeclareRobustCommand\larger[1][\@ne]{\relsize{+#1}} +\DeclareRobustCommand\smaller[1][\@ne]{\relsize{-#1}} +\DeclareRobustCommand\textlarger[2][\@ne]{{\relsize{+#1}#2}} +\DeclareRobustCommand\textsmaller[2][\@ne]{{\relsize{-#1}#2}} + +% math commands (completely different) + +\DeclareRobustCommand\mathsmaller[1]{\bgroup + \let\rs@makechoice\rs@makesmallerchoice + \def\rs@mathatom{#1}% + \futurelet\@tempa\rs@collect@decor +} +\DeclareRobustCommand\mathlarger[1]{\bgroup + \let\rs@makechoice\rs@makelargerchoice + \def\rs@mathatom{#1}% + \futurelet\@tempa\rs@collect@decor +} + +% math so far is in \rs@mathatom; next tok is \@tempa; continuation is \@tempb +% Don't nest \ifs because token may be \if or \fi or \or... +\def\rs@collect@decor{% + \let\@tempb\rs@makechoice + \ifx\@tempa\limits \let\@tempb\rs@collect@one@decor \fi + \ifx\@tempa\displaylimits \let\@tempb\rs@collect@one@decor \fi + \ifx\@tempa\nolimits \let\@tempb\rs@collect@one@decor \fi + \if\noexpand\@tempa^\let\@tempb\rs@collect@two@decor \fi + \if\noexpand\@tempa_\let\@tempb\rs@collect@two@decor \fi + \ifx\@tempa\sp \let\@tempb\rs@collect@two@decor \fi + \ifx\@tempa\sb \let\@tempb\rs@collect@two@decor \fi + \@tempb} +\def\rs@collect@one@decor#1{% + \expandafter\def\expandafter\rs@mathatom\expandafter{\rs@mathatom#1}% + \futurelet\@tempa\rs@collect@decor} +\def\rs@collect@two@decor#1#2{\expandafter + \def\expandafter\rs@mathatom\expandafter{\rs@mathatom#1{\rs@sstyle{#2}}}% + \futurelet\@tempa\rs@collect@decor} +\let\rs@sstyle\@firstofone + +\def\rs@makesmallerchoice{\mathchoice + {\textstyle \let\rs@sstyle\scriptstyle \rs@mathatom}% + {\scriptstyle \let\rs@sstyle\scriptstyle \rs@mathatom}% + {\scriptscriptstyle \let\rs@sstyle\scriptscriptstyle \rs@mathatom}% + {\scriptscriptstyle \let\rs@sstyle\scriptscriptstyle \rs@mathatom}% + \egroup} +\def\rs@makelargerchoice{\mathchoice + {\protected@edef\rs@sstyle##1{% + \protect\set@fontsize {1}{\f@size}{\f@baselineskip}\protect\selectfont + \hbox{$\scriptstyle ##1\m@th$}}% + \mbox{\larger$\displaystyle\rs@mathatom\m@th$}}% + {\displaystyle \let\rs@sstyle\scriptstyle \rs@mathatom}% + {\textstyle \let\rs@sstyle\scriptscriptstyle \rs@mathatom}% + {\scriptstyle \let\rs@sstyle\scriptscriptstyle \rs@mathatom}% + \egroup} + +\endinput +========================================================== + +R E L S I Z E . S T Y ver 3.1 July 4, 2003 + +by Donald Arseneau, asnd@triumf.ca, Vancouver, Canada +origianally based on smaller.sty by Bernie Cosell, cosell@WILMA.BBN.COM, +and combined with the version by Matt Swift, swift@bu.edu. + + +It is frequently the case that something should be typeset somewhat larger +or smaller than the surrounding text, whatever that size happens to be. +Specifying such sizing commands explicitly makes it difficult to modify the +font sizes of a document at a later time, and makes it hard to write macros +that work at arbitrary sizes. Relsize.sty defines several commands for LaTeX +to set font sizes relative to the current size. + +To refresh your memory, the font sizing commands in LaTeX are, in order: +\tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, +\LARGE, \huge, \Huge (package moresize adds \ssmall and \HUGE). The main +new command provided by relsize.sty is \relsize, which takes one (positive +or negative) number as its argument; the number specifies how many "steps" +by which to change the font size, where each step is a scaling factor of +1.2, corresponding to the usual difference between the size commands. For +example, if "{\relsize{-2} smaller}" appears in normal sized text, the word +"smaller" is printed in script size type. If the same command appears in a +\Large section title, then "smaller" is printed in normal size. + +There are also the commands \larger and \smaller, which normally change the +font size by one step in the obvious direction; \larger is an abbreviation +for \relsize{+1}, and \smaller is an abbreviation for \relsize{-1}. For +example, {\large... \larger{WOW!}} prints "WOW" in \Large type. You can +also specify bigger steps as an optional argument for \larger and \smaller: +\larger[3] is equivalent to \relsize{3}; \smaller[2] is \relsize{-2}. +Both \larger and \smaller accept negative arguments, but please don't make +things so obscure! If you want to change size by several steps it is +much better to give an increment than to string several \larger commands +together; i.e., \relsize{3} or \larger[3], but not \larger\larger\larger. + +All of the \relsize, \larger, and \smaller commands are "switches" just +like the regular sizing commands. That is, they change the size for all +following text until the scope is ended by a closing brace. There are +alternate versions called \textlarger and \textsmaller that take some text +as an argument and apply the size change to only that text: +\textlarger{big}. + +Using the number of "magnification steps" to indicate font size can +be confusing to some people, and limiting in certain uses. There are +commands with syntax \textscale{factor}{text} and \relscale{factor} to +select the size based on a scale factor, like {0.75}. + +If the size requested is too small or too large, a warning is given, and +the size will only change as far as appropriate, typically \tiny or \Huge. +These limits are controlled by the commands \RSsmallest and \RSlargest, which +get set automatically when relsize.sty is loaded, but you can redefine them +to other length values: \renewcommand\RSlargest{50pt}. + +Fine point: The combination \relsize{n}\relsize{-n} is not guaranteed to +restore the current font size! That is because the increment "n" may be +enough to overflow the range of sizes. Say you are in \huge text already, +and you do \relsize{4}. There is nothing bigger than \Huge so that is the +size you get. Then an ensuing \relsize{-4} will take four steps smaller +and change the size to \large. You should use grouping to undo relative +size changes because it is unsafe to counteract one change with an "equal" +change in the opposite direction. + +Typically, the font-size commands do not select fonts at regular size +intervals. \relsize (and the others) will select, and execute, the command +for the size closest to the desired size. Then, if the relative difference +from the target size is more than \RSpercentTolerance a further font-size +selection is made. By default, \RSpercentTolerance is an empty macro, which +causes automatic selection: "30" (30%) when the current "fontshape" definition +is composed of only discrete sizes, and "5" when the fontshape definition +covers ranges of sizes. The higher setting for discrete fonts ensures +only the pre-defined sizes get used. (By default LaTeX uses Computer +Modern fonts at discrete sizes; you get full coverage of sizes by using +\usepackage{type1cm}.) For special uses, or when the font shape definitions +are not parsed properly, you can redefine the percent tolerance: +\renewcommand\RSpercentTolerance{10}. + +All of the commands described above are text commands; they cannot be used +in math mode. There are special \mathsmaller and \mathlarger commands +provided, but these do not use the same sizes that the text versions use. +Instead, they step between the usual math "styles" which you can explicitly +set using the commands \displaystyle, \textstyle, \scriptstyle, and +\scriptscriptstyle [see Lamport, LaTeX/Manual (1st ed, p.54); GMS The LaTeX +Companion, p.255]. However, the \mathlarger command will also increase the +size beyond regular \displaystyle by selecting a larger regular font size +(using \larger). (Yes, this is a kludge, and doesn't work very well, but +it can still be useful.) If you want to use this to create big integral +signs, then you must also load the package "exscale" so that math symbols +can change size. The sizes selected are: + +Current style \mathsmaller gives \mathlarger gives +--------------- ---------------------- ------------------------ +\displaystyle \textstyle (almost same) \displaystyle in a \larger font +\textstyle \scriptstyle \displaystyle (almost same) +\scriptstyle \scriptscriptstyle \textstyle +\scriptscriptstyle \scriptscriptstyle (same) \scriptstyle + +For example, try $\frac{\mathlarger{E}}{E}$. Note that, for most symbols, +\displaystyle and \textstyle are the same size, so $N \mathlarger{N}$ +gives two identical N's, but \sum and \int do get bigger in display style: +$\int\mathlarger{\int}$, and fractions are treated differently too: +$\frac{1}{2} \mathlarger{\frac{1}{2}}$. As you might have guessed, +\mathlarger and \mathsmaller should only be used in math mode. + +These commands will attempt to attach superscripts and subscripts to the +symbol as if the symbol were used alone: $\mathlarger{\int}_{0}^{\infty}$ +but math accents and the math spacing behave as if the symbol is enclosed +in braces (which it is). Comparing +\[ +| \times | {\times} | \mathlarger{\times} | \mathbin{\mathlarger{\times}} | +\] +shows that operators must be explicitly declared to use the right operator +type (\mathrel, \mathbin, \mathop) to get the correct spacing. + +Due to their oddities, the math larger/smaller commands should not be +trusted blindly, and they will not be useful in every instance. + + +Donald Arseneau asnd@triumf.ca diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 50451763718..093126c9354 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -219,7 +219,7 @@ my @WorkingTLP = qw( qcm qobitree qstest qsymbols qtree quotmark r_und_s randbild rangen rccol rcs rcs-multi rcsinfo recipe recipecard recycle - refman refstyle regcount register resumemac revtex + refman refstyle regcount register relsize resumemac revtex rjlparshap robustcommand robustindex romannum rotating rsc rsfs rtkinenc rtklage diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index c584bc640b8..3710aaba067 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -458,6 +458,7 @@ depend refstyle depend regcount depend register depend relenc +depend relsize depend repeatindex depend rjlparshap depend rlepsf diff --git a/Master/tlpkg/tlpsrc/relsize.tlpsrc b/Master/tlpkg/tlpsrc/relsize.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3