source: docs/HPCA2012/final_ieee/floatfge.tex @ 1782

Last change on this file since 1782 was 1733, checked in by ashriram, 8 years ago

Final IEEE

File size: 11.5 KB
Line 
1%%
2%% This is file `floatfge.tex',
3%% generated with the docstrip utility.
4%%
5%% The original source files were:
6%%
7%% floatflt.dtx  (with options: `gammalkod')
8%%
9%% Copyright (c) 1994-1998 by Mats Dahlgren <matsd@sssk.se>.
10%% All rights reserved.  See the file `floatflt.ins' for information
11%% on how you may (re-)distribute the `floatflt' package files.
12%% You are not allowed to make any changes to this file without
13%% explicit permission from the author.
14%%
15 \documentclass[11pt]{article}
16 %
17 \textheight=1.1\textheight
18 \textwidth=1.15\textwidth
19 \oddsidemargin=0pt
20 \evensidemargin=0pt
21 %
22 \begin{document}
23 %
24 \title{\LaTeX-Paragraphs Floating around Figures}
25 \author{{\it Thomas Kneser}\\{\footnotesize
26 Gesellschaft f\"ur wissenschaftliche Datenverarbeitung
27  mbH G\"ottingen, FRG}}
28 \date{August 20, 1990}
29 \maketitle
30 %
31 \begin{abstract}
32 %
33 \noindent Frequently figures do not fill the full pagewidth.
34 If the width of such figures is only half of the
35 pagewidth or even less,
36 textlines should be set beside the figures,
37 or -- from another point of view -- figures should `float'
38 in paragraphs.
39 This article presents the \LaTeX{} style option {\tt FLOATFIG}
40 which can be used to set such Floating Figures as easily
41 as \LaTeX's standard figures.
42 \end{abstract}
43 %
44 \section{The name of the game}
45 The macros which make up the {\tt FLOATFIG} style option
46 are based on PLAIN-\TeX\ macros developed by Thomas Reid
47 (TUGBoat Vol. 8 \# 3 page 315), who pointed out
48 how to set figures
49 {\bf right justified} with paragraphs floating around them.
50 For such objects
51 Th. Reid has chosen the term `Floating Figures'.
52
53 This choice might cause some confusion,
54 when we adapt these macros for \LaTeX,
55 since Leslie Lamport uses the term `float' for objects
56 which are realized as \TeX-\verb+\inserts+.
57 While L. Lamports floats are floating in `main vertical list',
58 floats introduced by Th. Reid
59 are floating in paragraphs.
60 For the following we adopt the latter meaning.
61 \section{How to use it}
62 The Floating Figures style option is fully compatible with
63 \LaTeX's standard figure facility:
64 \begin{enumerate}
65 \item Floating Figures and standard figures may be requested
66       in any sequence,
67 \item Floating Figures can be captioned like standard figures,
68 \item captioned Floating Figures are inserted in the list of figures
69       which may be printed by the standard
70       \verb+\listoffigures+ command.
71 \end{enumerate}
72 A Floating Figure may be requested as follows:
73 \begin{verbatim}
74   \documentstyle[floatfig]{article}
75   \begin{document}
76   \initfloatingfigs
77           .
78           .
79   \begin{floatingfigure}{5.6cm}
80   \vspace{6.cm}
81   \caption{Intermolecular potential K-Xe}% optional !
82   \end{floatingfigure}
83           .
84           .
85   \end{document}
86 \end{verbatim}
87 where {\tt 5.6cm} specifies the width of the figure space.
88 A Floating Figure may only be requested in vertical mode, that is
89 between paragraphs.
90
91 A Floating Figure will be set as soon as possible after its request
92 has be encountered by \TeX.
93 That means,
94 it will be tested if there is enough vertical space
95 on the current page;
96 otherwise the figure moves to the next page.
97
98 Floating Figures are set {\bf alternating},
99 that is on the right hand side on odd and
100 on the left hand side on even numbered pages.
101 %
102 \subsection{Restrictions}
103 \begin{enumerate}
104 \item The {\tt FLOATFIG} style option may not be combined with the
105 {\tt TWOCOLUMN} style option,
106 \item a Floating Figure will never appear in a paragraph
107 which begins on top of a page.
108 \end{enumerate}
109 %
110 \section{About the internals}
111 %
112 We have extended the macros designed by Th.~Reid with regard to:
113 \begin{enumerate}
114 \item implantation into the \LaTeX{} context,
115 \item alternating setting of Floating Figures as explained above,
116 \item generation of warning messages for `collisions' of
117       two Floating Figures.
118 \end{enumerate}
119 %
120 \subsection{Implantation into the \LaTeX{} context}
121 The PLAIN-\TeX{} implementation by Th.~Reid
122 is based on a redefined \verb+\output+ routine:
123 %
124 \begin{verbatim}
125   \edef\oldoutput{\the\output}%
126   \output={\the\outputpretest\ifoutput\oldoutput\fi}
127   \outputpretest={\outputtrue}
128 \end{verbatim}
129 %
130 If a Floating Figure is requested,
131 the content of the
132 \verb+\outputpretest+ token register is prepared to decide:
133 \begin{enumerate}
134 \item if there is enough vertical space to set the Floating Figure,
135 \item if setting of a Floating Figure is in progress or
136 \item if indeed the current page has to be sent to the DVI file.
137 \end{enumerate}
138 %
139 In general, \TeX{} has to deal with more than one paragraph until
140 a Floating Figure will be completely processed.
141 During this process
142 the redefined \verb+\output+ routine is
143 called at the begin of {\bf every} paragraph;
144 this is done indirectly
145 by expanding the control sequence \verb+\tryfig+.
146 Therefore, the \verb+\everypar+ token
147 list is prepared by the following command sequence:
148 \begin{verbatim}
149   \edef\oldeverypar{\the\everypar}
150   \everypar={\tryfig\oldeverypar}
151 \end{verbatim}
152 Now \verb+\tryfig+ triggers the (modified)
153 \verb+\output+ routine, which then does the decisions
154 and actions mentioned above.
155
156 Adopting this concept when using the macros in the \LaTeX{} context,
157 we are faced with the following problems:
158 \begin{enumerate}
159 \item At the time \hbox{\tt FLOATFIG.STY} is read in,
160       the \verb+\output+ routine is still undefined;
161       its definition is retarded until
162       \verb+\begin{document}+ will be expanded;
163       so the redefinition of the \verb+\output+ routine has to be
164       done after \verb+\begin{document}+
165       by the command \verb+\initfloatingfigs+
166       (see section `Known Problems' below).
167 \item There are situations where
168       \LaTeX{} decides to redefine the \verb+\everypar+ token list
169       without saving of the former content;
170       this occurs for instance when expanding
171       a \verb+\section+ control sequence.
172       We overcome this by redefining \verb+\everypar+ whenever
173       the \verb+\floatingfigure+ environment is entered.
174 %
175       Hence to avoid problems, a Floating Figure should be requested
176       early enough before any sectioning control sequence
177       (see also subsection `Misleading collision warnings').\hfil\break
178 %
179       Furthermore, the concurrent definitions of
180       \verb+\everypar+ are the reason why
181       Floating Figures cannot move across section boundaries.
182 \end{enumerate}
183 %
184 \subsection{Alternating figure setting}
185 The problem to be solved
186 is to decide if a certain figure has to be set
187 left- or rightjustified.
188 This decision has to made according to
189 the value of the pagecount (left if even, right if odd).
190 That is we are dealing with the wellknown problem
191 to associate a certain part of input text with the number
192 of the page on which it will be set finally.
193
194 As pointed out by D.E. Knuth in `The {\TeX}book' this association
195 is done not before \verb+\output+ routine time.
196 But the problem is not so hard to solve,
197 since in Th.~Reid's version there is already a modified
198 \verb+\output+ routine which decides if a certain figure will
199 fit on the current page.
200 As a by-product of this decision one easily gains
201 the information `odd' or `even' for the pagecount
202 of the current page.
203 So our problem reduces to the following simple decision:
204 \begin{verbatim}
205   \ifodd\count0 %
206      \hbox to \hsize{\hss\copy\figbox}%
207      \global\oddpagestrue
208    \else% leftsetting
209      \hbox to \hsize{\copy\figbox\hss}%
210      \global\oddpagesfalse
211    \fi% \ifodd\count0
212 \end{verbatim}
213 %
214 \subsection{Collisions of Floating Figures}
215 We define a collision as a situation where:
216 \begin{enumerate}
217 \item a Floating Figure is requested before the predecessor
218       has been finished,
219 \item some sectioning is requested before a Floating Figure has been
220       finished.
221 \end{enumerate}
222
223 While the {\tt FLOATFIG} style option cannot avoid such collisions,
224 it will recognize them.
225 For diagnostic purposes we have therefore defined
226 the switch \verb+\iffigprocessing+ and another count register called
227 \verb+\ffigcount+.
228 This count register is used to attach
229 a sequence number to each Floating Figure,
230 so they can be identified uniquely within collision warning messages.
231 These sequence numbers are not to be confused
232 with the figure count maintained by standard \LaTeX.
233 %
234 \section{Known Problems}
235 \subsection{Need of Initialization}
236 The present version of the style option needs to be initialized
237 by control sequence
238 {\tt\verb+\initfloatingfigs+} as mentioned above.\footnote{%
239 This is not needed with \LaTeXe{}. /MD}
240
241 We hope a later version will initialize itself,
242 when the first request to a Floating Figure is encountered.
243 One problem with such an automatic initialization seems
244 to be,
245 that we are grouped down
246 since we are inside a \LaTeX{} environment.
247 Our first attempt failed
248 to make the respective settings \verb+\global+.
249 %
250 \subsection{Misleading collision warnings}
251 As mentioned above, Floating Figures do not move
252 across section boundaries.
253 If a Floating Figure is requested near a section end,
254 the figure will be truncated,
255 if it does not fit in the current section.
256
257 If this occurs for instance with floating figure number~4,
258 a collision will be reported when the request for
259 floating figure number~5 is encountered;
260 so the respective warning message may be substantially retarded.
261 In fact, the message will tell us that there is a problem with figure~4,
262 but there will be no further hint.
263 So one has to analyze `by hand' that the problem is {\bf not} caused
264 by collision with figure~5 but with a section heading;
265 even worse: if there is no floating figure~5, one gets no warning message
266 at all.
267
268 Furthermore, warning messages will be generated if a Floating Figure
269 ends in paragraph $n$ and the next one begins with paragraph $n+1$.
270 These warning messages are to be ignored; they are due to some retardation
271 caused by the \verb+\everypar+ mechanism.
272 %
273 \section{Conclusions}
274 Working on \texttt{FLOATFIG.STY} we had some unexpected problems
275 which were caused
276 by \LaTeX's somewhat unsafe assignments to the \verb+\everypar+ token list.
277 This is due to the fact that the use
278 of this token list is fundamental
279 to the algorithm designed by Th.~Reid.
280 On the other hand we did expect problems to couple
281 the Floating Figures with \LaTeX's figure caption adminstration,
282 that is to achieve a single figure caption numbering for
283 the standard figures and the Floating Figures and to get both types
284 listed by the \verb+\listoffigures+ control sequence.
285 %
286 But these problems could easily be solved
287 by the following local definiton within the {\tt FLOATFIG} environment:
288 \begin{verbatim}
289   \def\@captype{figure}
290 \end{verbatim}
291 Obviously this is due to the fact
292 that \LaTeX's caption apparatus is thoroughly parameterized.
293
294 The \verb+FLOATFIG.STY+ file is stored in the
295 {\tt EARN/BITNET} listserver
296 in Heidelberg; \hfil\break
297 {\tt VM/CMS} users should enter the commands:
298 \begin{verbatim}
299   TELL LISTSERV AT DHDURZ1 GET LATEXSTY INDEX
300   TELL LISTSERV AT DHDURZ1 GET LATEXSTY README
301   TELL LISTSERV AT DHDURZ1 GET LATEXSTY FILELIST
302   TELL LISTSERV AT DHDURZ1 GET FLOATFIG ZOOUUE LATEXSTY
303 \end{verbatim}
304 to obtain information about how to obtain the style option file.
305\subsection{Note by Mats Dahlgren}
306Several features described in this document still apply to the
307\LaTeXe\ \texttt{floatflt} package, whereas others do not.  Please
308run \LaTeX{} on \texttt{floatflt.dtx} twice and read the resulting
309documentation before you use the package.
310(This note was added on October 20, 1994; changed on December 27,
3111994.)
312
313 %\tableofcontents
314 \end{document}
315\endinput
316%%
317%% End of file `floatfge.tex'.
Note: See TracBrowser for help on using the repository browser.