; TeX output 1996.03.06:1232soKvDtGGcmr17The7tGGcmss17text tpacqkageforscalinguptexttoadesired7Ssize!", cmsy10XQ cmr12SebastianRahrtzPhilTVarylor37 1994/04/158ZINff cmbx12ContentsI"V cmbx101XIn9troQduction1 =I1aLIntros3ductionIK`y cmr10TheRuserneedstobGeabletospecifythewidthorheightfortext, andusethe Ilargestsizenecessaryto llthatwidthorheight. Y*oucanchoGosewhetherIto"havethesizeincreasedbysimplepGoints,Oorbyusingmagsteps. -Usage:Iow cmss9pack9age#g i Ls2S:ߤN cmtt9\NeedsTeXFormat{LaTeX2e}Ls3S\ProvidesPackage{textfit}[\filedate]Ls4S\newif\ifScalebyMagstepsLs5S\newif\ifNoisyFittingLs6S\NoisyFittingfalseLs7S\ScalebyMagstepsfalseLs8S\DeclareOption{noisy}{\NoisyFittingtrue}Ls9S\DeclareOption{magstep}{\ScalebyMagstepstrue}I10S\ProcessOptionsI11S\newcount\mags@f@rI12S\newdimen\desired@sizeI13S\newcount\r@mainderI14S\newcount\m@gstepcountI15S\newcount\m@gsteplimitI16S\newcount\m@gstepvalueI17S\newdimen\m@gstepdimenICoGdeUUforworkingouttherightmagstep(thisisPhil'sbit).I18S\def\magsteps{\afterassignment\m@gsteps\m@gsteplimit=}I19S\def\m@gstepsI20f{\let\@r=\orI21kJ\def\or{\noexpand\or}%I22kJ\m@gstepdimen=0.166667\maxdimenI23kJ\m@gstepvalue=1000I24kJ\m@gstepcount=0I25kJ\def\magstep{}%I26kJ\loopI27kJ\ifnum\m@gstepcount<\m@gsteplimitI28D\advance\m@gstepcountby1I29D\ifnum\m@gstepvalue>\m@gstepdimenI30\advance\m@gstepcountby-1I31\message{Sorry---integeroverflowwouldoccurif2soI32Iwentanyfurther;stoppedat I336v\the\m@gstepcount.}I34\m@gsteplimit=\m@gstepcountI35D\elseI36\multiply\m@gstepvalueby12I37\multiply\r@mainderby12I38\divide\r@mainderby10I39\advance\m@gstepvalueby\r@mainderI40\r@mainder=\m@gstepvalueI41\divide\m@gstepvalueby10I42\multiply\m@gstepvalueby10I43\advance\r@mainderby-\m@gstepvalueI44\divide\m@gstepvalueby10I45\ifnum\r@mainder<5I46#\edef\magstep{\magstep\or\the\m@gstepvalue}%I47\elseI48#\advance\m@gstepvalueby1I49#\edef\magstep{\magstep\or\the\m@gstepvalue}%I50#\advance\m@gstepvalueby-1I51\fiI52D\fiI53kJ\repeatI54kJ\edef\magstep##1%I55{\noexpand\ifcase##1I561000\magstepI57 \noexpand\else0%I58 \noexpand\messageI59D{Sorry---\string\magstep\space##1I60nisnotinrange0..\the\m@gsteplimit}%I61 \noexpand\fiI62 \noexpand\relaxI63}%I64kJ\let\or=\@rI65f}I66S\magsteps63I67S\def\Fontname#1{\expandafter\strip@size\fontname#1}I68S\def\strip@size#1#2#{#1\void@@@}I69S\def\void@@@#1{}I70S\gdef\n@d#1.#2:{#1}I71S\def\@scaletofit[#1]#2#3{%I72kJ\def\Hb@x{h}\def\H@rV{#1}%I73kJ\ifx\H@rV\Hb@x\def\C@mpare{\wd}\else\def\C@mpare{\ht}\fiI74kJ\desired@size#2I75kJ\def\curr@fontname{\Fontname\font{}}%I76kJ\ifScalebyMagstepsI77yw^\mags@f@r\z@I78yw^\setbox0=\hbox{#3}%I79yw^\def\@increment{1}%I80S\def\@test{<}%I81yw^\ifdim\C@mpare0>\desired@sizeI82 \message{WhenscalingbyMagsteps,youcannotgodownwards!}%I83yw^\fiI84yw^\loopI85yw^\font\temp@font=\curr@fontname s,scaled\magstep\mags@f@r3psoI86S\setbox0=\hbox{{\temp@font#3}}% I87yw^\ifNoisyFittingI88\message{Trying\noexpand\magstep\the\mags@f@r...}%I89yw^\fiI90yw^\ifdim\C@mpare0\@test\desired@sizeI91 \advance\mags@f@rby\@incrementI92yw^\repeatI93yw^\ifnum\mags@f@r=\z@I94 \mags@f@r1I95~0\fiI96~0\advance\mags@f@rby-\@incrementI97kJ\elseI98yw^\font\temp@font=\curr@fontnameat1ptI99yw^\setbox0=\hbox{{\temp@font#3}}%E100yw^\@tempdima\C@mpare0E101yw^\multiply\@tempdimaby500%\@mE102yw^\def\foo@@{\expandafter\n@d\the\@tempdima:}%E103yw^\@tempdimb\desired@sizeE104yw^\divide\@tempdimbby\foo@@E105yw^\multiply\@tempdimbby500%\@mE106kJ\fiE107kJ\ifScalebyMagstepsE108yw^\ifNoisyFittingE109]\message{Thecalculatedfontis\curr@fontnameE110 scaled\noexpand\magstep\the\mags@f@r}%E111yw^\fiE112yw^\font\temp@font=\curr@fontnamescaled\magstep\mags@f@rE113kJ\elseE114yw^\ifNoisyFittingE115 \message{Thecalculatedfontis\curr@fontname->\the\@tempdimb}%E116yw^\fiE117yw^\font\temp@font=\curr@fontnameat\the\@tempdimbE118kJ\fiE119kJ\ifx\H@rV\Hb@xE120yw^\hboxto\desired@size{\hss{\temp@font#3}\hss}%E121kJ\elseE122yw^\hbox{{\temp@font#3}}%E123kJ\fiE124S}E125S%userinterfaceE126S\def\scaletowidth{\@scaletofit[h]}E127S\def\scaletoheight{\@scaletofit[v]}E128Sh<5" cmmi9=pack9age#g i4;KK>ow cmss9= cmsy9<5" cmmi9:ߤN cmtt98DtcGcmr170K`yG cmr10*DtGcmr17'K`y cmr10&Dt`@Gcmr17%K`yU cmr10$Dt Gcmr17#DtjGcmr17 K`y cmr10