summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/relsize/relsize-doc.tex
blob: 6c63e7eaa78cdcb806e1af06c796958102ccfc0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
\documentclass[12pt,pagesize=auto]{scrartcl}

%\usepackage{fixltx2e} my copy of fixltx2e breaks \thanks numbering!
\usepackage{etex}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{amstext}
\usepackage{booktabs}
\usepackage{microtype}
% This documentation scrupulously avoide \usepackage{relsize}
% It also avoids hyperref mailto:
%\usepackage{hyperref}

\newcommand*{\mail}[1]{\texttt{#1}}
\newcommand*{\pkg}[1]{\textsf{#1}}
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}}
\makeatletter
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}}
\makeatother
\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle}
\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}}

\hyphenpenalty=500

\addtokomafont{title}{\rmfamily}

\title{The \pkg{relsize} package\thanks
  {This manual corresponds to \pkg{relsize.sty}~v4.1, dated~March 29, 2013.}}
\author{%
  by Donald Arseneau\thanks{\mail{asnd@triumf.ca},  Vancouver, Canada}%
  \and originally based on \pkg{smaller.sty} by Bernie Cosell
  \and and combined with code by Matt Swift
}   
\date{March 29, 2013}


\begin{document}

\maketitle

\sloppy
\linespread{1.05}\selectfont

\noindent
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.  To fill this need, \pkg{relsize.sty} defines 
several commands for \LaTeX\ to set font sizes relative to the current size.

\begin{center}
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lll@{}}
    \toprule
    Command           & Function \\
    \cmidrule(r){1-1}         \cmidrule(lr){2-2} 
    \verb|\relsize{|$i$\verb|}|   & Change font size by $i$ steps.\\
    \verb|\larger[|$i$\verb|]|    & Increase size by (optional) $i$ steps (default 1).\\
    \verb|\smaller[|$i$\verb|]|   & Reduce font size by $i$ steps (default~1).\\
    \verb|\relscale{|$f$\verb|}|  & Change font size by scale factor $f$.\\
    \verb|\textlarger[|$i$\verb|]|\marg{text}  & Text size enlarged by (optional) $i$ steps.\\
    \verb|\textsmaller[|$i$\verb|]|\marg{text} & Text size reduced by (optional) $i$ steps.\\
    \verb|\textscale{|$f$\verb|}|\marg{text}   & Text size scaled by factor $f$.\\
    \bottomrule
  \end{tabular*}
\end{center}

