Debian Codegraph @

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

raw
1 \documentclass{article}
2 \usepackage{figsize}
3
4
5 \title{The FigSize Package}
6 \author{Anthony A. Tanbakuchi \\{\small [email protected]} \\ v0.1 last revised 2002/3/18}
7 \date{}
8
9 \parskip=12pt
10 \parindent=0pt
11 \begin{document}
12 \maketitle
13 \begin{abstract}
14 The FigSize package enables automatic sizing of graphics,
15 especially when including graphics with the graphicx package. The
16 user only has to specify the number of graphics that should fit to
17 a page or fraction there of and the package will dynamically
18 calculate the correct graphics sizes relative to the page size.
19 Thus, graphics can be auto-sized to fill a whole page or fraction
20 and manual changes of graphic sizes are never needed when changing
21 document layouts! Finally, the package's dynamic lengths can be
22 used to allow other document element sizes to be dynamic.
23 \end{abstract}
24
25 \section{Usage}
26
27 Perhaps the best way to see how this package works is to skip to
28 the examples section. However, below is a more general
29 explanation of the package and its use.
30
31 Loading the package:
32
33 \verb"\loadpackage{figsize}"\\
34
35 Next, to allow the FigSize package to dynamically define widths
36 and heights for the graphic simply specify the desired layout
37 using,
38
39
40 \verb"\SetFigLayout[<extra space for long captions>]{<rows>}{<columns>}".
41
42 Where you specify the number of rows and columns of graphics that
43 should fit to a page. Optionally, if you have a long caption you
44 can tell the package how many extra lines of text that should be
45 allowed for on the page as well.
46
47 Then, just include the graphic using the command from the graphicx
48 package (which is just the advanced version of the graphics
49 package),
50
51 \verb"\includegraphics{filename}"\footnote{For a detailed
52 explanation on how to use the graphics package and the
53 $\backslash$includegraphics command see the guide to using
54 graphics with \LaTeX. Found online at
55 http://www.ctan.org/tex-archive/help/Catalogue/entries/grfguide.html?}
56
57 Thus, if one issues the command \verb"\SetFigLayout{2}{1}" the
58 algorithm knows that any graphics inserted after this point with
59 the command \verb"\includegraphics{...}" should be sized so that
60 two high by one wide will fit on a page.
61
62 When \verb"\SetFigLayout{}{}" is issued the package redefines two
63 new page relative lengths \verb"\figwidth" and \verb"\figheight".
64 Then, \verb"\includegraphics{...}" is redefined to by default have
65 optional parameters set to \\
66 \verb"[width=\figwidth, totalheight=\figheight, keepaspectratio]".
67
68 By default, this package makes the assumption that figures should
69 be resized while keeping their aspect ratio. This may not be the
70 desired effect, to remove this effect insert figures using,\\
71 \verb"\includegraphics[width=\figwidth, totalheight=\figheight]{...}"\\
72 \noindent Further, one can utilize all the optional facilities
73 provided by the \verb"\includegraphics{...}" command, simply use
74 the format,\\
75 \verb"\includegraphics[width=\figwidth, totalheight=\figheight, <more options>]{...}"
76
77 Moreover, one can use the new dynamic widths \verb"\figwidth" and
78 \verb"\figheight" for other types of environments like tables,
79 pictures, and so on.
80
81 \section{Package Requirements}
82 When the FigSize package is loaded it loads the
83 \textbf{subfigure}, \textbf{graphicx}, \textbf{ifthen}, and
84 \textbf{calc} packages. These packages must already exist on the
85 \LaTeX system for the FigSize package to work properly.
86
87 \section{Examples}
88
89 The best way to see how this package works is through examples.
90 The next few examples illustrate common uses for the FigSize
91 package.
92
93 The following code sets the size of the graphics so that 4 rows by
94 3 columns of them fit to a page. The result is shown in Figure
95 \ref{fig:1} and \ref{fig:1b}.
96
97 \begin{verbatim}
98 \begin{figure}
99 \SetFigLayout{3}{3}
100 \subfigure[A subfigure.]{\includegraphics{epsfig}}
101 \hfill
102 \subfigure[A subfigure.]{\includegraphics{epsfig}}
103 \hfill
104 \subfigure[A subfigure.]{\includegraphics{epsfig}} \\
105 \subfigure[A subfigure.]{\includegraphics{epsfig}}
106 \hfill
107 \subfigure[A subfigure.]{\includegraphics{epsfig}}
108 \hfill
109 \subfigure[A subfigure.]{\includegraphics{epsfig}} \\
110 \subfigure[A subfigure.]{\includegraphics{epsfig}}
111 \hfill
112 \subfigure[A subfigure.]{\includegraphics{epsfig}}
113 \hfill
114 \subfigure[A subfigure.]{
115 \includegraphics[angle=45, width=\figwidth,
116 totalheight=\figheight, keepaspectratio]{epsfig}}
117
118 \caption{This is where your caption text goes. No
119 optional parameters.}\label{fig:1}
120 \end{figure}
121
122 \begin{figure}
123 \SetFigLayout{3}{3}
124 \subfigure[A subfigure.]{
125 \includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
126 \hfill
127 \subfigure[A subfigure.]{
128 \includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
129 \hfill
130 \subfigure[A subfigure.]{
131 \includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}} \\
132 \subfigure[A subfigure.]{
133 \includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
134 \hfill
135 \subfigure[A subfigure.]{
136 \includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
137 \hfill
138 \subfigure[A subfigure.]{
139 \includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}} \\
140 \subfigure[A subfigure.]{
141 \includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
142 \hfill
143 \subfigure[A subfigure.]{
144 \includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
145 \hfill
146 \subfigure[A subfigure.]{
147 \includegraphics[angle=45, width=\figwidth,
148 totalheight=\figheight]{epsfig}}
149
150 \caption{This is where your caption text goes.
151 Optional parameters causing the aspect ratio to be
152 disregarded.}\label{fig:1b}
153 \end{figure}
154 \end{verbatim}
155
156
157 \begin{figure}
158 \SetFigLayout{3}{3}
159 \subfigure[A subfigure.]{\includegraphics{epsfig}}
160 \hfill
161 \subfigure[A subfigure.]{\includegraphics{epsfig}}
162 \hfill
163 \subfigure[A subfigure.]{\includegraphics{epsfig}} \\
164 \subfigure[A subfigure.]{\includegraphics{epsfig}}
165 \hfill
166 \subfigure[A subfigure.]{\includegraphics{epsfig}}
167 \hfill
168 \subfigure[A subfigure.]{\includegraphics{epsfig}} \\
169 \subfigure[A subfigure.]{\includegraphics{epsfig}}
170 \hfill
171 \subfigure[A subfigure.]{\includegraphics{epsfig}}
172 \hfill
173 \subfigure[A subfigure.]{\includegraphics[angle=45, width=\figwidth, totalheight=\figheight, keepaspectratio]{epsfig}}
174 \caption{This is where your caption text goes. No
175 optional parameters.}\label{fig:1}
176 \end{figure}
177
178 \begin{figure}
179 \SetFigLayout{3}{3}
180 \subfigure[A subfigure.]{\includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
181 \hfill
182 \subfigure[A subfigure.]{\includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
183 \hfill
184 \subfigure[A subfigure.]{\includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}} \\
185 \subfigure[A subfigure.]{\includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
186 \hfill
187 \subfigure[A subfigure.]{\includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
188 \hfill
189 \subfigure[A subfigure.]{\includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}} \\
190 \subfigure[A subfigure.]{\includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
191 \hfill
192 \subfigure[A subfigure.]{\includegraphics[width=\figwidth, totalheight=\figheight]{epsfig}}
193 \hfill
194 \subfigure[A subfigure.]{\includegraphics[angle=45, width=\figwidth, totalheight=\figheight]{epsfig}}
195 \caption{This is where your caption text goes.
196 Optional parameters causing the aspect ratio to be
197 disregarded.}\label{fig:1b}
198 \end{figure}
199
200 The following code produces a graphic occupying the whole page
201 (maximally). The result is shown in Figures \ref{fig:2} and
202 \ref{fig:2b}.
203
204 \begin{verbatim}
205 \begin{figure}
206 \SetFigLayout{1}{1}
207 {\includegraphics{epsfig}}
208 \caption{A graphic meant to occupy a whole page. Note
209 that the aspect ratio is respected so the graphic
210 can only occupy the whole text width.}
211 \end{figure}
212 \end{verbatim}
213
214 \begin{figure}
215 \SetFigLayout{1}{1} {\includegraphics{epsfig}}
216 \caption{A graphic meant to occupy a whole page. Note
217 that the aspect ratio is respected so the graphic
218 can only
219 occupy the whole text width.}\label{fig:2}
220 \end{figure}
221
222 \begin{verbatim}
223 \begin{figure}
224 \SetFigLayout{1}{1}
225 {\includegraphics[%
226 width=\figwidth, totalheight=\figheight]{epsfig}}
227 \caption{Now the graphic occupies the whole page because
228 we manually specified the parameters to the
229 include graphics command which omitted keepaspectratio.}
230 \end{figure}
231 \end{verbatim}
232
233 \begin{figure}
234 \SetFigLayout{1}{1} {\includegraphics[width=\figwidth,
235 totalheight=\figheight]{epsfig}}
236 \caption{Now the graphic occupies the whole page because
237 we manually specified the parameters to the
238 include graphics command which omitted keepaspectratio.}\label{fig:2b}
239 \end{figure}
240
241
242 The next figure is sized such that only two graphics occupy at
243 most half of the page, allowing for document text to flow onto the
244 rest of the page. The result is shown in Figure \ref{fig:3}.
245
246 \begin{verbatim}
247 \begin{figure}
248 \centering
249 \SetFigLayout[3]{2}{2}
250 \subfigure[]{\includegraphics{epsfig}} \hfill
251 \subfigure[]{\includegraphics{epsfig}}
252 \end{figure}
253 \end{verbatim}
254 \
255 \begin{figure}
256 \centering
257 \SetFigLayout[3]{2}{2}
258 \subfigure[]{\includegraphics{epsfig}} \hfill
259 \subfigure[]{\includegraphics{epsfig}}
260 \caption{This is where your caption text goes.}\label{fig:3}
261 \end{figure}
262
263
264
265 The following code is an example of including a full size graphic
266 with a long caption. The option 5 tells the algorithm to leave
267 space for 5 extra lines of caption text. Without providing
268 telling the algorithm that the caption is expected to take at most
269 5 extra lines than the one allowed an over full box would occur on
270 the page.
271 \begin{verbatim}
272
273 \begin{figure}
274 \SetFigLayout[5]{1}{1}
275 {\includegraphics[%
276 width=\figwidth, totalheight=\figheight]{epsfig}}
277 \caption{This is where your caption text goes.
278 This is where your caption text goes.
279 This is where your caption text goes.
280 This is where your caption text goes.
281 This is where your caption text goes.
282 This is where your caption text goes.
283 This is where your caption text goes.}
284 \end{figure}
285 \end{verbatim}
286
287 \begin{figure}
288 \SetFigLayout[5]{1}{1} {\includegraphics[%
289 width=\figwidth, totalheight=\figheight]{epsfig}}
290 \caption{This is where your caption text goes.
291 This is where your caption text goes.
292 This is where your caption text goes.
293 This is where your caption text goes.
294 This is where your caption text goes.
295 This is where your caption text goes.
296 This is where your caption text goes.}\label{fig:4}
297 \end{figure}
298
299 Figure \ref{fig:5} shows how you can mix and match the sizes
300 relative graphic sizes.
301
302 \begin{verbatim}
303 \begin{figure}
304 \centering
305 \SetFigLayout[3]{2}{2}
306 \subfigure[]{\includegraphics{epsfig}} \hfill
307 \subfigure[]{\includegraphics{epsfig}}
308 %Now change the size mid way
309 \SetFigLayout[3]{2}{1}
310 \subfigure[]{\includegraphics{epsfig}}
311 \caption{This is where your caption text goes.}
312 \end{figure}
313 \end{verbatim}
314
315 \begin{figure}
316 \centering
317 \SetFigLayout[3]{2}{2}
318 \subfigure[]{\includegraphics{epsfig}} \hfill
319 \subfigure[]{\includegraphics{epsfig}}
320 \SetFigLayout[3]{2}{1}
321 \subfigure[]{\includegraphics{epsfig}}
322 \caption{This is where your caption text goes.}\label{fig:5}
323 \end{figure}
324
325 Finally, we can utilize the \verb"\figwidth" and \verb"\figheight"
326 commands for other environments like tables as shown in Table
327 \ref{tab:1}. The code that produced the tables was,
328
329 \begin{verbatim}
330 \begin{table}
331 \caption{Two tables that are half page width}\label{tab:1}
332 \SetFigLayout{1}{2}
333 \begin{tabular*}{\figwidth}{ccc}
334 \hline
335 A & B & C \\ \hline
336 555 & 111 & 333 \\
337 555 & 111 & 333 \\
338 555 & 111 & 333 \\
339 555 & 111 & 333 \\
340 555 & 111 & 333 \\
341 \hline
342 \end{tabular*}
343 \hfill
344 \begin{tabular*}{\figwidth}{ccc}
345 \hline
346 A & B & C \\ \hline
347 555 & 111 & 333 \\
348 555 & 111 & 333 \\
349 555 & 111 & 333 \\
350 555 & 111 & 333 \\
351 555 & 111 & 333 \\
352 \hline
353 \end{tabular*}
354
355 \end{table}
356 \end{verbatim}
357
358
359
360 \begin{table}
361 \caption{Two tables that are half page width}\label{tab:1}
362 \SetFigLayout{1}{2}
363 \begin{tabular*}{\figwidth}{ccc}
364 \hline
365 A & B & C \\ \hline
366 555 & 111 & 333 \\
367 555 & 111 & 333 \\
368 555 & 111 & 333 \\
369 555 & 111 & 333 \\
370 555 & 111 & 333 \\
371 \hline
372 \end{tabular*}
373 \hfill
374 \begin{tabular*}{\figwidth}{ccc}
375 \hline
376 A & B & C \\ \hline
377 555 & 111 & 333 \\
378 555 & 111 & 333 \\
379 555 & 111 & 333 \\
380 555 & 111 & 333 \\
381 555 & 111 & 333 \\
382 \hline
383 \end{tabular*}
384
385 \end{table}
386
387
388
389 \section{Closing}
390 If you like this package, find bugs, or just have useful comments
391 please let the me know at [email protected]. Please note
392 that I am not a \TeX hack, just someone who had a wish for this
393 type of package and managed to find a solution.
394 \end{document}