Debian Codegraph @

texmf-dist/source/latex/floatflt/floatflt.dtx

raw
1 %
2 % \iffalse
3 %
4 % The first part is a comment to the reader(s) of `floatflt.dtx'.
5 %
6 % floatflt.dtx Version 1.31.a, June 5, 1998
7 % 1.31.b 20 December 2011
8 % (c) 1994-1998 by Mats Dahlgren (see README file for contact address)
9 %
10 % Run LaTeX on the file `floatflt.ins' to get a .sty-file and an
11 % example. For instructions, please run LaTeX on the file
12 % `floatflt.dtx' twice.
13 %
14 % This work may be distributed and/or modified under the
15 % conditions of the LaTeX Project Public License, either version 1.3
16 % of this license or (at your option) any later version.
17 % The latest version of this license is in
18 % http://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of LaTeX
20 % version 2005/12/01 or later.
21 %
22 % This work has the LPPL maintenance status `maintained'.
23 %
24 % The Current Maintainer of this work is Mats Dahlgren.
25 %
26 % This work consists of the files floatflt.dtx, floatflt.ins and
27 % README, and the derived files floatflt.sty and floatflt.pdf
28 %
29 %<*driver>
30 \documentclass[a4paper]{ltxdoc}
31 \textwidth=150mm
32 \textheight=210mm
33 \topmargin=0mm
34 \oddsidemargin=5mm
35 \evensidemargin=5mm
36 \DocInput{floatflt.dtx}
37 % \PrintChanges
38 %\end{document}
39 %</driver>
40 % \fi
41 %
42 % \CheckSum{787}
43 %
44 % \def\filename{floatflt.dtx}
45 % \def\fileversion{1.31}
46 % \def\filedate{1997/07/16}
47 % \def\docdate{1998/06/05}
48 % \date{\docdate}
49 % \title{Welcome to the \textsf{floatflt} package!\thanks{%
50 % This document describes \textsf{floatflt} v.\fileversion{} and
51 % was last updated \docdate.}}
52 % \author{Mats Dahlgren\footnote{Email:\ \texttt{[email protected]}\ \ \
53 % Web:\ \texttt{http://www.homenet.se/matsd/}}}
54 % \begin{document}
55 % \maketitle
56 %
57 % \begin{abstract}
58 % The \textsf{floatflt} package is an extension
59 % of Thomas Kneser's style option \texttt{floatfig.sty}
60 % for \LaTeX{} 2.09. The extension was done by Mats
61 % Dahlgren (\texttt{[email protected]} http://www.homenet.se/matsd/).
62 %
63 % This file and the package:
64 % Copyright \copyright{} 1994-1998 by Mats Dahlgren; the whole may
65 % be distributed under the terms of the LaTeX Project Public Licence,
66 % Version 1.3c.
67 % ^^A above details changed 2012-02-29, at mats' request
68 %
69 % All rights reserved.
70 % \end{abstract}
71 %
72 % \section{Introduction}
73 % The \textsf{floatflt} package defines two environments:
74 % \texttt{floatingfigure} and \texttt{floatingtable}. In
75 % principle the two environments work the same way and do
76 % the same job, but there are some important differences,
77 % which are explained below. The general idea is that a
78 % figure or table which is not very wide should be allowed
79 % to have regular text typsetted beside itself. In Thomas
80 % Kneser's file \texttt{floatfig.sty} and in the
81 % documentation thereof, such figures are called
82 % \textit{floating figures}. In the \textsf{floatflt}
83 % package, the term \textit{floating} is generally used
84 % for such figures and tables, despite the slight
85 % different use of the term \textit{float} in \LaTeX{}.
86 % Hence the term \textit{floating floats} for such figures
87 % and tables.
88 %
89 % This userguide is also available in \texttt{.pdf}-format
90 % on the internet. It is found from my \LaTeX\ web page:
91 % \texttt{http://www.homenet.se/matsd/latex/}
92 %
93 % \subsection{For \texttt{floatfig.sty} users}
94 %
95 % There are five major differences in the use of
96 % \textsf{floatflt} as compared to \texttt{floatfig}:
97 % \begin{itemize}
98 % \item The extension to the \texttt{floattable} environment.
99 % \item There is no longer any need for initialization,
100 % thanks to the \verb+\AtBeginDocument+ command.
101 % \item Optional arguments for the environments which
102 % allows the user to place the floating floats left,
103 % right or according to the page number (as with
104 % \texttt{floatfig.sty}); this is mainly due to the
105 % possibility to have optional arguments in newly defined
106 % environments.
107 % \item Optional argument for the package as a whole if
108 % the user wants to force all floating floats to be to
109 % the right or left. The placement option at
110 % \verb+\begin{floatingfigure}+ (and
111 % \verb+\begin{floatingtable}+) overrides this (and there
112 % is also the optional placement option to re-introduce
113 % the page-number dependent placement for one figure or
114 % table).
115 % \item Compatibility with the \textsf{multicol}
116 % package is now obtained.
117 % \end{itemize}
118 %
119 % \section{Userguide}
120 % In the following, the usage of the package is explained
121 % in some detail. Users who are unfamiliar with the
122 % |floatfig.sty| package by Thomas Kneser may also find it
123 % useful to run \LaTeX{} on the file |floatfge.tex|.
124 %
125 % \subsection{How to call the package}
126 %
127 % The \textsf{floatflt} package is activated by the
128 % following line in your \LaTeX\ input file following your
129 % \verb+\documentclass+ command:\\ \hspace*{5mm}
130 % \verb+\usepackage[+\textit{option}\verb+]{floatflt}+\\
131 % The \textit{option} may be either one of the following:
132 % \texttt{rflt}, \texttt{lflt}, or \texttt{vflt}.
133 %
134 % \subsubsection{The package options}
135 %
136 % The three package options have the following functions:
137 % \begin{itemize}
138 % \item[\texttt{rflt}] Forces the default for the
139 % floating figures and tables to be typset to the right in
140 % a paragraph.
141 % \item[\texttt{lflt}] Forces the default for the
142 % floating figures and tables to be typset to the left in
143 % a paragraph.
144 % \item[\texttt{vflt}] Forces the floating figures and
145 % tables to be typset to the right in a paragraph on
146 % odd-nubered pages, and to the left on even-numbered
147 % pages; this is also the default.
148 % \end{itemize}
149 % The option \texttt{vflt} is actually not needed and does
150 % nothing but tells \LaTeX\ to use the default, it is also
151 % the internal default. It is supported for symmetry
152 % reasons with the optional arguments for the environments
153 % temselves.
154 %
155 % \subsection{How to use the \texttt{floatingfigure} environment}
156 %
157 % In your \LaTeX\ document you invoke the
158 % \texttt{floatingfigure} environment by typing:\\
159 % \hspace*{5mm}
160 % \verb+\begin{floatingfigure}[+\textit{option}\verb+]{+\textit{width}\verb+}+\\
161 % \hspace*{5mm} \textit{figure commands with or without} \verb+\caption+\\
162 % \hspace*{5mm} \verb+\end{floatingfigure}+\\
163 % The \textit{option} may be either one of the following:
164 % \texttt{r}, \texttt{l}, \texttt{p}, or \texttt{v}. The
165 % quantity \textit{width} is the width you want your
166 % floating figure to have (such as ``\texttt{75mm}'').
167 %
168 % \subsubsection{The \texttt{floatingfigure} options}
169 %
170 % The options to the \texttt{floatingfigure} environment
171 % all overrule any present package option which may be in
172 % effect. The options have the following functions:
173 % \begin{itemize}
174 % \item[\texttt{r}] Forces the current floating figure to
175 % be typset to the right in a paragraph.
176 % \item[\texttt{l}] Forces the current floating figure to
177 % be typset to the left in a paragraph.
178 % \item[\texttt{p}] Forces the current floating figure to
179 % be typset to the right in a paragraph if the pagenumber
180 % is odd, and to the left if even.
181 % \item[\texttt{v}] Applies the package option to the
182 % current figure, and if no package option is specified,
183 % it forces the current floating figure to
184 % be typset to the right in a paragraph if the pagenumber
185 % is odd, and to the left if even.
186 % \end{itemize}
187 % The \texttt{p} option is used when the default
188 % alternating right/left typesetting of floating figures
189 % is desired despite the use of the \texttt{rflt} or
190 % \texttt{lflt} package option. The \texttt{v} option is
191 % the internal default, and does not have any effect other
192 % than applying either the default or the option specified
193 % for the whole package.
194 %
195 % \subsection{How to use the \texttt{floatingtable} environment}
196 %
197 % In your \LaTeX\ document you invoke the \texttt{floatingtable}
198 % environment by typing:\\
199 % \hspace*{5mm} \verb+\begin{floatingtable}[+\textit{option}\verb+]{+\\
200 % \hspace*{5mm} \verb+\begin{tabular}{+\textit{tabular
201 % specifiers}\verb+}+\\
202 % \hspace*{5mm} \textit{here you put your table entries}\\
203 % \hspace*{5mm} \verb+\end{tabular}}+\\
204 % \hspace*{5mm} \verb+\caption+ \textit{if desired}\\
205 % \hspace*{5mm} \verb+\end{floatingtable}+\\
206 % The \textit{option} may be either one of the following:
207 % \texttt{r}, \texttt{l}, \texttt{p}, or \texttt{v}. No
208 % specification of the width is explicitly made, instead
209 % \textit{the whole} \texttt{tabular} \textit{environment
210 % is a mandatory argument}. Thus, it is important to
211 % always have the ``\verb+{+'' before
212 % \verb+\begin{tabular}+ and the ``extra'' ``\verb+}+''
213 % after \verb+\end{tabular}+. At the present, the
214 % \texttt{tabbing} environment can not be used in the
215 % \texttt{floatingtable} environment. (Other commands and
216 % environments such as the \verb+\parbox+ command may be
217 % used instead of the \texttt{tabular} environment within
218 % a \texttt{floatingtable} environment.)
219 %
220 % \subsubsection{The \texttt{floatingtable} options}
221 %
222 % The options for the \texttt{floatingtable} environment
223 % are exactly the same as for the \texttt{floatingfigure}
224 % environment, and they also have the same effects.
225 %
226 % \subsection{Compatibility}
227 %
228 % The present version of \textsf{floatflt} (v.\fileversion)
229 % has been tested
230 % with \LaTeXe{} of 1997/06/01 using MiK\TeX\ 1.07 running
231 % \TeX\ 3.14159 under Win95, using the
232 % \textsf{article} document class. Only changes to the
233 % the documentation has been made since the previous verision.
234 %
235 % The
236 % regular \verb+\caption+ command of both the
237 % \verb+figure+ and \verb+tabular+ environments work fine.
238 % The \verb+\hangcaption+ command of David M.~Jones
239 % (\texttt{[email protected]}) does not work with
240 % \textsf{floatflt}. The use of \verb+\hangcaption+ gives
241 % the same result as \verb+\caption+. The listing
242 % commands \verb+\listoffigures+ and \verb+\listoftables+
243 % also work properly. However, since floating figures and
244 % tables normally are typsetted in a paragraph, the order
245 % in the lists may be strange if also regular
246 % \texttt{figure} and \texttt{table} environments are used
247 % close to the floating ones.
248 %
249 % Unlike \texttt{floatfig.sty}, \textsf{floatflt} works
250 % with the \textsf{multicol} package, provided the
251 % floating floats are still less wide than the columns.
252 % If not, or if the floating floats and the columns have
253 % almost the same width, text may drift away and overlap
254 % text in adjacent column(s). However, this combination
255 % has several restrictions, and the placement of the
256 % floating floats may not always be the correct according
257 % to the page numbering. Normally it also leads to many
258 % ''\verb+Underfull \hbox+'' warnings. The use of this
259 % combination is discouraged.
260 %
261 % \subsection{Warnings and messages}
262 %
263 % In Thomas Kneser's original work \texttt{floatfig.sty},
264 % there are several warnings issued when problems occur.
265 % These are kept in \textsf{floatflt}. Warnings will be
266 % issued if two floating figures, two floating tables,
267 % or if one floating table is colliding with one floating
268 % figure. Also, message(s)
269 % will be displayed if a floating float is moved from its
270 % original paragraph. Finally, each processed floating
271 % float will produce a message telling which page it has
272 % been typsetted on.
273 %
274 % \section{Known problems and limitations}
275 %
276 % The following problems and limitations are known:
277 % \begin{itemize}
278 % \item If a floating figure or table is called close to a
279 % sectioning command, the floating float may be lost or
280 % truncated. This may lead to a ``collision warning'',
281 % which normally has to be analyzed ``by hand''.
282 % \item If two consecutive paragraphs both contain a
283 % floating float, a ``collision warning'' is issued. This
284 % warning may be ignored. \item A \texttt{floatingtable}
285 % environment sometimes leads to a warning like:\\
286 % \hspace*{5mm}
287 % \verb+Overfull \hbox (10.78334pt too wide) in paragraph at lines 287--289+\\
288 % where the line numbers refered to are those of the
289 % \verb+\end{tabular}+ statement. This could not be
290 % avoided in all cases.
291 % \item If you use floating floats of different kinds
292 % close to each other in your input, you are likely to
293 % have problems. You may either lose one of the floating
294 % floats entirely, have it overwritten by the other, or
295 % have it truncated.
296 % \item \LaTeX\ has problem in linebreaking short lines.
297 % This may give you bad linebreaks in the captions of
298 % floating floats.
299 % \item There are some problems when a floating float and a
300 % footnote appear on the same page, especially when the floating
301 % float is moved to another page. Unfortunately, this may
302 % need some adjustments by hand. (Reported by Jakob
303 % Schiotz (\texttt{[email protected]}).)
304 % \item If a floating float is placed close to a list environment
305 % (such as \texttt{enumerate} or \texttt{itemize}), the text of the
306 % list environment is likely to overwrite the floating float. See
307 % section~\ref{LPSoln} below for a semi-automatic solution of this
308 % problem. (The bug was reported by Rafael Gallego
309 % (\texttt{[email protected]}).)
310 % \end{itemize}
311 % The first two of these were pointed out by Thomas Kneser
312 % in the original documentation of \texttt{floatfig.sty}.
313 %
314 % \subsection{How to Avoid the List Problem}\label{LPSoln}
315 %
316 % There is a semi-automatic way to avoid the ``List Problem''
317 % mentioned above. The solution was introduced in version 1.2. For
318 % items in a list which are colliding with a floating float, there is
319 % a special command \verb+\fltitem+ avaliable, which takes one mandatory
320 % argument. This command is to be used in place of the ordinary
321 % \verb+\item+, and should have the text of the item as the argument.
322 % \textit{E.~g.}\ you would write\\ \hspace*{10mm}
323 % \verb+\fltitem{+\textit{text}\verb+}+ \\ instead of \\
324 % \hspace*{10mm} \verb+\item +\textit{text} \\ to avoid the text of
325 % the \verb+\item+ command to be written in the floating float.
326 % \verb+\fltitem+ also takes a second, optional, argument, which is an
327 % extra vertical space put in after the text of the |\fltitem|
328 % command. This is meant to be used specially when there are two
329 % paragraphs in the same item text, and the latter is to use the full
330 % line width (\textit{i.~e.}\ when the item text ends below the
331 % floating float). So, the full syntax of the |\fltitem| command is:\\
332 % \hspace*{10mm}|\fltitem[|\textit{len}|]{|\textit{text}|}|\\
333 % which inserts the extra vertical space \textit{len} after the item
334 % text. If there is a second text which is to span the full
335 % linewidth in the same item, one would write:\\
336 % \hspace*{10mm}|\fltitem[|\textit{len}|]{|\textit{text1}|} |\textit{text2}\\
337 % which first typesets \textit{text1} narrowed according to the
338 % floating float, followed by \textit{text2} with full linewidth, and
339 % an extra vertical space \textit{len} between these two texts.
340 %
341 % There is also a second, analogous command
342 % |\fltditem| which takes two mandatory and one optional argument.
343 % The optional argument is the same as the optional argument of
344 % |\fltitem|, the first mandatory argument is the item label,
345 % \textit{e.~g.}\ the item to be described in a |description|
346 % environment. The second mandatory argument of |\fltditem| is the
347 % item text. The syntax of the |\fltditem| command is:\\
348 % \hspace*{10mm}|\fltditem[|\textit{len}|]{|\textit{label}|}{|\textit{text}|}|\\
349 % which produces an item with label \textit{label} and text
350 % \textit{text} and extra vertical space \textit{len} after the item
351 % text. Additional text spanning the full linewidth may follow,
352 % just like with |\fltitem|, but the indentation may turn out to be
353 % strange.
354 %
355 % Both |\fltitem| and |\fltditem| can be used in an ordinary
356 % |itemize|, |enumerate|, or |description| environment (however, the
357 % use of |\fltditem| in |enumerate| may produce strange results). For
358 % |\fltitem| and |\fltditem| to work properly, the (otherwise)
359 % colliding floating float must be set flush right, that is have the
360 % option |r| specified. The use of |\fltitem| or |\fltditem| is not
361 % demonstrated in the |floatexm.tex| file.
362 %
363 % \subsection{Sending a bug report}
364 %
365 % Reports of new bugs in the package are most welcome.
366 % However, I do not consider this to be a ``supported''
367 % package. This means that there is no guarantee I (or
368 % anyone else) will put any effort into fixing the bug.
369 % But, on the other hand, someone may try debugging, so filing a
370 % bug report is always a good thing to do! (If nothing else,
371 % your discoveries may end up in future releases of this
372 % document.) Before filing a bug report, please take the
373 % following actions:
374 % \begin{enumerate}
375 % \item Ensure your problem is not due to your inputfile;
376 % \item Ensure your problem is not due to your own
377 % package(s) or class(es);
378 % \item Ensure your problem is not covered in the section ``Known
379 % problems and limitations'' above;
380 % \item Try to locate the problem by writing a minimal \LaTeXe\
381 % input file which reproduces the problem. Include the command\\
382 % \verb+ \setcounter{errorcontextlines}{999}+\\ in your input;
383 % \item Run your file through \LaTeXe;
384 % \item Send a description of your problem, the input file and the
385 % log file via e-mail to:\\ \texttt{[email protected]}.
386 % \end{enumerate}
387 %
388 % \section{Conclusion}
389 %
390 % Without Thomas Kneser's \texttt{floatfig.sty} as a base,
391 % I could never have written the \textsf{floatflt}
392 % package. I hope that some users will find the package
393 % useful and not too bugful. :--) Comments and suggestions
394 % for improvements are always most welcome!\\*[3mm]
395 % {\itshape Enjoy your \LaTeX!\raisebox{-\baselineskip}[0pt][0pt]{mats d.}}
396 %
397 % \StopEventually{\par\vfill\hfill{\scriptsize Copyright
398 % \copyright{} 1994-1998 by Mats Dahlgren.}}
399 % \section{Package code}
400 %
401 % This section prints the package code but without comments.
402 % \iffalse
403 %
404 %<*paketkod>
405 % \fi
406 % \begin{macrocode}
407 \NeedsTeXFormat{LaTeX2e}[1996/12/01]
408 \ProvidesPackage{floatflt}[1997/07/16 v. 1.31]
409 \newcounter{OptionTest}
410 \setcounter{OptionTest}{0}
411 \DeclareOption{rflt}{\setcounter{OptionTest}{1}}
412 \DeclareOption{lflt}{\setcounter{OptionTest}{2}}
413 \DeclareOption{vflt}{\setcounter{OptionTest}{0}}
414 \DeclareOption*{\OptionNotUsed}
415 \ProcessOptions
416 \newbox\figbox
417 \newbox\tabbox
418 \newbox\pagebox
419 \newcount\ffigcount
420 \newcount\ftabcount
421 \newcount\fftest
422 \newcount\hangcount
423 \newcount\nosuccesstryfig
424 \newcount\nosuccesstrytab
425 \newdimen\figgutter \figgutter=1truepc
426 \newdimen\tabgutter \tabgutter=1truepc
427 \newdimen\htdone \htdone=0pt
428 \newdimen\pageht
429 \newdimen\startpageht
430 \newdimen\tabbredd
431 \newdimen\floatfltwidth
432 \newdimen\fltitemwidth
433 \newif\iftryingfig \tryingfigfalse
434 \newif\iftryingtab \tryingtabfalse
435 \newif\ifdoingfig \doingfigfalse
436 \newif\ifdoingtab \doingtabfalse
437 \newif\iffigprocessing \figprocessingfalse
438 \newif\iftabprocessing \tabprocessingfalse
439 \newif\ifpageafterfig \pageafterfigfalse
440 \newif\ifpageaftertab \pageaftertabfalse
441 \newif\ifoddpages
442 \newif\ifoutput
443 \newtoks\outputpretest
444 \newenvironment{floatingfigure}[2][v]%
445 {\@tfor \@tempa :=#1\do
446 {\if\@tempa r\global\oddpagestrue\fi
447 \if\@tempa l\global\oddpagesfalse\fi
448 \if\@tempa p%
449 \ifodd\c@page\global\oddpagestrue
450 \else\global\oddpagesfalse\fi
451 \fi
452 \if\@tempa v%
453 \ifnum\theOptionTest=0
454 \ifodd\c@page\global\oddpagestrue
455 \else\global\oddpagesfalse\fi
456 \else
457 \ifodd\theOptionTest\global\oddpagestrue
458 \else\global\oddpagesfalse\fi
459 \fi
460 \fi
461 }
462 \expandafter\ifx\csname oldoutput\endcsname\relax% ref. TeXbook Ex.7.7
463 \PackageError{floatflt}{The `floatflt' package is not initialized}
464 {Try to reinstall the `floatflt' package.\MessageBreak
465 Type `x' to quit or <Return> to try to go on.}\@@end\fi
466 \global\everypar={\tryfig\oldeverypar}% must be set globally!
467 \global\advance\ffigcount by 1
468 \iffigprocessing
469 {\count0=\ffigcount\advance\count0 by -1
470 \PackageWarningNoLine{floatflt}{Floating figures \the\count0\space%
471 \space and \the\ffigcount\space colliding}%
472 }%
473 \fi
474 \iftabprocessing \PackageWarningNoLine{floatflt}{Floating figure %
475 \the\ffigcount\space and floating table \the\ftabcount\space colliding}
476 \fi
477 \def\@captype{figure}
478 \global\setlength{\floatfltwidth}{#2}
479 \global\figprocessingtrue
480 \global\setbox\figbox=\vbox\bgroup% begin of figbox
481 \hrule height 0pt width #2 depth 0pt%
482 \hsize=#2%
483 }
484 {
485 \egroup
486 \figinsert\par%
487 }
488 \newenvironment{floatingtable}[2][v]%
489 {\@tfor \@tempa :=#1\do
490 {\if\@tempa r\global\oddpagestrue\fi
491 \if\@tempa l\global\oddpagesfalse\fi
492 \if\@tempa p%
493 \ifodd\c@page\global\oddpagestrue
494 \else\global\oddpagesfalse\fi
495 \fi
496 \if\@tempa v%
497 \ifnum \theOptionTest=0
498 \ifodd\c@page\global\oddpagestrue
499 \else\global\oddpagesfalse\fi
500 \else
501 \ifodd\theOptionTest\global\oddpagestrue
502 \else\global\oddpagesfalse\fi
503 \fi
504 \fi
505 }
506 \expandafter\ifx\csname oldoutput\endcsname\relax% ref. TeXbook Ex.7.7
507 \PackageError{floatflt}{The `floatflt' package is not initialized}
508 {Try to reinstall the `floatflt' package.\MessageBreak
509 Type `x' to quit or <Return> to try to go on.}\@@end\fi
510 \global\setbox\tabbox=\vbox\bgroup\hrule height 0pt width 0pt depth 0pt%
511 \hsize=0pt\egroup
512 \global\everypar={\trytab\oldeverypar}
513 \global\advance\ftabcount by 1
514 \iftabprocessing
515 {\count0=\ftabcount\advance\count0 by -1
516 \PackageWarningNoLine{floatflt}{Floating tables \the\count0\space%
517 \space and \the\ftabcount \space colliding}%
518 }
519 \fi
520 \iftabprocessing \PackageWarningNoLine{floatflt}{Floating table %
521 \the\ffigcount\space and floating figure \the\ftabcount\space colliding}
522 \fi
523 \settowidth{\tabbredd}{#2}
524 \global\setlength{\floatfltwidth}{\tabbredd}
525 \def\@captype{table}
526 \global\tabprocessingtrue
527 \global\setbox\tabbox=\vbox\bgroup% begin of tabbox
528 \hrule height 0pt width\tabbredd depth 0pt%
529 \hsize=\tabbredd
530 \noindent\ifnum\ftabcount >1\ifoddpages\else\hspace*{-12pt}\fi\fi%
531 #2\vspace{0.2\baselineskip}%
532 }
533 {
534 \egroup% end of \tabbox
535 \tabinsert\par%
536 }
537 \AtBeginDocument{%
538 \edef\oldoutput{\the\output}%
539 \output={\the\outputpretest%
540 \ifoutput\oldoutput\fi}
541 \outputpretest={\outputtrue}
542 \edef\oldeverypar{\the\everypar}
543 }
544 \def\dofigtest{%
545 \ifnum\outputpenalty=-10005
546 \setbox\pagebox=\vbox{\unvbox255}%
547 \global\pageht=\ht\pagebox
548 \global\outputfalse
549 \unvbox\pagebox
550 \else
551 \global\outputtrue
552 \ifdoingfig
553 \global\pageafterfigtrue
554 \fi
555 \fi}%
556 \def\dotabtest{%
557 \ifnum\outputpenalty=-10005
558 \setbox\pagebox=\vbox{\unvbox255}%
559 \global\pageht=\ht\pagebox
560 \global\outputfalse
561 \unvbox\pagebox
562 \else
563 \global\outputtrue
564 \ifdoingtab
565 \global\pageaftertabtrue
566 \fi
567 \fi}%
568 \def\tryfig{%
569 \iftryingfig
570 {\everypar={\relax}\setbox0=\lastbox%
571 \parindent=\wd0 \parskip=0pt \par%
572 \penalty-10005 \leavevmode}%
573 \dimen0=\vsize%
574 \advance\dimen0 by -\pageht%
575 \advance\dimen0 by -2\baselineskip%
576 \ifdim\dimen0>\ht\figbox%
577 \dimen0=0.3\baselineskip
578 \vrule depth \dimen0 width 0pt
579 \vadjust{\kern -\dimen0%
580 \vtop to \dimen0{%
581 \baselineskip=\dimen0%
582 \vss \vbox to 1ex{%
583 \ifoddpages%
584 \hbox to \hsize{\hss\copy\figbox}%
585 \else% leftsetting
586 \hbox to \hsize{\copy\figbox\hss}%
587 \fi% \ifodd\count0
588 \vss}\null}}%
589 \global\tryingfigfalse%
590 \global\doingfigtrue
591 \global\startpageht=\pageht
592 \global\htdone=0pt
593 \dohangf
594 \ifnum\nosuccesstryfig>0%
595 \typeout{floatflt Message: Flt. fig. \the\ffigcount\space set on page
596 \the\count0, shifted \the\nosuccesstryfig\space par(s) forward.}%
597 \else
598 \typeout{Package floatflt Message: Floating figure \the\ffigcount
599 \space set on page \the\count0}%
600 \fi
601 \else
602 \global\advance\nosuccesstryfig by 1
603 \fi
604 \else%
605 \ifdoingfig
606 {\everypar={\relax}\setbox0=\lastbox
607 \parindent=\wd0 \parskip=0pt \par
608 \penalty-10005 \leavevmode}%
609 \global\htdone=\pageht
610 \global\advance\htdone by -\startpageht
611 \ifpageafterfig
612 \global\doingfigfalse
613 \else
614 \dimen0=\ht\figbox%
615 \advance\dimen0 by 0.5\baselineskip%
616 \ifdim\htdone<\dimen0%
617 \dohangf
618 \else
619 \global\doingfigfalse
620 \fi
621 \fi
622 \ifdoingfig\relax\else\global\figprocessingfalse\fi
623 \else
624 \global\outputpretest={\outputtrue}%
625 \fi
626 \fi
627 }
628 \def\trytab{%
629 \iftryingtab%
630 {\everypar={\relax}\setbox0=\lastbox%
631 \parindent=\wd0 \parskip=0pt \par%
632 \penalty-10005 \leavevmode}%
633 \dimen0=\vsize%
634 \advance\dimen0 by -\pageht%
635 \advance\dimen0 by -2\baselineskip%
636 \ifdim\dimen0>\ht\tabbox%
637 \dimen0=0.3\baselineskip
638 \vrule depth \dimen0 width 0pt
639 \vadjust{\kern -\dimen0%
640 \vtop to \dimen0{%
641 \baselineskip=\dimen0%
642 \vss \vbox to 1ex{%
643 \ifoddpages%
644 \hbox to \hsize{\hss\copy\tabbox}%
645 \else% leftsetting
646 \hbox to \hsize{\copy\tabbox\hss}%
647 \fi% \ifodd\count0
648 \vss}\null}}%
649 \global\tryingtabfalse%
650 \global\doingtabtrue
651 \global\startpageht=\pageht
652 \global\htdone=0pt
653 \dohangt
654 \ifnum\nosuccesstrytab>0%
655 \typeout{floatflt Message: Flt. tab. \the\ftabcount\space set on page
656 \the\count0, shifted \the\nosuccesstrytab\space par(s) forward.}%
657 \else
658 \typeout{Package floatflt Message: Floating table \the\ftabcount\space
659 set on page \the\count0}%
660 \fi
661 \else
662 \global\advance\nosuccesstrytab by 1
663 \fi
664 \else
665 \ifdoingtab
666 {\everypar={\relax}\setbox0=\lastbox
667 \parindent=\wd0 \parskip=0pt \par
668 \penalty-10005 \leavevmode}%
669 \global\htdone=\pageht
670 \global\advance\htdone by -\startpageht
671 \ifpageaftertab
672 \global\doingtabfalse
673 \else
674 \dimen0=\ht\tabbox%
675 \advance\dimen0 by 0.5\baselineskip%
676 \ifdim\htdone<\dimen0%
677 \dohangt
678 \else
679 \global\doingtabfalse
680 \fi
681 \fi
682 \ifdoingtab\relax\else\global\tabprocessingfalse\fi
683 \else
684 \global\outputpretest={\outputtrue}%
685 \fi
686 \fi
687 }
688 \def\figinsert{%
689 \global\nosuccesstryfig=0%
690 \global\outputpretest={\dofigtest}%
691 \global\tryingfigtrue \global\doingfigfalse%
692 \global\pageafterfigfalse}%
693 \def\tabinsert{%
694 \global\nosuccesstrytab=0%
695 \global\outputpretest={\dotabtest}%
696 \global\tryingtabtrue \global\doingtabfalse%
697 \global\pageaftertabfalse}%
698 \def\dohangf{%
699 \dimen0=\ht\figbox%
700 \advance\dimen0 by -\htdone%
701 \advance\dimen0 by 1.49\baselineskip%
702 \hangcount=\dimen0%
703 \divide\hangcount by \baselineskip%
704 \dimen0=\wd\figbox%
705 \advance\dimen0 by \figgutter%
706 \ifoddpages%
707 \global\hangafter=-\hangcount% placing right
708 \global\hangindent=-\dimen0%
709 \else% \ifleftsetting
710 \global\hangafter=-\hangcount% placing left
711 \global\hangindent=\dimen0%
712 \fi
713 }
714 \def\dohangt{%
715 \dimen0=\ht\tabbox%
716 \advance\dimen0 by -\htdone%
717 \advance\dimen0 by 1.49\baselineskip%
718 \hangcount=\dimen0%
719 \divide\hangcount by \baselineskip%
720 \dimen0=\wd\tabbox%
721 \advance\dimen0 by \tabgutter%
722 \ifoddpages%
723 \global\hangafter=-\hangcount% placing right
724 \global\hangindent=-\dimen0%
725 \else% \ifleftsetting
726 \global\hangafter=-\hangcount% placing left
727 \global\hangindent=\dimen0%
728 \fi
729 }
730 \newcommand{\fltitem}[2][0pt]{\setlength{\fltitemwidth}{\linewidth}%
731 \addtolength{\fltitemwidth}{-\floatfltwidth}%
732 \addtolength{\fltitemwidth}{-0.5em}%
733 \item \parbox[t]{\fltitemwidth}{#2}\\[#1]}
734 \newcommand{\fltditem}[3][0pt]{\setlength{\fltitemwidth}{\linewidth}%
735 \addtolength{\fltitemwidth}{-\floatfltwidth}%
736 \addtolength{\fltitemwidth}{-0.5em}%
737 \item[#2] \parbox[t]{\fltitemwidth}{#3}\\[#1]}
738 % \end{macrocode}
739 % \Finale
740 % \iffalse
741 %</paketkod>
742 % \fi
743 % \end{document}
744 % \iffalse
745 %<*exempelkod>
746 \documentclass[11pt]{article}
747 \usepackage{floatflt}
748 \begin{document}
749 \centerline{\Huge The Tale of
750 \textsf{floatflt}}\bigskip
751
752 \noindent This is a demonstration document for the use
753 of the \textsf{floatflt} package. It contains several
754 floating figures and tables with captions explaining how
755 they were called. At the end, both a
756 \verb+\listoffigures+ and a \verb+\listoftables+ command
757 are used, resulting in the desired lists. For more
758 details on how to use the \textsf{floatflt} package,
759 please run \LaTeX{} on the file \texttt{floatflt.dtx}.
760
761 The following work by Edgar Alan Poe was retrieved by
762 anonymous ftp from \texttt{ftp.funet.fi} in the
763 directory \texttt{/pub/doc/literary/etext} where it is
764 found in the file \texttt{telltale.poe}. Only minor
765 \LaTeX\ adaptions have been done, besides the inclusion
766 of floating floats.
767
768 \begin{center}
769 Internet Wiretap Edition of\\[2mm]
770 {\large THE TELL-TALE HEART}\\
771 by\\ {\large EDGAR ALLAN POE}\\[2mm]
772 From \textit{The Works of Edgar Allan Poe: Tales Vol I}\\
773 J. B. Lippincott Co, Copyright 1895.\\[2mm]
774 This text is placed into the Public Domain (May 1993).\\
775 \end{center}
776
777 \noindent\textit{\Large The Tell-Tale Heart}
778
779 \noindent TRUE! nervous, very, very dreadfully nervous
780 I had been and am; but why WILL you say
781 that I am mad? The disease had sharpened
782 my senses, not destroyed, not dulled them. Above
783 all was the sense of hearing acute. I heard all things
784 in the heaven and in the earth. I heard many things
785 in hell. How then am I mad? Hearken! and observe how healthily, how
786 calmly, I can tell you the
787 whole story.
788
789 \begin{floatingfigure}{60mm}
790 \begin{center}
791 The first figure to\\ use the environment\\ \texttt{floatingfigure}
792 \end{center}
793 \caption{The \texttt{floatingfigure} environment with \texttt{60mm}
794 for \textit{width} and no \textit{option}.}
795 \end{floatingfigure}
796 It is impossible to say how first the idea entered
797 my brain, but, once conceived, it haunted me day
798 and\linebreak night. Object there was none. Passion there
799 was none. I loved the old man. He had never
800 wronged me. He had never given me insult. For
801 his gold I had no desire. I think it was his eye!
802 Yes, it was this! One of his eyes resembled that
803 of a vulture -- a pale blue eye with a film over it.
804 Whenever it fell upon me my blood ran cold, and
805 so by degrees, very gradually, I made up my mind
806 to take the life of the old man, and thus rid myself
807 of the eye for ever.
808
809 \begin{floatingfigure}[r]{40mm}
810 \begin{center}
811 Another figure to\\ use the environment\\ \texttt{floatingfigure}
812 \end{center}
813 \caption{The \texttt{floatingfigure} environment with \texttt{40mm}
814 for \textit{width} and the \texttt{r} \textit{option}.}
815 \end{floatingfigure}
816 Now this is the point. You fancy me mad. Madmen
817 know nothing. But you should have seen me.
818 You should have seen how wisely I proceeded --
819 with what caution -- with what foresight, with what
820 dissimulation, I went to work! I was never kinder
821 to the old man than during the whole week before
822 I killed him. And every night about midnight I
823 turned the latch of his door and opened it oh, so
824 gently! And then, when I had made an opening
825 sufficient for my head, I put in a dark lantern all
826 closed, closed so that no light shone out, and then
827 I thrust in my head. Oh, you would have laughed
828 to see how cunningly I thrust it in! I moved it
829 slowly, very, very slowly, so that I might not
830 disturb the old man's sleep. It took me an hour to
831 place my whole head within the opening so far that
832 I could see him as he lay upon his bed. Ha! would
833 a madman have been so wise as this? And then
834 when my head was well in the room I undid the
835 lantern cautiously -- oh, so cautiously -- cautiously
836 (for the hinges creaked), I undid it just so much
837 that a single thin ray fell upon the vulture eye.
838 And this I did for seven long nights, every night
839 just at midnight, but I found the eye always closed,
840 and so it was impossible to do the work, for it was
841 not the old man who vexed me but his Evil Eye.
842 And every morning, when the day broke, I went
843 boldly into the chamber and spoke courageously to
844 him, calling him by name in a hearty tone, and
845 inquiring how he had passed the night. So you see
846 he would have been a very profound old man, indeed,
847 to suspect that every night, just at twelve, I
848 looked in upon him while he slept.
849
850 \begin{floatingtable}{
851 \begin{tabular}{cccc}
852 $x$ & $x^2$ & $x^3$ & $x^4$ \\ \hline
853 1 & 1 & 1 & 1 \\
854 2 & 4 & 8 & 16 \\
855 3 & 9 & 27 & 81 \\
856 \end{tabular}}
857 \caption{The \texttt{floatingtable} environment with no \textit{option}.}
858 \end{floatingtable}
859 Upon the eighth night I was more than usually
860 cautious in opening the door. A watch's minute
861 hand moves more quickly than did mine. Never
862 before that night had I felt the extent of my own
863 powers, of my sagacity. I could scarcely contain
864 my feelings of triumph. To think that there I was
865 opening the door little by little, and he not even to
866 dream of my secret deeds or thoughts. I fairly
867 chuckled at the idea, and perhaps he heard me, for
868 he moved on the bed suddenly as if startled. Now
869 you may think that I drew back -- but no. His room
870 was as black as pitch with the thick darkness (for
871 the shutters were close fastened through fear of
872 robbers), and so I knew that he could not see the
873 opening of the door, and I kept pushing it on
874 steadily, steadily.
875
876 \begin{floatingtable}[l]{
877 \begin{tabular}{ccc}
878 $\alpha$ & $\sin\alpha$ & $\cos\alpha$ \\ \hline
879 0 & 0 & 1 \\
880 $\pi$ & 0 & $-1$ \\
881 $2\pi$ & 0 & 1 \\
882 \end{tabular}}
883 \caption{The \texttt{floatingtable} environment with the \texttt{l}
884 \textit{option}.}
885 \end{floatingtable}
886 I had my head in, and was about to open the
887 lantern, when my thumb slipped upon the tin fasten\-ing,
888 and the old man sprang up in the bed, crying
889 out, ''Who's there?''
890
891 I kept quite still and said nothing. For a whole
892 hour I did not move a muscle, and in the meantime
893 I did not hear him lie down. He was still sitting
894 up in the bed, listening; just as I have done night
895 after night hearkening to the death watches in the
896 wall.
897
898 \begin{floatingfigure}[l]{50mm}
899 \begin{center}
900 \Large A Figure!
901 \end{center}
902 \caption{The \texttt{floatingfigure} environment
903 with \textit{width} set to \texttt{50mm} and the
904 \texttt{l} \textit{option}.}
905 \end{floatingfigure}
906 Presently, I heard a slight groan, and I knew it
907 was the groan of mortal terror. It was not a groan of
908 pain or of grief -- oh, no! It was the low stifled sound
909 that arises from the bottom of the soul when
910 overcharged with awe. I knew the sound well. Many
911 a night, just at midnight, when all the world slept,
912 it has welled up from my own bosom, deepening,
913 with its dreadful echo, the terrors that distracted
914 me. I say I knew it well. I knew what the old
915 man felt, and pitied him although I chuckled at
916 heart. I knew that he had been lying awake ever
917 since the first slight noise when he had turned in
918 the bed. His fears had been ever since growing
919 upon him. He had been trying to fancy them
920 causeless, but could not. He had been saying to
921 himself, ''It is nothing but the wind in the chimney,
922 it is only a mouse crossing the floor,'' or, ''It is merely
923 a cricket which has made a single chirp.'' Yes he
924 has been trying to comfort himself with these
925 suppositions; but he had found all in vain. ALL IN VAIN,
926 because Death in approaching him had stalked with
927 his black shadow before him and enveloped the
928 victim. And it was the mournful influence of the
929 unperceived shadow that caused him to feel, although
930 he neither saw nor heard, to feel the presence
931 of my head within the room.
932
933 When I had waited a long time very patiently
934 without hearing him lie down, I resolved to open
935 a little -- a very, very little crevice in the lantern.
936 So I opened it -- you cannot imagine how stealthily,
937 stealthily -- until at length a single dim ray like the
938 thread of the spider shot out from the crevice and
939 fell upon the vulture eye.
940
941 It was open, wide, wide open, and I grew furious
942 as I gazed upon it. I saw it with perfect distinctness
943 -- all a dull blue with a hideous veil over it that
944 chilled the very marrow in my bones, but I could
945 see nothing else of the old man's face or person, for
946 I had directed the ray as if by instinct precisely upon
947 the damned spot.
948
949 And now have I not told you that what you mis-
950 take for madness is but over-acuteness of the senses?
951 now, I say, there came to my ears a low, dull, quick
952 sound, such as a watch makes when enveloped in
953 cotton. I knew that sound well too. It was the
954 beating of the old man's heart. It increased my fury
955 as the beating of a drum stimulates the soldier into
956 courage.
957
958 \begin{floatingfigure}[p]{90mm}
959 \begin{center}
960 A rather wide figure which still uses the \\
961 \texttt{floatingfigure} environment.
962 \end{center}
963 \caption{A \texttt{floatingfigure} environment
964 which uses \texttt{90mm} for \textit{width} and
965 the \texttt{p} \textit{option}.}
966 \end{floatingfigure}
967 But even yet I refrained and kept still. I scarcely\linebreak
968 brea\-thed. I held\linebreak the lantern motionless. I tried
969 how\linebreak stead\-ily I could\linebreak
970 maintain the ray upon the eye.
971 Meantime the hellish tattoo of the heart increased.
972 It grew quicker and quicker, and louder and louder,
973 every instant. The old man's terror must have
974 been extreme! It grew louder, I say, louder every
975 moment! -- do you mark me well? I have told you
976 that I am nervous: so I am. And now at the dead
977 hour of the night, amid the dreadful silence of that
978 old house, so strange a noise as this excited me to
979 uncontrollable terror. Yet, for some minutes longer
980 I refrained and stood still. But the beating grew
981 louder, louder! I thought the heart must burst.
982 And now a new anxiety seized me -- the sound would
983 be heard by a neighbour! The old man's hour had
984 come! With a loud yell, I threw open the lantern
985 and leaped into the room. He shrieked once -- once
986 only. In an instant I dragged him to the floor, and
987 pulled the heavy bed over him. I then smiled
988 gaily, to find the deed so far done. But for many
989 minutes the heart beat on with a muffled sound.
990 This, however, did not vex me; it would not be
991 heard through the wall. At length it ceased. The
992 old man was dead. I removed the bed and examined
993 the corpse. Yes, he was stone, stone dead. I placed
994 my hand upon the heart and held it there many
995 minutes. There was no pulsation. He was stone
996 dead. His eye would trouble me no more.
997
998 \begin{floatingtable}[r]{
999 \begin{tabular}{l}
1000 Two lines in one table with one single \\
1001 column is enough!
1002 \end{tabular}}
1003 \caption{This \texttt{floatingtable} uses the \texttt{r}
1004 \textit{option}.}
1005 \end{floatingtable}
1006 If still you think me mad, you will think so no
1007 longer when I describe the wise precautions I took
1008 for the concealment of the body. The night waned,
1009 and I worked hastily, but in silence.
1010
1011 I took up three planks from the flooring of the
1012 chamber, and deposited all between the scantlings.
1013 I then replaced the boards so cleverly so cunningly,
1014 that no human eye -- not even his -- could have
1015 detected anything wrong. There was nothing to wash
1016 out -- no stain of any kind -- no blood-spot whatever.
1017 I had been too wary for that.
1018
1019 When I had made an end of these labours, it was
1020 four o'clock -- still dark as midnight. As the bell
1021 sounded the hour, there came a knocking at the
1022 street door. I went down to open it with a light
1023 heart, -- for what had I now to fear? There entered
1024 three men, who introduced themselves, with perfect
1025 suavity, as officers of the police. A shriek had been
1026 heard by a neighbour during the night; suspicion
1027 of foul play had been aroused; information had been
1028 lodged at the police office, and they (the officers)
1029 had been deputed to search the premises.
1030
1031 \begin{floatingtable}[p]{
1032 \begin{tabular}{|l|l|l|} \hline
1033 English Word & Swedish Word & Dutch Word \\ \hline
1034 read & l\"asa & lesen \\
1035 speak & tala & spreken\\
1036 write & skriva & schrijven \\ \hline
1037 \end{tabular}}
1038 \caption{A \texttt{floatingtable} with the \texttt{p}
1039 \textit{option}.}
1040 \end{floatingtable}
1041 I smiled, -- for what had I to fear? I bade the
1042 gentlemen welcome. The shriek, I said, was my
1043 own in a dream. The old man, I mentioned,\linebreak was
1044 absent in the country. I took my visitors all over
1045 the house. I bade them search -- search well. I led
1046 them, at length, to his chamber. I showed them his
1047 treasures, secure, undisturbed. In the enthusiasm
1048 of my confidence, I brought chairs into the room,
1049 and desired them here to rest from their fatigues,
1050 while I myself, in the wild audacity of my perfect
1051 triumph, placed my own seat upon the very spot
1052 beneath which reposed the corpse of the victim.
1053
1054 The officers were satisfied. My MANNER had
1055 convinced them. I was singularly at ease. They sat
1056 and while I answered cheerily, they chatted of
1057 familiar things. But, ere long, I felt myself getting
1058 pale and wished them gone. My head ached, and
1059 I fancied a ringing in my ears; but still they sat,
1060 and still chatted. The ringing became more distinct:
1061 I talked more freely to get rid of the feeling:
1062 but it continued and gained definitiveness -- until,
1063 at length, I found that the noise was NOT within my
1064 ears.
1065
1066 No doubt I now grew VERY pale; but I talked
1067 more fluently, and with a heightened voice. Yet
1068 the sound increased -- and what could I do? It was
1069 A LOW, DULL, QUICK SOUND -- MUCH SUCH A SOUND AS A
1070 WATCH MAKES WHEN ENVELOPED IN COTTON. I gasped for
1071 breath, and yet the officers heard it not. I talked
1072 more quickly, more vehemently but the noise
1073 steadily increased. I arose and argued about trifles,
1074 in a high key and with violent gesticulations; but
1075 the noise steadily increased. Why WOULD they not
1076 be gone? I paced the floor to and fro with heavy
1077 strides, as if excited to fury by the observations of
1078 the men, but the noise steadily increased. O God!
1079 what COULD I do? I foamed -- I raved -- I swore! I
1080 swung the chair upon which I had been sitting, and
1081 grated it upon the boards, but the noise arose over
1082 all and continually increased. It grew louder --
1083 louder -- louder! And still the men chatted
1084 pleasantly, and smiled. Was it possible they heard
1085 not? Almighty God! -- no, no? They heard! --
1086 they suspected! -- they KNEW! -- they were making
1087 a mockery of my horror! -- this I thought, and this
1088 I think. But anything was better than this agony!
1089 Anything was more tolerable than this derision! I
1090 could bear those hypocritical smiles no longer! I
1091 felt that I must scream or die! -- and now -- again
1092 -- hark! louder! louder! louder! LOUDER! --
1093
1094 ''Villains!'' I shrieked, ''dissemble no more! I
1095 admit the deed! -- tear up the planks! -- here, here!
1096 -- it is the beating of his hideous heart!''
1097
1098 \rightline{\ensuremath{\mathcal{END}}.}
1099
1100 \listoffigures
1101 \listoftables
1102
1103 %</exempelkod>
1104 %<exempelkod>\end{document}
1105 %<*gammalkod>
1106 \documentclass[11pt]{article}
1107 %
1108 \textheight=1.1\textheight
1109 \textwidth=1.15\textwidth
1110 \oddsidemargin=0pt
1111 \evensidemargin=0pt
1112 %
1113 \begin{document}
1114 %
1115 \title{\LaTeX-Paragraphs Floating around Figures}
1116 \author{{\it Thomas Kneser}\\{\footnotesize
1117 Gesellschaft f\"ur wissenschaftliche Datenverarbeitung
1118 mbH G\"ottingen, FRG}}
1119 \date{August 20, 1990}
1120 \maketitle
1121 %
1122 \begin{abstract}
1123 %
1124 \noindent Frequently figures do not fill the full pagewidth.
1125 If the width of such figures is only half of the
1126 pagewidth or even less,
1127 textlines should be set beside the figures,
1128 or -- from another point of view -- figures should `float'
1129 in paragraphs.
1130 This article presents the \LaTeX{} style option {\tt FLOATFIG}
1131 which can be used to set such Floating Figures as easily
1132 as \LaTeX's standard figures.
1133 \end{abstract}
1134 %
1135 \section{The name of the game}
1136 The macros which make up the {\tt FLOATFIG} style option
1137 are based on PLAIN-\TeX\ macros developed by Thomas Reid
1138 (TUGBoat Vol. 8 \# 3 page 315), who pointed out
1139 how to set figures
1140 {\bf right justified} with paragraphs floating around them.
1141 For such objects
1142 Th. Reid has chosen the term `Floating Figures'.
1143
1144 This choice might cause some confusion,
1145 when we adapt these macros for \LaTeX,
1146 since Leslie Lamport uses the term `float' for objects
1147 which are realized as \TeX-\verb+\inserts+.
1148 While L. Lamports floats are floating in `main vertical list',
1149 floats introduced by Th. Reid
1150 are floating in paragraphs.
1151 For the following we adopt the latter meaning.
1152 \section{How to use it}
1153 The Floating Figures style option is fully compatible with
1154 \LaTeX's standard figure facility:
1155 \begin{enumerate}
1156 \item Floating Figures and standard figures may be requested
1157 in any sequence,
1158 \item Floating Figures can be captioned like standard figures,
1159 \item captioned Floating Figures are inserted in the list of figures
1160 which may be printed by the standard
1161 \verb+\listoffigures+ command.
1162 \end{enumerate}
1163 A Floating Figure may be requested as follows:
1164 \begin{verbatim}
1165 \documentstyle[floatfig]{article}
1166 \begin{document}
1167 \initfloatingfigs
1168 .
1169 .
1170 \begin{floatingfigure}{5.6cm}
1171 \vspace{6.cm}
1172 \caption{Intermolecular potential K-Xe}% optional !
1173 \end{floatingfigure}
1174 .
1175 .
1176 \end{document}
1177 \end{verbatim}
1178 where {\tt 5.6cm} specifies the width of the figure space.
1179 A Floating Figure may only be requested in vertical mode, that is
1180 between paragraphs.
1181
1182 A Floating Figure will be set as soon as possible after its request
1183 has be encountered by \TeX.
1184 That means,
1185 it will be tested if there is enough vertical space
1186 on the current page;
1187 otherwise the figure moves to the next page.
1188
1189 Floating Figures are set {\bf alternating},
1190 that is on the right hand side on odd and
1191 on the left hand side on even numbered pages.
1192 %
1193 \subsection{Restrictions}
1194 \begin{enumerate}
1195 \item The {\tt FLOATFIG} style option may not be combined with the
1196 {\tt TWOCOLUMN} style option,
1197 \item a Floating Figure will never appear in a paragraph
1198 which begins on top of a page.
1199 \end{enumerate}
1200 %
1201 \section{About the internals}
1202 %
1203 We have extended the macros designed by Th.~Reid with regard to:
1204 \begin{enumerate}
1205 \item implantation into the \LaTeX{} context,
1206 \item alternating setting of Floating Figures as explained above,
1207 \item generation of warning messages for `collisions' of
1208 two Floating Figures.
1209 \end{enumerate}
1210 %
1211 \subsection{Implantation into the \LaTeX{} context}
1212 The PLAIN-\TeX{} implementation by Th.~Reid
1213 is based on a redefined \verb+\output+ routine:
1214 %
1215 \begin{verbatim}
1216 \edef\oldoutput{\the\output}%
1217 \output={\the\outputpretest\ifoutput\oldoutput\fi}
1218 \outputpretest={\outputtrue}
1219 \end{verbatim}
1220 %
1221 If a Floating Figure is requested,
1222 the content of the
1223 \verb+\outputpretest+ token register is prepared to decide:
1224 \begin{enumerate}
1225 \item if there is enough vertical space to set the Floating Figure,
1226 \item if setting of a Floating Figure is in progress or
1227 \item if indeed the current page has to be sent to the DVI file.
1228 \end{enumerate}
1229 %
1230 In general, \TeX{} has to deal with more than one paragraph until
1231 a Floating Figure will be completely processed.
1232 During this process
1233 the redefined \verb+\output+ routine is
1234 called at the begin of {\bf every} paragraph;
1235 this is done indirectly
1236 by expanding the control sequence \verb+\tryfig+.
1237 Therefore, the \verb+\everypar+ token
1238 list is prepared by the following command sequence:
1239 \begin{verbatim}
1240 \edef\oldeverypar{\the\everypar}
1241 \everypar={\tryfig\oldeverypar}
1242 \end{verbatim}
1243 Now \verb+\tryfig+ triggers the (modified)
1244 \verb+\output+ routine, which then does the decisions
1245 and actions mentioned above.
1246
1247 Adopting this concept when using the macros in the \LaTeX{} context,
1248 we are faced with the following problems:
1249 \begin{enumerate}
1250 \item At the time \hbox{\tt FLOATFIG.STY} is read in,
1251 the \verb+\output+ routine is still undefined;
1252 its definition is retarded until
1253 \verb+\begin{document}+ will be expanded;
1254 so the redefinition of the \verb+\output+ routine has to be
1255 done after \verb+\begin{document}+
1256 by the command \verb+\initfloatingfigs+
1257 (see section `Known Problems' below).
1258 \item There are situations where
1259 \LaTeX{} decides to redefine the \verb+\everypar+ token list
1260 without saving of the former content;
1261 this occurs for instance when expanding
1262 a \verb+\section+ control sequence.
1263 We overcome this by redefining \verb+\everypar+ whenever
1264 the \verb+\floatingfigure+ environment is entered.
1265 %
1266 Hence to avoid problems, a Floating Figure should be requested
1267 early enough before any sectioning control sequence
1268 (see also subsection `Misleading collision warnings').\hfil\break
1269 %
1270 Furthermore, the concurrent definitions of
1271 \verb+\everypar+ are the reason why
1272 Floating Figures cannot move across section boundaries.
1273 \end{enumerate}
1274 %
1275 \subsection{Alternating figure setting}
1276 The problem to be solved
1277 is to decide if a certain figure has to be set
1278 left- or rightjustified.
1279 This decision has to made according to
1280 the value of the pagecount (left if even, right if odd).
1281 That is we are dealing with the wellknown problem
1282 to associate a certain part of input text with the number
1283 of the page on which it will be set finally.
1284
1285 As pointed out by D.E. Knuth in `The {\TeX}book' this association
1286 is done not before \verb+\output+ routine time.
1287 But the problem is not so hard to solve,
1288 since in Th.~Reid's version there is already a modified
1289 \verb+\output+ routine which decides if a certain figure will
1290 fit on the current page.
1291 As a by-product of this decision one easily gains
1292 the information `odd' or `even' for the pagecount
1293 of the current page.
1294 So our problem reduces to the following simple decision:
1295 \begin{verbatim}
1296 \ifodd\count0 %
1297 \hbox to \hsize{\hss\copy\figbox}%
1298 \global\oddpagestrue
1299 \else% leftsetting
1300 \hbox to \hsize{\copy\figbox\hss}%
1301 \global\oddpagesfalse
1302 \fi% \ifodd\count0
1303 \end{verbatim}
1304 %
1305 \subsection{Collisions of Floating Figures}
1306 We define a collision as a situation where:
1307 \begin{enumerate}
1308 \item a Floating Figure is requested before the predecessor
1309 has been finished,
1310 \item some sectioning is requested before a Floating Figure has been
1311 finished.
1312 \end{enumerate}
1313
1314 While the {\tt FLOATFIG} style option cannot avoid such collisions,
1315 it will recognize them.
1316 For diagnostic purposes we have therefore defined
1317 the switch \verb+\iffigprocessing+ and another count register called
1318 \verb+\ffigcount+.
1319 This count register is used to attach
1320 a sequence number to each Floating Figure,
1321 so they can be identified uniquely within collision warning messages.
1322 These sequence numbers are not to be confused
1323 with the figure count maintained by standard \LaTeX.
1324 %
1325 \section{Known Problems}
1326 \subsection{Need of Initialization}
1327 The present version of the style option needs to be initialized
1328 by control sequence
1329 {\tt\verb+\initfloatingfigs+} as mentioned above.\footnote{%
1330 This is not needed with \LaTeXe{}. /MD}
1331
1332 We hope a later version will initialize itself,
1333 when the first request to a Floating Figure is encountered.
1334 One problem with such an automatic initialization seems
1335 to be,
1336 that we are grouped down
1337 since we are inside a \LaTeX{} environment.
1338 Our first attempt failed
1339 to make the respective settings \verb+\global+.
1340 %
1341 \subsection{Misleading collision warnings}
1342 As mentioned above, Floating Figures do not move
1343 across section boundaries.
1344 If a Floating Figure is requested near a section end,
1345 the figure will be truncated,
1346 if it does not fit in the current section.
1347
1348 If this occurs for instance with floating figure number~4,
1349 a collision will be reported when the request for
1350 floating figure number~5 is encountered;
1351 so the respective warning message may be substantially retarded.
1352 In fact, the message will tell us that there is a problem with figure~4,
1353 but there will be no further hint.
1354 So one has to analyze `by hand' that the problem is {\bf not} caused
1355 by collision with figure~5 but with a section heading;
1356 even worse: if there is no floating figure~5, one gets no warning message
1357 at all.
1358
1359 Furthermore, warning messages will be generated if a Floating Figure
1360 ends in paragraph $n$ and the next one begins with paragraph $n+1$.
1361 These warning messages are to be ignored; they are due to some retardation
1362 caused by the \verb+\everypar+ mechanism.
1363 %
1364 \section{Conclusions}
1365 Working on \texttt{FLOATFIG.STY} we had some unexpected problems
1366 which were caused
1367 by \LaTeX's somewhat unsafe assignments to the \verb+\everypar+ token list.
1368 This is due to the fact that the use
1369 of this token list is fundamental
1370 to the algorithm designed by Th.~Reid.
1371 On the other hand we did expect problems to couple
1372 the Floating Figures with \LaTeX's figure caption adminstration,
1373 that is to achieve a single figure caption numbering for
1374 the standard figures and the Floating Figures and to get both types
1375 listed by the \verb+\listoffigures+ control sequence.
1376 %
1377 But these problems could easily be solved
1378 by the following local definiton within the {\tt FLOATFIG} environment:
1379 \begin{verbatim}
1380 \def\@captype{figure}
1381 \end{verbatim}
1382 Obviously this is due to the fact
1383 that \LaTeX's caption apparatus is thoroughly parameterized.
1384
1385 The \verb+FLOATFIG.STY+ file is stored in the
1386 {\tt EARN/BITNET} listserver
1387 in Heidelberg; \hfil\break
1388 {\tt VM/CMS} users should enter the commands:
1389 \begin{verbatim}
1390 TELL LISTSERV AT DHDURZ1 GET LATEXSTY INDEX
1391 TELL LISTSERV AT DHDURZ1 GET LATEXSTY README
1392 TELL LISTSERV AT DHDURZ1 GET LATEXSTY FILELIST
1393 TELL LISTSERV AT DHDURZ1 GET FLOATFIG ZOOUUE LATEXSTY
1394 \end{verbatim}
1395 to obtain information about how to obtain the style option file.
1396 \subsection{Note by Mats Dahlgren}
1397 %
1398 Several features described in this document still apply to the
1399 \LaTeXe\ \texttt{floatflt} package, whereas others do not. Please
1400 run \LaTeX{} on \texttt{floatflt.dtx} twice and read the resulting
1401 documentation before you use the package.
1402 (This note was added on October 20, 1994; changed on December 27,
1403 1994.)
1404
1405
1406 %\tableofcontents
1407 %</gammalkod>
1408 %<gammalkod> \end{document}
1409 % \fi
1410 %
1411 % \Finale
1412 %
1413 \endinput
1414