summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/fltpage/fltpage.dtx
blob: a56fea64c2d8b3f19c52fc014f849889ff21fd3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
% ^^A -----------------------------
% \iffalse
% File: fltpage.dtx
%
%  Copyright (C) [1998] by Sebastian Gross.  All rights reserved.
% \fi
% ^^A -----------------------------
%
% \iffalse
% IMPORTANT NOTICE:
%
% This is a tool or better yet, an experiments written by Sebastian Gross
% (seppel@zedat.fu-berlin.de), who is writing this not only for it utility
% value, but as part of the process of learning LaTeX.  This utility is far
% from perfect, and comments are welcome.
%
% The usual disclaimers apply:  If it doesn't work right that's your problem!
%
% The usual GNU-style conditions apply: If you change it, you take
% the blame; if you pass it on, pass on all present conditions;
%
% For error reports in case of UNCHANGED versions see fltpage.ins
% \fi
%
% ^^A -----------------------------
% \CheckSum{309}
%%
%% \iffalse meta-comment
%% ===================================================================
%%  @LaTeX-package-file{
%%     author     = {Sebastian Gross},
%%     version    = {0.3},
%%     date       = {13 Nov 1998},
%%     filename   = {fltpage.dtx},
%%     email      = {seppel@zedat.fu-berlin.de},
%%     codetable  = {ISO/ASCII},
%%     keywords   = {LaTeX2e, float, table, figure, caption, FPfigure, FPtable},
%%     supported  = {yes},
%%     docstring  = {LaTeX package which defines new environments to place
%%                   captions of tables and figures on the facing/following page.}
%%  }
%% ===================================================================
%% \fi
%
% ^^A -----------------------------
%
%  \def\fileversion{0.3}
%  \def\filedate{1998/10/29}
%  \newcommand{\docdate}{1998/11/13}
%  \newcommand{\fp}{\textsf{fltpage}}
%
%  \newenvironment{options}[1]%
%  {\begin{list}{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}%
%     \settowidth{\labelwidth}{\texttt{#1\space}}%
%     \setlength{\leftmargin}{\labelwidth}%
%     \addtolength{\leftmargin}{\labelsep}%
%     \setlength{\topsep}{0pt}%
%     \setlength{\itemsep}{0pt}%
%     \setlength{\parsep}{0pt}%
%     \setlength{\partopsep}{0pt}}}%
%  {\end{list}\vspace{4pt}}
%  \setlength{\parskip}{4pt plus2pt minus1pt}
%  \setlength{\parindent}{0pt}
%  \newcommand*{\pkg}[1]{\textsf{#1}}
%  \newcommand*{\cls}[1]{\textsf{#1}}
%
% ^^A -----------------------------
%
%  \changes{v0.3}{1998/10/29}{Added option noHints}
%  \changes{v0.2}{1998/10/28}{Resolved the problem of accessible Variables}
%  \changes{v0.1}{1998/10/07}{First private version}
%
%
% \title{Welcome to the beta test of \fp\thanks{Sorry for the crippled name
%        \fp! I just did not have a better and compelling idea.}\ ~package!}
%  \author{Sebastian Gross\thanks{e-mail: \texttt{seppel@zedat.fu-berlin.de}.}}
%  \date{beta \fileversion\ -- \docdate}
%  \maketitle
%
% ^^A -----------------------------
%
%  \begin{abstract}
%    This package defines the new environments |FPfigure| and |FPtable|,
%    analogous to |figure| and |table|.  In |twoside| mode the caption will
%    be set on the opposite page of a figure/table which needs a whole page.
%    In |oneside| mode the caption will be set on the preceding or following
%    page.
%  \end{abstract}
%
%  \pagestyle{headings}
%
% ^^A -----------------------------
%
%  \section{Introduction}
%
%  In some cases, there is just enough space to place a figure or table on a page,
%  unfortunately there is no space left for the caption below or above.
%  Moreover, it is might be impossible to decrease the size (for example, due to a
%  fixed scale of a map) or the use of \pkg{longtable} is inappropriate.
%  In these (rare) cases it seems acceptable to place the caption on the opposite
%  page in |twoside| mode or on the preceding/following page in |oneside| mode.
%  For this purpose the package \fp\ provides the new environments |FPfigure|
%  and |FPtable| in the sense of `generic markup'.  The basic idea is to use
%  two floats, which follow directly and contain the figure/table and the caption
%  respectively.  For correct positioning on odd or even pages in |twoside| mode
%  at least two compilation runs are required.
%
% ^^A -----------------------------
%
%  \section{Usage}
%
%  \changes{v0.1}{1998/10/07}{First options introduced}
%
%  To use this package just type in the preamble of your document\\
%  \hspace*{1cm} |\usepackage[|\meta{option}|]{fltpage}|.
%
%  The order of caption and figure/table are controlled one of the following options:
%  \begin{options}{closeFloats}
%   \item[closeFloats]
%    the float using the whole page is placed on the next page.
%    When the current page is even the caption is placed on the bottom,
%    when it is odd the caption is placed at the bottom of the page after the
%    float.  In any case the caption appears on opposite page in |twoside|
%    mode of document or the page before in |oneside| mode.
%   \item[rightFloats, CaptionBefore]
%    the big float appears always on the right page and the caption afterwards.
%   \item[leftFloats, CaptionAfterwards]
%    the big float appears always on the left page and the caption afterwards.
%  \end{options}
%
%  To distinguish the `isolated' caption from the text a separator line:
%  \begin{options}{closeFloats}
%   \item[noSeparatorLine]
%     With this option the the separator will be suppressed
%  \end{options}
%
%  To clarify the connection of caption to the float on an other page it might
%  be helpful to give a hint like `Fig. N (on the facing page):'.  The following
%  options control, how this is implemented:
%  \begin{options}{closeFloats}
%   \item[german]
%    So far only German is implemented as other language.
%   \item[varioref]
%    Reference texts are already implemented for many languages in the standard
%    package |varioref|, which implements slightly different expressions, too.
%    With this option these texts will be used.
%  \changes{v0.3}{1998/10/29}{new option}
%   \item[noHints]
%    When this option is used, any hint from the float caption to the float is
%    disabled.
%  \end{options}
%
%  Moreover the following global options (probably declared with the document
%  class) will be evaluated:
%  \begin{options}{closeFloats}
%   \item[draft]
%    causes placing of margin notes, where in the running text the one of the
%    new environments is inserted.
%   \item[oneside, twoside]
%    just to decide mode of document\dots
%  \end{options}
%
% \begin{macro}{FPfigure}
% \begin{macro}{FPtable}
%  In your Document you simply use the new environments instead of the standard
%  environments |table| or |figure| with the usual |\begin{}| and |\end{}| commands:\\
%  \hspace*{1cm}  |\begin{FPtable} ... \end{FPtable}|
%  \\
%  \hspace*{1cm}  |\begin{FPfigure} ... \end{FPfigure}|
% \end{macro}
% \end{macro}
%  Be sure that there are not more than one or two `small' pending floats, otherwise
%  the results will become unpredictable.  Moreover you should not use more than one
%  of the new environment on a page.  The contents of the second will probably
%  overwrite the contents of the first!
%
%  \paragraph{Example}
%  \changes{v0.3}{1998/11/06}{Example inserted}
%  The following example will produce a caption below and an almost empty facing
%  page:\\
%  \begin{FPfigure}
%   \caption{A caption alone on a page will belong to the
%            following figure without a caption!}
%   \fbox{\rule[-10cm]{0pt}{\textheight}Frame symbolizing figure on a whole page.\hspace{5cm}}
%  \end{FPfigure}
%  \hspace*{08mm} |\usepackage[rightFloats]{fltpage}|\\
%  \hspace*{10mm} |...|\\
%  \hspace*{10mm} |\begin{FPfigure}|\\
%  \hspace*{12mm} |\caption{A caption alone ... figure without a caption!}|\\
%  \hspace*{12mm} |\fbox{\rule[-10cm]{0pt}{\textheight}Frame ... page.\hspace{5cm}}|\\
%  \hspace*{10mm} |\end{FPfigure}|
%
% ^^A -----------------------------
%
%  \subsection{Requirements}
%
%  The present version of \fp\ (v.\fileversion) has been developed
%  and tested with \LaTeXe{} of 1998/06/01 using em\TeX~4b running \TeX~3.14159
%  under Windows~3.1, using the \cls{article} document class.
%  It requires
%  the standard \LaTeX\ package \pkg{ifthen} vers.\,1.0n of 1997/11/02
%  and \pkg{tools} package \pkg{afterpage} vers.\,1.08 of 1995/10/27.
%  Maybe it will work with older versions, maybe not\dots
%
%  With the option |varioref| the \pkg{tools} package \pkg{varioref} is
%  needed, as well.
%
% ^^A -----------------------------
%
%  \subsection{Compatibility}
%
%  This package was developed and tested with following versions of the
%  other packages:
%  \begin{center} \begin{tabular}{lll}
%   package           & version & date \\\hline
%   \pkg{sidecap}  & 1.00    & 1997/05/08 \\
%   \pkg{caption}  & 1.4b    & 1995/04/05 \\
%   \pkg{booktabs} & 1.00    & 1995/11/06 \\
%  \end{tabular} \end{center}
%  Again it may work with older versions or not\dots
%
% ^^A -----------------------------
%
%  \section{Known problems and limitations}
%
%  This package is rather a quick and dirty solution to a problem than a
%  sophisticated mechanism for placing captions and floats.  It should be
%  regarded as an experiment, rather than a utility.  It was written by
%  Sebastian Gross not only for it utility value, but as part of the process
%  of learning LaTeX.   Therefore it is far from being perfect, and comments
%  are welcome.   Your remarks and ideas are welcome to improve the concept
%  and implementation in future releases.
%
%  Probably most problems will arose from pending floats, which should be
%  cleared with |\clearpage|.  So far, no attempt is done!
%
%  When unpredicted suites of caption and floats result, you must \emph{first}
%  assure two compilations of your document.
%  An unresolved problem happens for example when the current page is even and
%  the caption should be placed on the bottom of the page, but there is not
%  enough space for it.  It will be moved to the next page (odd) and the long
%  float will be on next even page, which means caption and float are
%  separated!  To inquire this problem the option |draft| is provided, which
%  causes the a margin note, where the FPfloat was inserted in the text.
%
%  The simple design employed does not allow any floats on the odd text page
%  following the big float before the caption is resolved.
%
%  Also there is no solution implemented, when two of the new environments
%  occur within a short interval.  This is especially dangerous when they
%  are called on one page:  The contents of the second will overwrite the
%  contents of the first!
%
%  In some cases the capacity of \TeX\ might be exceeded (main memory).
%  This happens for example, when the table itself is too big.  It is
%  assumed that tables included by files up to approximately 30\,KB will
%  fill one page, even with |\tiny|.   Though, bigger tables may be included
%  with the standard |table| environment\dots
%
%  This package does not work correctly with the \pkg{showkeys} package.
%  Apparently the behaviour of the |\isodd{}| command of the standard
%  \pkg{ifthen} package is disabled.
%
% ^^A -----------------------------
%
%  \section{Acknowlegments}
%
%  This package was partly based on the contributions to |de.comp.text.tex|,
%  particulary of Hans Steffani, Heiko Oberdiek, Martin Schr\"oder, Stefan Ulrich.
%  I have to admit, the exploitation of  Rolf Niepraschk's \pkg{sidecap}
%  package, especially how to write a documented style file.
%
% ^^A -----------------------------
%
%  \section{The documentation driver file}
%
%  The next bit of code contains the documentation driver file for \TeX\, i.\,e.,
%  the file that will produce the documentation you are currently reading.
%  It will be extracted from this file by the \cls{docstrip} program.
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\setlength\hfuzz{5pt}    % ignore small overfull boxes
\GetFileInfo{fltpage.sty}
%\CodelineIndex
%\EnableCrossrefs    % Will prepare and index
%\DisableCrossrefs   % Say \DisableCrossrefs if index is ready
%\OnlyDescription    % comment out for implementation details
%\RecordChanges      % Gather update information
\usepackage[rightFloats]{fltpage}
\MakeShortVerb{\|}
\begin{document}
   \DocInput{fltpage.dtx}
\end{document}
%</driver>
%    \end{macrocode}
%
% ^^A -----------------------------
%
%  \StopEventually{}
%  \section{The implementation}
%
%  \subsection{File and Package Identification}
%
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fltpage}[1998/10/29 v.0.3 Floats on full page (SMU)]
%    \end{macrocode}
%
%  \subsection{Necessary files}
%
%    \begin{macrocode}
\RequirePackage{ifthen}
\RequirePackage{afterpage}
%    \end{macrocode}
%
%  \subsection{Some internal variables and macros}
%
% \begin{macro}{FP@figureC}
% \begin{macro}{FP@tableC}
%  Two counters to store the number of instantiations, used to create unique labels:
%    \begin{macrocode}
\newcounter{FP@figureC}
\newcounter{FP@tableC}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\FP@floatCorpusBOX}
%  To store the actual figure or table we will use a box:
%    \begin{macrocode}
\newsavebox{\FP@floatCorpusBOX}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FP@guide}
% \begin{macro}{\FP@guideStyle}
% \begin{macro}{\FP@guideOneside}
% \begin{macro}{\FP@guideTwoside}
% \begin{macro}{\FP@guideAfter}
% \begin{macro}{\FP@guideBefore}
% \begin{macro}{\FP@guideFaceBefore}
% \begin{macro}{\FP@guideFaceAfter}
%  To clarify the connection of caption to the float on other page it might be
%  helpful to give a hint with the macro |\FP@guide|.  The macro |\FP@guideStyle|
%  contains the appropriate style options. The |\FP@guideAfter|,
%  |\FP@guideFaceAfter|, and |\FP@guideFaceAfter| contain the the default text
%  strings:
%    \begin{macrocode}
\newcommand*{\FP@guide}{}%
\newcommand*{\FP@guideStyle}{\slshape}
\newcommand*{\FP@guideOneside}{following page}
\newcommand*{\FP@guideTwoside}{facing page}
\newcommand*{\FP@guideAfter}{following page}
\newcommand*{\FP@guideBefore}{preceding page}
\newcommand*{\FP@guideFaceBefore}{preceding page}
\newcommand*{\FP@guideFaceAfter}{following page}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\FP@separatorCaption}
%  To distinguish the caption on the separate page better from the text, we define
%  a separator:
%    \begin{macrocode}
\newcommand*{\FP@separatorCaption}{\rule{\linewidth}{.4pt}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FP@positionLabel}
%  To get information about the page we need some unique labels
%    \begin{macrocode}
\newcommand{\FP@positionLabel}{FP\@captype-\number\value{FP@\@captype C}-pos}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FP@helpNote}
%  For debugging the following messages are displayed helping to identify the
%  position of an |FPfigure| resp.\ |FPtable|.
%    \begin{macrocode}
\newcommand{\FP@helpNote}[2]{%
  \typeout{FP#1 is inserted on page \pageref{#2}!}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FP@float}
% \begin{macro}{\FP@floatOneside}
% \begin{macro}{\FP@floatTwoside}
%  The Internal Macro |\FP@float| is the central output macro to perform the
%  sequence of caption and float.  Here it is preliminary defined as a dummy:
%    \begin{macrocode}
\newcommand{\FP@floatOneside}{}
\newcommand{\FP@floatTwoside}{}
\newcommand{\FP@float}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsection{Declaration of options}
%
% \begin{macro}{german}
%  In other languages the text strings pointing to the page of the float must be
%  declared in other languages.  So far only German is implemented.
%  When option |varioref| is later used, we must pass this option to
%  \pkg{varioref}:
%    \begin{macrocode}
\DeclareOption{german}{%
  \renewcommand{\FP@guideAfter}{n\"achste Seite}
  \renewcommand{\FP@guideBefore}{vorhergehende Seite}
  \renewcommand{\FP@guideOneside}{\FP@guideAfter}
  \renewcommand{\FP@guideFaceBefore}{gegen\"uberliegende Seite}
  \renewcommand{\FP@guideFaceAfter}{gegen\"uberliegende Seite}
  \renewcommand{\FP@guideTwoside}{\FP@guideFaceAfter}
  \PassOptionsToPackage{german}{varioref}
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{varioref}
%  Reference texts are already implemented for many languages in the standard
%  package \pkg{varioref}, which implements slightly different expressions.
%  To ensure the inclusion of the package we use |\RequirePackage{}|, which can
%  only placed after |\ProcessOptions| below.  Therefore the code is delayed
%  by |\AtBeginDocument{}|.
%    \begin{macrocode}
\DeclareOption{varioref}{%
  \AtBeginDocument{%
    \RequirePackage{varioref}
    \ifthenelse{\equal{\reftextbefore}{\@empty}}%
      {}{\renewcommand{\FP@guideBefore}{\reftextbefore}}%
    \ifthenelse{\equal{\reftextafter}{\@empty}}%
      {}{\renewcommand{\FP@guideAfter}{\reftextafter}}%
    \renewcommand{\FP@guideOneside}{\FP@guideAfter}
    \ifthenelse{\equal{\reftextfacebefore}{\@empty}}%
      {}{\renewcommand{\FP@guideFaceBefore}{\reftextfacebefore}}%
    \ifthenelse{\equal{\reftextfaceafter}{\@empty}}%
      {}{\renewcommand{\FP@guideFaceAfter}{\reftextfaceafter}}%
    \renewcommand{\FP@guideTwoside}{\FP@guideFaceAfter}%
  }%
}%
%    \end{macrocode}
% \end{macro}
%
%   The Options are implemented via |\FP@float|, which will now have
%   three arguments:
%   The first is the label of the current page to determine if it is odd or even.
%   The second contains the float itself, i.e. the figure ore table.
%   The third contains all the commands, to initialize counters etc..
%   The fourth is the caption part.
% \begin{macro}{closeFloats}
%    \begin{macrocode}
\DeclareOption{closeFloats}{%
  \renewcommand{\FP@floatOneside}[3]{#3#2#1}%
  \renewcommand{\FP@floatTwoside}[4]{%
    \ifthenelse{\isodd{\pageref{#1}}}{#2#3#4}{#4#3#2}}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{leftFloats}
%    \begin{macrocode}
\DeclareOption{leftFloats}{%
  \renewcommand{\FP@floatOneside}[3]{#1#2#3}%
  \renewcommand{\FP@floatTwoside}[4]{%
    \ifthenelse{\isodd{\pageref{#1}}}{{#2#3#4}}{\afterpage{#2#3#4}}}%
  \renewcommand{\FP@guideOneside}{\FP@guideBefore}%
  \renewcommand{\FP@guideTwoside}{\FP@guideFaceBefore}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{rightFloats}
%    \begin{macrocode}
\DeclareOption{rightFloats}{%
  \renewcommand{\FP@floatOneside}[3]{#3#2#1}%
  \renewcommand{\FP@floatTwoside}[4]{%
    \ifthenelse{\isodd{\pageref{#1}}}{\afterpage{#4#3#2}}{{#4#3#2}}}%
  \renewcommand{\FP@guideOneside}{\FP@guideAfter}%
  \renewcommand{\FP@guideTwoside}{\FP@guideFaceAfter}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{CaptionAfterwards}
% \begin{macro}{CaptionBefore}
% Some synonymous options
%    \begin{macrocode}
\DeclareOption{CaptionAfterwards}{\ExecuteOptions{leftFloats}}
\DeclareOption{CaptionBefore}{\ExecuteOptions{rightFloats}}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{draft}
% With the following options, we process options packages etc:
%    \begin{macrocode}
\DeclareOption{draft}{%
  \renewcommand{\FP@helpNote}[2]{%
    \marginpar{Insertion of FP#1}%
    \typeout{FP#1 is inserted on page \pageref{#2}!}}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{oneside}
%    \begin{macrocode}
\DeclareOption{oneside}{%
  \renewcommand{\FP@guide}{\FP@guideStyle(\FP@guideOneside)}%
  \renewcommand{\FP@float}[4]{\FP@floatOneside{#2}{#3}{#4}}
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{twoside}
%    \begin{macrocode}
\DeclareOption{twoside}{%
  \renewcommand{\FP@guide}{\FP@guideStyle(\FP@guideTwoside)}%
  \renewcommand{\FP@float}[4]{\FP@floatTwoside{#1}{#2}{#3}{#4}}
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{noSeparatorLine}
%  He we implement some options to disable some of the functionality of the \fp\
%  package: First the implementation of a separator line in |\FP@separatorCaption|
%  is destroyed:
%    \begin{macrocode}
\DeclareOption{noSeparatorLine}{%
  \renewcommand{\FP@separatorCaption}{}
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{noHints}
%  Secondly any hint in the caption towards the float is disabled.  We must
%  delay this, because the option |varioref| will be executed later, too.
%  We assume that the order of delayed code is the same as in the declaration.
%    \begin{macrocode}
\DeclareOption{noHints}{%
  \AtBeginDocument{\renewcommand{\FP@guide}{}}
}%
%    \end{macrocode}
% \end{macro}
%
%  Unknown options will result in a warning. Perhaps they mean anything to
%  \pkg{varioref}:
%    \begin{macrocode}
\DeclareOption*{%
  \PackageWarning{fltpage}{Unknown option `\CurrentOption'!}%
  \PassOptionsToPackage{\currentOption}{varioref}
}%
%    \end{macrocode}
%
% \subsection{Excecution of options}
%
%  Set the default behaviour:
%    \begin{macrocode}
\ExecuteOptions{closeFloats}
\ExecuteOptions{oneside}
%    \end{macrocode}
%
%  Don't forget to process the Options in the order of declaration:
%    \begin{macrocode}
\ProcessOptions*
\relax
%    \end{macrocode}
%
% \subsection{New environments}
%
% \subsubsection{Internal environment doing the magic}
%
% \begin{macro}{\FP@floatBegin}
%  The opening statement |\FP@float| has one argument which contains
%  the strings `figure' or `table'.
%    \begin{macrocode}
\newcommand{\FP@floatBegin}[1]{%
%    \end{macrocode}
%  First we save the type of float for further processing to |\@captype|:
%    \begin{macrocode}
  \gdef\@captype{#1}%
%    \end{macrocode}
%  The |caption|, |label| and |fnum@figure| resp. |fnum@table| commands must be saved
%  to be used later in the local group:
%    \begin{macrocode}
  \global\let\FP@savedCaptionCommand\caption%
  \global\let\FP@savedLabelCommand\label%
  \ifthenelse{\equal{\@captype}{figure}}
     {\global\let\old@Fnum\fnum@figure}%
     {\global\let\old@Fnum\fnum@table}%
%    \end{macrocode}
%  Initialize some text variables\dots
%    \begin{macrocode}
  \let\FP@LabelText\@empty%
  \let\FP@CaptionText\@empty%
  \let\FP@optionalCaptionText\@empty%
%    \end{macrocode}
%  Now we redefine the |label| and |caption| commands:
%    \begin{macrocode}
  \renewcommand\label[1]{\gdef\FP@LabelText{##1}}%
  \renewcommand\caption[2][]{\gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}%
%    \end{macrocode}
%
%  Finally we must start to record/save the contents of the float, i.e. figure or table etc.,
%  in a box.
%    \begin{macrocode}
  \begin{lrbox}{\FP@floatCorpusBOX}%
}%
%    \end{macrocode}
% \end{macro}
%
%
%  \begin{macro}{\FP@floatEnd}
%  The closing statement |\FP@floatEnd| terminates the collection of the float and
%  causes the output of it and the caption.  Since we use |\afterpage|, the local Box
%  |\FP@floatCorpusBOX| must assigned to the global |\FP@floatCorpusBOX|.
%    \begin{macrocode}
\newcommand{\FP@floatEnd}{%
  \end{lrbox}%
  \global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX
%    \end{macrocode}
%  Creates a label for each figure or table for later determination if the page
%  is odd or even. The counters |FP@figureC| or |FP@tableC| must be
%  incremented before.
%    \begin{macrocode}
  \stepcounter{FP@\@captype C}%
  \FP@savedLabelCommand{\FP@positionLabel}%
%    \end{macrocode}
%  Here we give some hints to the user about the state of the environment\dots
%    \begin{macrocode}
  \FP@helpNote{\@captype}{\FP@positionLabel}%
%    \end{macrocode}
%  Now call the wanted sequence of caption and float according to the options above
%  with the |\FP@float| macro.  The first argument is the location label, which
%  will be used to determine the current page.
%    \begin{macrocode}
  \FP@float{\FP@positionLabel}% location label test
%    \end{macrocode}
%  The second argument contains the float itself:
%  First we open a float environment of type |\@captype| with option |[p]|.  The
%  float itself, i.e. figure or table, will be used the contents of the box
%  |\FP@floatCorpusBOX|.
%  Before placing the label, in order to get the actual page of the figure/table
%  referenced later, rather than the one with the caption, we must increment the
%  the counter of type |\@captype|.
%    \begin{macrocode}
          {\begin{\@captype}[p!]
             \usebox{\FP@floatCorpusBOX}%
             \refstepcounter{\@captype}%
             \ifthenelse{\equal{\FP@LabelText}{\@empty}}
                {}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}%
          \end{\@captype}}
%    \end{macrocode}
%  The third argument is used to reset something changed in the first object.
%  So far it is only the counter of type |\@captype|.
%    \begin{macrocode}
           {\addtocounter{\@captype}{-1}}
%    \end{macrocode}
%  The fourth argument contains the caption:
%  Again we open a float environment of type |\@captype| with option |[p]|.
%  To distinguish the caption from the text, it is separated with a horizontal line.
%  Space above and below are adjusted accordingly.
%  Than we will adjust |\fnum@figure|, when wanted.
%  Finally the caption is given with or without optional argument.
%    \begin{macrocode}
           {\begin{\@captype}[b!]%
             \ifthenelse{\equal{\FP@guide}{\@empty}}%
               {}{\ifthenelse{\equal{\@captype}{figure}}%
                   {\renewcommand{\fnum@figure}{\old@Fnum\ {\FP@guide}}}%
                   {\renewcommand{\fnum@table}{\old@Fnum\ {\FP@guide}}}}%
             \setlength{\abovecaptionskip}{2pt plus2pt minus 1pt} % length above caption
             \setlength{\belowcaptionskip}{2pt plus2pt minus 1pt} % length above caption
             \FP@separatorCaption%
             \ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}%
               {\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}%
               {\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]{\expandafter\protect\FP@CaptionText}}%
           \end{\@captype}}%
}%
%    \end{macrocode}
%  \end{macro}
%
%
%  \subsubsection{The user interface with the new two environments}
%
% \begin{macro}{FPfigure}
% \begin{macro}{FPtable}
%  Finally we implement the new environments, the user wants to use.
%  They redirect to |FP@floatBegin| with the string `figure' or `table' and to
%  |FP@floatEnd|.
%    \begin{macrocode}
\newenvironment{FPfigure}{\FP@floatBegin{figure}}{\FP@floatEnd}
\newenvironment{FPtable}{\FP@floatBegin{table}}{\FP@floatEnd}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% ^^A -----------------------------
%
\endinput
%% \CharacterTable
%% {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%  Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%  Digits        \0\1\2\3\4\5\6\7\8\9
%%  Exclamation   \!     Double quote  \"     Hash (number) \#
%%  Dollar        \$     Percent       \%     Ampersand     \&
%%  Acute accent  \'     Left paren    \(     Right paren   \)
%%  Asterisk      \*     Plus          \+     Comma         \,
%%  Minus         \-     Point         \.     Solidus       \/
%%  Colon         \:     Semicolon     \;     Less than     \<
%%  Equals        \=     Greater than  \>     Question mark \?
%%  Commercial at \@     Left bracket  \[     Backslash     \\
%%  Right bracket \]     Circumflex    \^     Underscore    \_
%%  Grave accent  \`     Left brace    \{     Vertical bar  \|
%%  Right brace   \}     Tilde         \~}
%  \Finale