Debian Codegraph @

texmf-dist/doc/latex/aiaa/pre2004/demos/subfigs/smpsubf.tex

raw
1 % `smpsubf.tex' - a sample of subfigure usage
2 %
3 % see epslatex.{ps,pdf} in the info directory of the CTAN for
4 % more discussion on figure placement, usage, etc.
5 %
6 \documentclass{aiaa}% use draft mode to check for
7 % over-full boxes (big black lines).
8
9 % declare new lengths that are used for computing subfigure
10 % layouts when doing up-down, left-right ordered tables of subfigures.
11
12 \newlength{\subfigwidth}% subfigure width
13 \newlength{\subfigcolsep}% separation between subfigures
14 \setlength{\subfigcolsep}{2\tabcolsep}% tie to that used for tabular
15
16 % define a command that creates meaningless blocks of text.
17 % use is, for example, \replicate{4}{text} where `4' is the
18 % number of times to repeat the filler `text'.
19
20 \makeatletter
21 \newcounter{numrepeat}
22 \newcommand{\replicate}[2]{\par
23 \setcounter{numrepeat}{#1}\relax
24 \@whilenum \value{numrepeat} > 0 \do
25 {{#2}\addtocounter{numrepeat}{-1}}\par}
26 \makeatother
27
28 % make a command to be the filler text
29 % for the replicate command above:
30
31 \newcommand{\filler}%
32 {\em More text and even more text and even more text.
33 Followed by some other stuff.
34 Then adding yet additional material.
35 Lets now change gears and talk about some other stuff for a while.
36 I am sick-to-death of this other bit of rambling,
37 and besides I need more material.}
38
39 \title{Some Subfigure Layout Choices}
40 \author{Bil Kleb\\
41 {\it NASA Langley Research Center, Hampton,~Virginia,~23681}}
42
43 \begin{document}
44
45 \maketitle
46
47 The purpose of this document is to present a number
48 of different subfigure layout options. The methods are currently
49 rather {\em ad hoc}, but future versions should make this sort
50 of thing more automatic and remove the requirement for
51 fiddling on a case-by-case basis.
52
53
54 \section{Two stacked figures}
55
56 Let's start off with a simple one: two figures stacked one atop the
57 other as shown in Fig.~\ref{fig:3f}.
58 \begin{figure}
59 \begin{subfigmatrix}{1}
60 \subfigure[The first one. ]{\incfig{smpfig}}
61 \subfigure[The second one.]{\incfig{smpfig}}
62 \end{subfigmatrix}
63 \caption{Two, stacked subfigures.}
64 \label{fig:3f}
65 \end{figure}
66 \replicate{3}{\filler}
67
68
69 \section{Six Figures}
70
71 \subsection{Up-down, Left-right Ordering}
72
73 This is some text, referencing Fig.~\ref{fig:udlr}. Note that
74 the order of the sub figures is up-down, then left-right.
75 Beware that alignment will be thrown off if the subcaptions are
76 typeset with differing numbers of lines, i.e., a long subcaption
77 and a short subcaption and the \texttt{[b]} alignment option for the
78 minipages are not used.
79 \begin{figure}
80 \setlength{\subfigwidth}{.5\linewidth}
81 \addtolength{\subfigwidth}{-.5\subfigcolsep}
82 \vspace*{-\subfigtopskip}
83 \begin{minipage}[b]{\subfigwidth}
84 \subfigure[The first one. ]{\incfig{smpfig}}
85 \end{minipage}
86 \begin{minipage}[b]{\subfigwidth}
87 \setcounter{subfigure}{3}
88 \subfigure[The fourth one.]{\incfig{smpfig}}
89 \end{minipage}
90 \begin{minipage}[b]{\subfigwidth}
91 \setcounter{subfigure}{1}
92 \subfigure[The second one.]{\incfig{smpfig}}
93 \end{minipage}
94 \begin{minipage}[b]{\subfigwidth}
95 \setcounter{subfigure}{4}
96 \subfigure[The fifth one. ]{\incfig{smpfig}}
97 \end{minipage}
98 \begin{minipage}[b]{\subfigwidth}
99 \setcounter{subfigure}{2}
100 \subfigure[The third one. ]{\incfig{smpfig}}
101 \end{minipage}\hfill
102 \begin{minipage}[b]{\subfigwidth}
103 \setcounter{subfigure}{5}
104 \subfigure[The sixth one. ]{\incfig{smpfig}}
105 \end{minipage}
106 \caption{Up-down ordering of the subfigures
107 using the minipage environment.}
108 \label{fig:udlr}
109 \end{figure}
110 \replicate{4}{\filler}
111
112 \subsection{Left-Right, Up-Down Ordering}
113
114 Now, if we wanted the ordering to be left-right, then
115 up-down, we could use the tabular environment. This
116 is how Fig.~\ref{fig:lrud} was generated.
117 \begin{figure}
118 \begin{subfigmatrix}{2}
119 \subfigure[The first one. ]{\incfig{smpfig}}
120 \subfigure[The second one.]{\incfig{smpfig}}
121 \subfigure[The third one. ]{\incfig{smpfig}}
122 \subfigure[The fourth one.]{\incfig{smpfig}}
123 \subfigure[The fifth one. ]{\incfig{smpfig}}
124 \subfigure[The sixth one. ]{\incfig{smpfig}}
125 \end{subfigmatrix}
126 \caption{Ordering the subfigures from left-to-right, then
127 up-down using the tabular environment.}
128 \label{fig:lrud}
129 \end{figure}
130 \replicate{4}{\filler}
131
132 \section{Eight Figures Spanning Both Columns}
133
134 This Fig.~\ref{fig:long} shows the method of `continuing'
135 the figure onto another page.
136 \begin{figure*}
137 \begin{subfigmatrix}{2}
138 \subfigure[The first one. ]{\incfig{smpfig}}
139 \subfigure[The second one.]{\incfig{smpfig}}
140 \subfigure[The third one. ]{\incfig{smpfig}}
141 \subfigure[The fourth one.]{\incfig{smpfig}}
142 \subfigure[The fifth one. ]{\incfig{smpfig}}
143 \subfigure[The sixth one. ]{\incfig{smpfig}}
144 \end{subfigmatrix}
145 \caption{Ordering the subfigures from left-to-right, then
146 up-down using the tabular environment.}
147 \label{fig:long}
148 \end{figure*}
149 \addtocounter{figure}{-1}
150 \setcounter{subfigure}{6}
151 \begin{figure*}
152 \begin{subfigmatrix}{2}
153 \subfigure[The seventh one.]{\incfig{smpfig}}
154 \subfigure[The eighth one. ]{\incfig{smpfig}}
155 \end{subfigmatrix}
156 \caption{Concluded.}
157 \end{figure*}
158 \replicate{4}{\filler}
159
160
161 \section{Nine Subfigures}
162
163 \subsection{Up-down, Left-right Ordering}
164
165 This is some text, referencing Fig.~\ref{fig:3ud3lr}. Note that
166 the order of the sub figures is up-down, then left-right.
167 \begin{figure}[htb!]
168 \setlength{\subfigwidth}{.333\linewidth}
169 \addtolength{\subfigwidth}{-.667\subfigcolsep}
170 \vspace*{-\subfigtopskip}
171 \begin{minipage}[b]{\subfigwidth}
172 \subfigure[The first.]{\incfig{smpfig}}
173 \end{minipage}
174 \begin{minipage}[b]{\subfigwidth}
175 \setcounter{subfigure}{3}
176 \subfigure[The fourth.]{\incfig{smpfig}}
177 \end{minipage}
178 \begin{minipage}[b]{\subfigwidth}
179 \setcounter{subfigure}{6}
180 \subfigure[The seventh.]{\incfig{smpfig}}
181 \end{minipage}
182 \begin{minipage}[b]{\subfigwidth}
183 \setcounter{subfigure}{1}
184 \subfigure[The second.]{\incfig{smpfig}}
185 \end{minipage}
186 \begin{minipage}[b]{\subfigwidth}
187 \setcounter{subfigure}{4}
188 \subfigure[The fifth.]{\incfig{smpfig}}
189 \end{minipage}
190 \begin{minipage}[b]{\subfigwidth}
191 \setcounter{subfigure}{7}
192 \subfigure[The eighth.]{\incfig{smpfig}}
193 \end{minipage}
194 \begin{minipage}[b]{\subfigwidth}
195 \setcounter{subfigure}{2}
196 \subfigure[The third.]{\incfig{smpfig}}
197 \end{minipage}\hfill
198 \begin{minipage}[b]{\subfigwidth}
199 \setcounter{subfigure}{5}
200 \subfigure[The sixth.]{\incfig{smpfig}}
201 \end{minipage}\hfill
202 \begin{minipage}[b]{\subfigwidth}
203 \setcounter{subfigure}{8}
204 \subfigure[The ninth.]{\incfig{smpfig}}
205 \end{minipage}
206 \caption{Up-down ordering of the subfigures
207 using the minipage environment.}
208 \label{fig:3ud3lr}
209 \end{figure}
210 \replicate{4}{\filler}
211
212 \subsection{Left-Right, Up-Down Ordering}
213
214 Now, if we wanted the ordering to be left-right, then
215 up-down, we could use the tabular environment. This
216 is how Fig.~\ref{fig:3lr3ud} was generated. This figure spans both
217 columns, so it is most likely out of order (and appears near or
218 at the end of this document).
219 \begin{figure*}
220 \begin{subfigmatrix}{3}
221 \subfigure[The first. ]{\incfig{smpfig}}
222 \subfigure[The second. ]{\incfig{smpfig}}
223 \subfigure[The third. ]{\incfig{smpfig}}
224 \subfigure[The fourth. ]{\incfig{smpfig}}
225 \subfigure[The fifth. ]{\incfig{smpfig}}
226 \subfigure[The sixth. ]{\incfig{smpfig}}
227 \subfigure[The seventh.]{\incfig{smpfig}}
228 \subfigure[The eighth. ]{\incfig{smpfig}}
229 \subfigure[The ninth. ]{\incfig{smpfig}}
230 \end{subfigmatrix}
231 \caption{Ordering the subfigures from
232 left-to-right, then up-down
233 using the tabular environment.}
234 \label{fig:3lr3ud}
235 \end{figure*}
236 \replicate{4}{\filler}
237
238
239 \section{Two Small Subfigures and One Large One}
240
241 \subsection{A}
242
243 Next, we try two small figures with one large one. This attempt
244 is shown in Fig.~\ref{fig:2s1l}.
245 \begin{figure}[htb!]
246 \setlength{\subfigwidth}{.284\linewidth}% have to FIDDLE with this
247 \addtolength{\subfigwidth}{-.5\subfigcolsep}
248 \begin{minipage}[b]{\subfigwidth}
249 \begin{subfigmatrix}{1}
250 \subfigure[One.]{\incfig{smpfig}}
251 \subfigure[Two.]{\incfig{smpfig}}
252 \end{subfigmatrix}
253 \end{minipage}
254 \addtolength{\subfigwidth}{.5\subfigcolsep}
255 \addtolength{\subfigwidth}{-\linewidth}
256 \setlength{\subfigwidth}{-\subfigwidth}
257 \addtolength{\subfigwidth}{-.5\subfigcolsep}
258 \begin{minipage}[b]{\subfigwidth}
259 \subfigure[The large one.]{\incfig{smpfig}}
260 \end{minipage}
261 \caption{Two small subfigures and a large one.}
262 \label{fig:2s1l}
263 \end{figure}
264 \replicate{3}{\filler}
265
266 \subsection{B}
267
268 Figure~\ref{fig:1l2s} is the same, only with the large/small
269 positions swapped about the vertical axis.
270 \begin{figure}[htb!]
271 \setlength{\subfigwidth}{.716\linewidth}% have to FIDDLE with this
272 \addtolength{\subfigwidth}{-.5\subfigcolsep}
273 \begin{minipage}[b]{\subfigwidth}
274 \subfigure[The large one.]{\incfig{smpfig}}
275 \end{minipage}
276 \addtolength{\subfigwidth}{.5\subfigcolsep}
277 \addtolength{\subfigwidth}{-\linewidth}
278 \setlength{\subfigwidth}{-\subfigwidth}
279 \addtolength{\subfigwidth}{-.5\subfigcolsep}
280 \begin{minipage}[b]{\subfigwidth}
281 \begin{subfigmatrix}{1}
282 \subfigure[One.]{\incfig{smpfig}}
283 \subfigure[Two.]{\incfig{smpfig}}
284 \end{subfigmatrix}
285 \end{minipage}
286 \caption{One large subfigure beside two small ones.}
287 \label{fig:1l2s}
288 \end{figure}
289 \replicate{1}{\filler}
290
291 \subsection{C}
292
293 Now, for a slightly different effect, two subfigures on top with
294 a large one on the bottom, see Fig.~\ref{fig:2st1l}.
295 \begin{figure}[htb!]
296 \begin{subfigmatrix}{2}
297 \subfigure[One.]{\incfig{smpfig}}
298 \subfigure[Two.]{\incfig{smpfig}}
299 \end{subfigmatrix}%
300 \begin{subfigmatrix}{1}
301 \centering\subfigure[The large one.]{\incfig{smpfig}}
302 \end{subfigmatrix}
303 \caption{Two smaller subfigures over a larger one.}
304 \label{fig:2st1l}
305 \end{figure}
306 \replicate{1}{\filler}
307
308 \subsection{D}
309
310 And, of coarse the old large subfigure on top with
311 two subfigures beneath. Fig.~\ref{fig:1lt2sb} demonstrates
312 this one.
313 \begin{figure*}[htb!]
314 \begin{subfigmatrix}{1}
315 \subfigure[The large one.]{\incfig{smpfig}}
316 \end{subfigmatrix}
317 \begin{subfigmatrix}{2}
318 \subfigure[One.]{\incfig{smpfig}}
319 \subfigure[Two.]{\incfig{smpfig}}
320 \end{subfigmatrix}
321 \caption{One large subfigure above two smaller ones.}
322 \label{fig:1lt2sb}
323 \end{figure*}
324 \replicate{2}{\filler}
325
326 \subsection{E}
327
328 Steve Alter prompted Figure~\ref{f:twobytwo}: two with two on the side.
329 \begin{figure*}
330 %
331 \newlength{\firstfigwidth}
332 \newlength{\secondfigwidth}
333 \newlength{\thirdfigwidth}
334 %
335 \setlength{\firstfigwidth}{0.39745\linewidth}% FIDDLE with these
336 \setlength{\secondfigwidth}{0.39745\linewidth}% two numbers
337 %
338 \setlength{\thirdfigwidth}{\linewidth}
339 \addtolength{\thirdfigwidth}{-4\tabcolsep}
340 \addtolength{\thirdfigwidth}{-\firstfigwidth}
341 \addtolength{\thirdfigwidth}{-\secondfigwidth}
342 %
343 \begin{minipage}[t]{\firstfigwidth}
344 \subfigure[Representative planes of X34 viscous grid.]
345 {\incfig{smpfig}}
346 \end{minipage}% note: `%'s are important in this region
347 \hspace{2\tabcolsep}%
348 \begin{minipage}[t]{\secondfigwidth}
349 \subfigure[Meridnal plane.]
350 {\incfig{smpfig}}
351 \end{minipage}% note: `%'s are important in this region
352 \hspace{2\tabcolsep}%
353 \begin{minipage}[b]{\thirdfigwidth}
354 \begin{subfigmatrix}{1}
355 \subfigure[Wing root.]{\incfig{smpfig}}
356 \subfigure[Wing tip.]{\incfig{smpfig}}
357 \end{subfigmatrix}
358 \end{minipage}
359 %
360 \caption{X34 volume grid used for viscous computations.}
361 \label{f:twobytwo}
362 %
363 \end{figure*}
364 \replicate{3}{\filler}
365
366 \end{document}