2 %% This is file `fltpage.sty',
3 %% generated with the docstrip utility.
5 %% The original source files were:
7 %% fltpage.dtx (with options: `package')
9 %% Copyright (C) 1998 by Sebastian Gross. All rights reserved.
12 %% This file is part of the fltpage package
16 %% This a tool or better yet, an experiments written by Sebastian Gross,
17 %% who is writing this not only for it utility value, but as part of the
18 %% process of learning LaTeX. This utility is far from perfect, and
19 %% comments are welcome.
21 %% The usual disclaimers apply: If it doesn't work right that's your problem!
23 %% The usual GNU-style conditions apply: If you change it, you take
24 %% the blame; if you pass it on, pass on all present conditions;
26 %% Error Reports in case of UNCHANGED versions to
28 %% Sebastian Gross <seppel@zedat.fu-berlin.de>
31 %% \iffalse meta-comment
32 %% ===================================================================
33 %% @LaTeX-package-file{
34 %% author = {Sebastian Gross},
36 %% date = {13 Nov 1998},
37 %% filename = {fltpage.dtx},
38 %% email = {seppel@zedat.fu-berlin.de},
39 %% codetable = {ISO/ASCII},
40 %% keywords = {LaTeX2e, float, table, figure, caption, FPfigure, FPtable},
42 %% docstring = {LaTeX package which defines new environments to place
43 %% captions of tables and figures on the facing/following page.}
45 %% ===================================================================
47 \NeedsTeXFormat{LaTeX2e}
48 \ProvidesPackage{fltpage}[1998/10/29 v.0.3 Floats on full page (SMU)]
49 \RequirePackage{ifthen}
50 \RequirePackage{afterpage}
51 \newcounter{FP@figureC}
52 \newcounter{FP@tableC}
53 \newsavebox{\FP@floatCorpusBOX}
54 \newcommand*{\FP@guide}{}%
55 \newcommand*{\FP@guideStyle}{\slshape}
56 \newcommand*{\FP@guideOneside}{following page}
57 \newcommand*{\FP@guideTwoside}{facing page}
58 \newcommand*{\FP@guideAfter}{following page}
59 \newcommand*{\FP@guideBefore}{preceding page}
60 \newcommand*{\FP@guideFaceBefore}{preceding page}
61 \newcommand*{\FP@guideFaceAfter}{following page}
62 \newcommand*{\FP@separatorCaption}{\rule{\linewidth}{.4pt}}
63 \newcommand{\FP@positionLabel}{FP\@captype-\number\value{FP@\@captype C}-pos}
64 \newcommand{\FP@helpNote}[2]{%
65 \typeout{FP#1 is inserted on page \pageref{#2}!}}%
66 \newcommand{\FP@floatOneside}{}
67 \newcommand{\FP@floatTwoside}{}
68 \newcommand{\FP@float}{}
69 \DeclareOption{german}{%
70 \renewcommand{\FP@guideAfter}{n\"achste Seite}
71 \renewcommand{\FP@guideBefore}{vorhergehende Seite}
72 \renewcommand{\FP@guideOneside}{\FP@guideAfter}
73 \renewcommand{\FP@guideFaceBefore}{gegen\"uberliegende Seite}
74 \renewcommand{\FP@guideFaceAfter}{gegen\"uberliegende Seite}
75 \renewcommand{\FP@guideTwoside}{\FP@guideFaceAfter}
76 \PassOptionsToPackage{german}{varioref}
78 \DeclareOption{varioref}{%
80 \RequirePackage{varioref}
81 \ifthenelse{\equal{\reftextbefore}{\@empty}}%
82 {}{\renewcommand{\FP@guideBefore}{\reftextbefore}}%
83 \ifthenelse{\equal{\reftextafter}{\@empty}}%
84 {}{\renewcommand{\FP@guideAfter}{\reftextafter}}%
85 \renewcommand{\FP@guideOneside}{\FP@guideAfter}
86 \ifthenelse{\equal{\reftextfacebefore}{\@empty}}%
87 {}{\renewcommand{\FP@guideFaceBefore}{\reftextfacebefore}}%
88 \ifthenelse{\equal{\reftextfaceafter}{\@empty}}%
89 {}{\renewcommand{\FP@guideFaceAfter}{\reftextfaceafter}}%
90 \renewcommand{\FP@guideTwoside}{\FP@guideFaceAfter}%
93 \DeclareOption{closeFloats}{%
94 \renewcommand{\FP@floatOneside}[3]{#3#2#1}%
95 \renewcommand{\FP@floatTwoside}[4]{%
96 \ifthenelse{\isodd{\pageref{#1}}}{#2#3#4}{#4#3#2}}%
98 \DeclareOption{leftFloats}{%
99 \renewcommand{\FP@floatOneside}[3]{#1#2#3}%
100 \renewcommand{\FP@floatTwoside}[4]{%
101 \ifthenelse{\isodd{\pageref{#1}}}{{#2#3#4}}{\afterpage{#2#3#4}}}%
102 \renewcommand{\FP@guideOneside}{\FP@guideBefore}%
103 \renewcommand{\FP@guideTwoside}{\FP@guideFaceBefore}%
105 \DeclareOption{rightFloats}{%
106 \renewcommand{\FP@floatOneside}[3]{#3#2#1}%
107 \renewcommand{\FP@floatTwoside}[4]{%
108 \ifthenelse{\isodd{\pageref{#1}}}{\afterpage{#4#3#2}}{{#4#3#2}}}%
109 \renewcommand{\FP@guideOneside}{\FP@guideAfter}%
110 \renewcommand{\FP@guideTwoside}{\FP@guideFaceAfter}%
112 \DeclareOption{CaptionAfterwards}{\ExecuteOptions{leftFloats}}
113 \DeclareOption{CaptionBefore}{\ExecuteOptions{rightFloats}}%
114 \DeclareOption{draft}{%
115 \renewcommand{\FP@helpNote}[2]{%
116 \marginpar{Insertion of FP#1}%
117 \typeout{FP#1 is inserted on page \pageref{#2}!}}%
119 \DeclareOption{oneside}{%
120 \renewcommand{\FP@guide}{\FP@guideStyle(\FP@guideOneside)}%
121 \renewcommand{\FP@float}[4]{\FP@floatOneside{#2}{#3}{#4}}
123 \DeclareOption{twoside}{%
124 \renewcommand{\FP@guide}{\FP@guideStyle(\FP@guideTwoside)}%
125 \renewcommand{\FP@float}[4]{\FP@floatTwoside{#1}{#2}{#3}{#4}}
127 \DeclareOption{noSeparatorLine}{%
128 \renewcommand{\FP@separatorCaption}{}
130 \DeclareOption{noHints}{%
131 \AtBeginDocument{\renewcommand{\FP@guide}{}}
134 \PackageWarning{fltpage}{Unknown option `\CurrentOption'!}%
135 \PassOptionsToPackage{\currentOption}{varioref}
137 \ExecuteOptions{closeFloats}
138 \ExecuteOptions{oneside}
141 \newcommand{\FP@floatBegin}[1]{%
143 \global\let\FP@savedCaptionCommand\caption%
144 \global\let\FP@savedLabelCommand\label%
145 \ifthenelse{\equal{\@captype}{figure}}
146 {\global\let\old@Fnum\fnum@figure}%
147 {\global\let\old@Fnum\fnum@table}%
148 \let\FP@LabelText\@empty%
149 \let\FP@CaptionText\@empty%
150 \let\FP@optionalCaptionText\@empty%
151 \renewcommand\label[1]{\gdef\FP@LabelText{##1}}%
152 \renewcommand\caption[2][]{\gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}%
153 \begin{lrbox}{\FP@floatCorpusBOX}%
155 \newcommand{\FP@floatEnd}{%
157 \global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX
158 \stepcounter{FP@\@captype C}%
159 \FP@savedLabelCommand{\FP@positionLabel}%
160 \FP@helpNote{\@captype}{\FP@positionLabel}%
161 \FP@float{\FP@positionLabel}% location label test
162 {\begin{\@captype}[p!]
163 \usebox{\FP@floatCorpusBOX}%
164 \refstepcounter{\@captype}%
165 \ifthenelse{\equal{\FP@LabelText}{\@empty}}
166 {}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}%
168 {\addtocounter{\@captype}{-1}}
169 {\begin{\@captype}[b!]%
170 \ifthenelse{\equal{\FP@guide}{\@empty}}%
171 {}{\ifthenelse{\equal{\@captype}{figure}}%
172 {\renewcommand{\fnum@figure}{\old@Fnum\ {\FP@guide}}}%
173 {\renewcommand{\fnum@table}{\old@Fnum\ {\FP@guide}}}}%
174 \setlength{\abovecaptionskip}{2pt plus2pt minus 1pt} % length above caption
175 \setlength{\belowcaptionskip}{2pt plus2pt minus 1pt} % length above caption
176 \FP@separatorCaption%
177 \ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}%
178 {\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}%
179 {\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]{\expandafter\protect\FP@CaptionText}}%
182 \newenvironment{FPfigure}{\FP@floatBegin{figure}}{\FP@floatEnd}
183 \newenvironment{FPtable}{\FP@floatBegin{table}}{\FP@floatEnd}
186 %% End of file `fltpage.sty'.