To refresh your memory, the font sizing commands in \LaTeX\ are, in order:
\cmd{\tiny}, \cmd{\scriptsize}, \cmd{\footnotesize}, \cmd{\small}, 
\cmd{\normalsize}, \cmd{\large}, \cmd{\Large}, \cmd{\LARGE}, \cmd{\huge}, 
\cmd{\Huge} (package \pkg{moresize} adds \cmd{\ssmall} and \cmd{\HUGE}).  
The main new command provided by \pkg{relsize.sty} is \cmd{\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 \verb|{\relsize{-2} smaller}| 
appears in normal sized text, the word ``smaller'' is printed in script 
size type.  If the same command appears in a \cmd{\Large} section title, 
then ``smaller'' is printed in normal size. 

There are also the commands \cmd{\larger} and \cmd{\smaller}, which normally
change the font size by one step in the obvious direction; \cmd{\larger} is
an abbreviation for \verb|\relsize{+1}|, and \cmd{\smaller} is an
abbreviation for \verb|\relsize{-1}|. For example,
\verb+{\large... \larger{WOW!}}+ prints {\large ``WOW!''} in \cmd{\Large} 
type.  You can also specify bigger steps as an optional argument for 
\cmd{\larger} and \cmd{\smaller}: \verb+\larger[3]+ is equivalent to 
\verb+\relsize{3}+ and \verb+\smaller[2]+ is \verb+\relsize{-2}+.  (Both 
\cmd{\larger} and \cmd{\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 \cmd{\larger} 
commands together; i.e., \verb+\relsize{3}+ or \verb+\larger[3]+, but 
not \verb+\larger\larger\larger+.  Half-steps are possible, as in
\verb+\relsize{-0.5}+ to change from 10\,pt \cmd{\normalsize} to 9\,pt 
\cmd{\small}, but other numbers are rounded to the nearest half-integer.

All of the \cmd{\relsize}, \cmd{\larger}, and \cmd{\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 (or tabular cell, or environment\,\dots).  There are
alternate versions called \cmd{\textlarger} and \cmd{\textsmaller} 
that take some text as an argument and apply the size change to only 
that text: \verb+\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 \cmd{\text\-scale}\marg{factor}\marg{text} and 
\cmd{\relscale}\marg{factor} to select the size based on a scale factor, 
like \verb+\relscale{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 \cmd{\tiny} or 
\cmd{\Huge}.  These limits are controlled by the commands \cmd{\RSsmallest} 
and \cmd{\RSlargest}, which get set automatically when \pkg{relsize.sty} 
is loaded, but you can redefine them to other length values: 
\verb+\renewcommand\RSlargest{50pt}+ (do not use \cmd{\setlength}). 

\begin{small}

Fine point:  The combination 
\verb|\relsize{|$n$\verb|}\relsize{|$-n$\verb|}|
is not guaranteed to 
restore the current font size!  That is because the increment $n$ may be
enough to overflow the range of sizes, depending on \cmd{\RSsmallest},
\cmd{\RSlargest}, and \cmd{\RSpercentTolerance} (below). 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. Or just use 
the commands that take the text as arguments, like \verb+\textsmaller{this}+.

\end{small}

Typically, the font-size commands do not select fonts at precise regular
size ratios (and some commands give half-intervals).  \cmd{\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 \cmd{\RSpercentTolerance} a further 
font-size selection is made.  By~default, \cmd{\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 \verb+\usepackage{type1cm}+ or 
various other font package.)  For special uses, or when the font shape 
definitions are not parsed properly, you can redefine the percent tolerance: 
\verb+\renewcommand\RSpercentTolerance{10}+.  Define it as ``0'' (zero)
to ensure the scaling is exactly as specified, regardless of the
document's standard font sizes.

\smallskip

\noindent\centerline{$ - {~} \times {} \mathbin{\vcenter{\hbox{\Large $\times$}}} {} \times {~} - $}

\smallskip

\noindent
All of the commands described above are text commands; they cannot be used
in math mode.  There are special \cmd{\mathsmaller} and \cmd{\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 \cmd{\displaystyle}, \cmd{\textstyle}, \cmd{\scriptstyle}, and
\cmd{\scriptscriptstyle}% 
%[see Lamport, \LaTeX/Manual (1st~ed, p.\,54); GMS The \LaTeX\ Companion, p.\,255]
\@.  However, the \cmd{\mathlarger} command will also increase the
size beyond regular \cmd{\displaystyle} by selecting a larger regular font size
(using \cmd{\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 \pkg{exscale} so that math symbols
can change size.  The sizes selected are:

\medskip
\begin{center}
  \small
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lll@{}}
    \toprule
    Current style            & \cmd{\mathsmaller} gives  & \cmd{\mathlarger} gives  \\
    \cmidrule(r){1-1}         \cmidrule(lr){2-2}         \cmidrule(l){3-3}
    \cmd{\displaystyle}      & \cmd{\textstyle} (similar)& \cmd{\displaystyle} in \cmd{\larger} font \\
    \cmd{\textstyle}         & \cmd{\scriptstyle}        & \cmd{\displaystyle} (similar) \\
    \cmd{\scriptstyle}       & \cmd{\scriptscriptstyle}  & \cmd{\textstyle}   \\
    \cmd{\scriptscriptstyle} & \cmd{\scriptscriptstyle}  & \cmd{\scriptstyle} \\
    \bottomrule
  \end{tabular*}
\end{center}

\noindent For example, try \verb+$\frac{\mathlarger{E}}{E}$+~= $\frac{\textstyle E}{E}$.  
Note that, for most symbols,
\cmd{\display\-style} and \cmd{\text\-style} give the same size, so 
\verb+$N,\mathlarger{N}$+~= $N\displaystyle N$, showing two identical $N$'s, 
but \cmd{\sum} and \cmd{\int} do get bigger in display style, 
and fractions are treated differently too: \\
\verb+$\int\frac{1}{2}dN - \mathlarger{\int\frac{1}{2}dN}$+~~=~
$\int\frac{1}{2}dN - \displaystyle{\int\frac{1}{2}dN}$.\\[3pt]
As you might have guessed, \cmd{\mathlarger} and \cmd{\mathsmaller} 
should only be used in math mode.

These commands will attempt to attach any superscripts and subscripts 
directly to the symbol within the braces, rather than how they would attach 
to a math sub-formula.  On the other hand, math accents and the math 
spacing do behave as if the symbol is enclosed in braces (which it is).  
Operators should be explicitly declared to use the right operator
type (\cmd{\mathrel}, \cmd{\mathbin}, \cmd{\mathop}) to get the correct 
spacing, e.g., \verb+\mathrel{\mathsmaller{=}}+.

Due to their oddities, the math larger/smaller commands should not be 
trusted very far, and they will not be useful in every instance.

\end{document}