source: docs/HPCA2012/floatflt.dtx @ 4857

Last change on this file since 4857 was 1302, checked in by lindanl, 8 years ago

Create a directory for HPCA

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