Debian Codegraph @

texmf-dist/doc/latex/relsize/relsize-doc.tex

raw
1 \documentclass[12pt,pagesize=auto]{scrartcl}
2
3 %\usepackage{fixltx2e} my copy of fixltx2e breaks \thanks numbering!
4 \usepackage{etex}
5 \usepackage{lmodern}
6 \usepackage[T1]{fontenc}
7 \usepackage{textcomp}
8 \usepackage{amstext}
9 \usepackage{booktabs}
10 \usepackage{microtype}
11 % This documentation scrupulously avoide \usepackage{relsize}
12 % It also avoids hyperref mailto:
13 %\usepackage{hyperref}
14
15 \newcommand*{\mail}[1]{\texttt{#1}}
16 \newcommand*{\pkg}[1]{\textsf{#1}}
17 \newcommand*{\cs}[1]{\texttt{\textbackslash#1}}
18 \makeatletter
19 \newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}}
20 \makeatother
21 \newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle}
22 \newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}}
23
24 \hyphenpenalty=500
25
26 \addtokomafont{title}{\rmfamily}
27
28 \title{The \pkg{relsize} package\thanks
29 {This manual corresponds to \pkg{relsize.sty}~v4.1, dated~March 29, 2013.}}
30 \author{%
31 by Donald Arseneau\thanks{\mail{[email protected]}, Vancouver, Canada}%
32 \and originally based on \pkg{smaller.sty} by Bernie Cosell
33 \and and combined with code by Matt Swift
34 }
35 \date{March 29, 2013}
36
37
38 \begin{document}
39
40 \maketitle
41
42 \sloppy
43 \linespread{1.05}\selectfont
44
45 \noindent
46 It is frequently the case that something should be typeset somewhat larger
47 or smaller than the surrounding text, whatever that size happens to be.
48 Specifying such sizing commands explicitly makes it difficult to modify the
49 font sizes of a document at a later time, and makes it hard to write macros
50 that work at arbitrary sizes. To fill this need, \pkg{relsize.sty} defines
51 several commands for \LaTeX\ to set font sizes relative to the current size.
52
53 \begin{center}
54 \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lll@{}}
55 \toprule
56 Command & Function \\
57 \cmidrule(r){1-1} \cmidrule(lr){2-2}
58 \verb|\relsize{|$i$\verb|}| & Change font size by $i$ steps.\\
59 \verb|\larger[|$i$\verb|]| & Increase size by (optional) $i$ steps (default 1).\\
60 \verb|\smaller[|$i$\verb|]| & Reduce font size by $i$ steps (default~1).\\
61 \verb|\relscale{|$f$\verb|}| & Change font size by scale factor $f$.\\
62 \verb|\textlarger[|$i$\verb|]|\marg{text} & Text size enlarged by (optional) $i$ steps.\\
63 \verb|\textsmaller[|$i$\verb|]|\marg{text} & Text size reduced by (optional) $i$ steps.\\
64 \verb|\textscale{|$f$\verb|}|\marg{text} & Text size scaled by factor $f$.\\
65 \bottomrule
66 \end{tabular*}
67 \end{center}
68
69 To refresh your memory, the font sizing commands in \LaTeX\ are, in order:
70 \cmd{\tiny}, \cmd{\scriptsize}, \cmd{\footnotesize}, \cmd{\small},
71 \cmd{\normalsize}, \cmd{\large}, \cmd{\Large}, \cmd{\LARGE}, \cmd{\huge},
72 \cmd{\Huge} (package \pkg{moresize} adds \cmd{\ssmall} and \cmd{\HUGE}).
73 The main new command provided by \pkg{relsize.sty} is \cmd{\relsize},
74 which takes one (positive or negative) number as its argument; the number
75 specifies how many ``steps'' by which to change the font size, where each
76 step is a scaling factor of~1.2, corresponding to the usual difference
77 between the size commands. For example, if \verb|{\relsize{-2} smaller}|
78 appears in normal sized text, the word ``smaller'' is printed in script
79 size type. If the same command appears in a \cmd{\Large} section title,
80 then ``smaller'' is printed in normal size.
81
82 There are also the commands \cmd{\larger} and \cmd{\smaller}, which normally
83 change the font size by one step in the obvious direction; \cmd{\larger} is
84 an abbreviation for \verb|\relsize{+1}|, and \cmd{\smaller} is an
85 abbreviation for \verb|\relsize{-1}|. For example,
86 \verb+{\large... \larger{WOW!}}+ prints {\large ``WOW!''} in \cmd{\Large}
87 type. You can also specify bigger steps as an optional argument for
88 \cmd{\larger} and \cmd{\smaller}: \verb+\larger[3]+ is equivalent to
89 \verb+\relsize{3}+ and \verb+\smaller[2]+ is \verb+\relsize{-2}+. (Both
90 \cmd{\larger} and \cmd{\smaller} accept negative arguments, but please
91 don't make things so obscure!) If you want to change size by several steps
92 it is much better to give an increment than to string several \cmd{\larger}
93 commands together; i.e., \verb+\relsize{3}+ or \verb+\larger[3]+, but
94 not \verb+\larger\larger\larger+. Half-steps are possible, as in
95 \verb+\relsize{-0.5}+ to change from 10\,pt \cmd{\normalsize} to 9\,pt
96 \cmd{\small}, but other numbers are rounded to the nearest half-integer.
97
98 All of the \cmd{\relsize}, \cmd{\larger}, and \cmd{\smaller} commands
99 are ``switches'' just like the regular sizing commands. That is, they
100 change the size for all following text until the scope is ended by a
101 closing brace (or tabular cell, or environment\,\dots). There are
102 alternate versions called \cmd{\textlarger} and \cmd{\textsmaller}
103 that take some text as an argument and apply the size change to only
104 that text: \verb+\textlarger{big}+.
105
106 Using the number of ``magnification steps'' to indicate font size can
107 be confusing to some people, and limiting in certain uses. There are
108 commands with syntax \cmd{\text\-scale}\marg{factor}\marg{text} and
109 \cmd{\relscale}\marg{factor} to select the size based on a scale factor,
110 like \verb+\relscale{0.75}+.
111
112 If the size requested is too small or too large, a warning is given, and
113 the size will only change as far as appropriate, typically \cmd{\tiny} or
114 \cmd{\Huge}. These limits are controlled by the commands \cmd{\RSsmallest}
115 and \cmd{\RSlargest}, which get set automatically when \pkg{relsize.sty}
116 is loaded, but you can redefine them to other length values:
117 \verb+\renewcommand\RSlargest{50pt}+ (do not use \cmd{\setlength}).
118
119 \begin{small}
120
121 Fine point: The combination
122 \verb|\relsize{|$n$\verb|}\relsize{|$-n$\verb|}|
123 is not guaranteed to
124 restore the current font size! That is because the increment $n$ may be
125 enough to overflow the range of sizes, depending on \cmd{\RSsmallest},
126 \cmd{\RSlargest}, and \cmd{\RSpercentTolerance} (below). You should use
127 grouping to undo relative size changes because it is unsafe to counteract
128 one change with an ``equal'' change in the opposite direction. Or just use
129 the commands that take the text as arguments, like \verb+\textsmaller{this}+.
130
131 \end{small}
132
133 Typically, the font-size commands do not select fonts at precise regular
134 size ratios (and some commands give half-intervals). \cmd{\relsize}
135 and the others will select, and execute, the command for the size
136 closest to the desired size. Then, if the relative difference
137 from the target size is more than \cmd{\RSpercentTolerance} a further
138 font-size selection is made. By~default, \cmd{\RSpercentTolerance}
139 is an empty macro, which causes automatic selection: ``30'' (30\,\%)
140 when the current ``fontshape'' definition is composed of only discrete
141 sizes, and ``5'' when the fontshape definition covers ranges of sizes.
142 The higher setting for discrete fonts ensures only the pre-defined sizes
143 get used. (By~default \LaTeX\ uses Computer Modern fonts at discrete sizes;
144 you get full coverage of sizes by using \verb+\usepackage{type1cm}+ or
145 various other font package.) For special uses, or when the font shape
146 definitions are not parsed properly, you can redefine the percent tolerance:
147 \verb+\renewcommand\RSpercentTolerance{10}+. Define it as ``0'' (zero)
148 to ensure the scaling is exactly as specified, regardless of the
149 document's standard font sizes.
150
151 \smallskip
152
153 \noindent\centerline{$ - {~} \times {} \mathbin{\vcenter{\hbox{\Large $\times$}}} {} \times {~} - $}
154
155 \smallskip
156
157 \noindent
158 All of the commands described above are text commands; they cannot be used
159 in math mode. There are special \cmd{\mathsmaller} and \cmd{\mathlarger} commands
160 provided, but these do not use the same sizes that the text versions use.
161 Instead, they step between the usual math ``styles'' which you can explicitly
162 set using the commands \cmd{\displaystyle}, \cmd{\textstyle}, \cmd{\scriptstyle}, and
163 \cmd{\scriptscriptstyle}%
164 %[see Lamport, \LaTeX/Manual (1st~ed, p.\,54); GMS The \LaTeX\ Companion, p.\,255]
165 \@. However, the \cmd{\mathlarger} command will also increase the
166 size beyond regular \cmd{\displaystyle} by selecting a larger regular font size
167 (using \cmd{\larger})\@. (Yes, this is a kludge, and doesn't work very well, but
168 it can still be useful.) If you want to use this to create big integral
169 signs, then you must also load the package \pkg{exscale} so that math symbols
170 can change size. The sizes selected are:
171
172 \medskip
173 \begin{center}
174 \small
175 \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lll@{}}
176 \toprule
177 Current style & \cmd{\mathsmaller} gives & \cmd{\mathlarger} gives \\
178 \cmidrule(r){1-1} \cmidrule(lr){2-2} \cmidrule(l){3-3}
179 \cmd{\displaystyle} & \cmd{\textstyle} (similar)& \cmd{\displaystyle} in \cmd{\larger} font \\
180 \cmd{\textstyle} & \cmd{\scriptstyle} & \cmd{\displaystyle} (similar) \\
181 \cmd{\scriptstyle} & \cmd{\scriptscriptstyle} & \cmd{\textstyle} \\
182 \cmd{\scriptscriptstyle} & \cmd{\scriptscriptstyle} & \cmd{\scriptstyle} \\
183 \bottomrule
184 \end{tabular*}
185 \end{center}
186
187 \noindent For example, try \verb+$\frac{\mathlarger{E}}{E}$+~= $\frac{\textstyle E}{E}$.
188 Note that, for most symbols,
189 \cmd{\display\-style} and \cmd{\text\-style} give the same size, so
190 \verb+$N,\mathlarger{N}$+~= $N\displaystyle N$, showing two identical $N$'s,
191 but \cmd{\sum} and \cmd{\int} do get bigger in display style,
192 and fractions are treated differently too: \\
193 \verb+$\int\frac{1}{2}dN - \mathlarger{\int\frac{1}{2}dN}$+~~=~
194 $\int\frac{1}{2}dN - \displaystyle{\int\frac{1}{2}dN}$.\\[3pt]
195 As you might have guessed, \cmd{\mathlarger} and \cmd{\mathsmaller}
196 should only be used in math mode.
197
198 These commands will attempt to attach any superscripts and subscripts
199 directly to the symbol within the braces, rather than how they would attach
200 to a math sub-formula. On the other hand, math accents and the math
201 spacing do behave as if the symbol is enclosed in braces (which it is).
202 Operators should be explicitly declared to use the right operator
203 type (\cmd{\mathrel}, \cmd{\mathbin}, \cmd{\mathop}) to get the correct
204 spacing, e.g., \verb+\mathrel{\mathsmaller{=}}+.
205
206 Due to their oddities, the math larger/smaller commands should not be
207 trusted very far, and they will not be useful in every instance.
208
209 \end{document}