-
Notifications
You must be signed in to change notification settings - Fork 1
/
fltpage.sty
executable file
·230 lines (212 loc) · 9.3 KB
/
fltpage.sty
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
%!TEX root = /Users/andy/Documents/Academics/Dissertation/thesis.tex
%%
%% This is the fltpage package for full page figures.
%% It has been heavily commented and lightly modified by Andrew Leifer
%% to bring into compliance with Harvard University's thesis guidelines.
%% Specifically, captions preceeding full page captions now appear
%% on their own lines. Thanks to Eddie Schlafly for initial guidance here.
%%
%% -- Andrew Leifer
%% 5 May 2012
%%
%%
%% This is file `fltpage.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fltpage.dtx (with options: `package')
%%
%% Copyright (C) 1998 by Sebastian Gross. All rights reserved.
%%
%%
%% This file is part of the fltpage package
%%
%%
%%
%%
%% IMPORTANT NOTICE:
%%
%% This a tool or better yet, an experiments written by Sebastian Gross,
%% 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;
%%
%% Error Reports in case of UNCHANGED versions to
%%
%% Sebastian Gross <[email protected]>
%%
%%
%% \iffalse meta-comment
%% ===================================================================
%% @LaTeX-package-file{
%% author = {Sebastian Gross},
%% version = {0.3},
%% date = {13 Nov 1998},
%% filename = {fltpage.dtx},
%% email = {[email protected]},
%% 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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fltpage}[1998/10/29 v.0.3 Floats on full page (SMU)]
\RequirePackage{ifthen}
\RequirePackage{afterpage}
\newcounter{FP@figureC} %Two new counters
\newcounter{FP@tableC}
\newsavebox{\FP@floatCorpusBOX}
\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}
\newcommand*{\FP@separatorCaption}{\rule{\linewidth}{.4pt}}
\newcommand{\FP@positionLabel}{FP\@captype-\number\value{FP@\@captype C}-pos}
\newcommand{\FP@helpNote}[2]{%
\typeout{FP#1 is inserted on page \pageref{#2}!}}%
\newcommand{\FP@floatOneside}{}
\newcommand{\FP@floatTwoside}{}
\newcommand{\FP@float}{}
\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}
}%
\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}%
}%
}%
\DeclareOption{closeFloats}{%
\renewcommand{\FP@floatOneside}[3]{#3#2#1}%
\renewcommand{\FP@floatTwoside}[4]{%
\ifthenelse{\isodd{\pageref{#1}}}{#2#3#4}{#4#3#2}}%
}%
\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}%
}%
\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}%
}%
\DeclareOption{CaptionAfterwards}{\ExecuteOptions{leftFloats}}
\DeclareOption{CaptionBefore}{\ExecuteOptions{rightFloats}}%
\DeclareOption{draft}{%
\renewcommand{\FP@helpNote}[2]{%
\marginpar{Insertion of FP#1}%
\typeout{FP#1 is inserted on page \pageref{#2}!}}%
}%
\DeclareOption{oneside}{%
\renewcommand{\FP@guide}{\FP@guideStyle(\FP@guideOneside)}%
\renewcommand{\FP@float}[4]{\FP@floatOneside{#2}{#3}{#4}}
}%
\DeclareOption{twoside}{%
\renewcommand{\FP@guide}{\FP@guideStyle(\FP@guideTwoside)}%
\renewcommand{\FP@float}[4]{\FP@floatTwoside{#1}{#2}{#3}{#4}}
}%
\DeclareOption{noSeparatorLine}{%
\renewcommand{\FP@separatorCaption}{}
}
\DeclareOption{noHints}{%
\AtBeginDocument{\renewcommand{\FP@guide}{}}
}%
\DeclareOption*{%
\PackageWarning{fltpage}{Unknown option `\CurrentOption'!}%
\PassOptionsToPackage{\currentOption}{varioref}
}%
\ExecuteOptions{closeFloats}
\ExecuteOptions{oneside}
\ProcessOptions*
\relax
% This code gets dropped into place for the \begin{FPfigure} command
\newcommand{\FP@floatBegin}[1]{%
\gdef\@captype{#1}%
\global\let\FP@savedCaptionCommand\caption %Caption command before it gets redefined!!
\global\let\FP@savedLabelCommand\label%
\ifthenelse{\equal{\@captype}{figure}} %Set \old@Fnum to be either figure or table
{\global\let\old@Fnum\fnum@figure}%
{\global\let\old@Fnum\fnum@table}%
\let\FP@LabelText\@empty %set the label text as empty
\let\FP@CaptionText\@empty % set the caption text as empty
\let\FP@optionalCaptionText\@empty %set the optional caption text as empty
%Redefinie the \label command to save the value placed there in this special LabelText variable
\renewcommand\label[1]{\gdef\FP@LabelText{##1}}
%Redefine the caption function so that it no longer creatse a caption, instead it saves the values that would have been passed to caption and places them in these variables. Then it beings a lrbox environment
\renewcommand\caption[2][]{\gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}
%THis shows up right wher \begin{FPfigure} would have been
\begin{lrbox}{\FP@floatCorpusBOX}%
%Text at this position shows up right before the figure
}
\newcommand{\FP@floatEnd}{%
\end{lrbox} %This closes the end of the lrbox that was opened when the calling .tex file invoked the "\caption" command
\global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX
\stepcounter{FP@\@captype C}%
\FP@savedLabelCommand{\FP@positionLabel}%
\FP@helpNote{\@captype}{\FP@positionLabel}%
\FP@float{\FP@positionLabel} % location label test %I believe this is the float
{\begin{\@captype}[b!] \ContinuedFloat %Begin figure! % NEW<---------- (conti)
\stepcounter{\@captype}%increment the counter
\FP@savedCaptionCommand{(continued)} % NEW<---------- (additional caption command)
\usebox{\FP@floatCorpusBOX}%this must be handle to the float box?
%if the label text is NOT empty, display the label command
\ifthenelse{\equal{\FP@LabelText}{\@empty}}
{}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}%
\end{\@captype}}
{\addtocounter{\@captype}{-1}} %Subtract off one from the counter?
{\begin{\@captype}[p!]% %Changed from b to p! Thanks to Eddie. --- Andrew Leifer %Start another figure!
\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
%THis is where the full caption shows up
\FP@separatorCaption %make the line if we are using it
\ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}%
{\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}%here is the saved caption command if the optional text is empty
{\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]{\expandafter\protect\FP@CaptionText}}%if the optional text is not empty, than this is the command
\end{\@captype}}
}%
%I believe this command means: go through and find all instances of \begin{FPFigure} in the calling .tex file and repalce it with the first argument, and \end{FPFigure} gets replaced with the secoind argument
\newenvironment{FPfigure}{\FP@floatBegin{figure}}{\FP@floatEnd}
\newenvironment{FPtable}{\FP@floatBegin{table}}{\FP@floatEnd}
%\afterpage{\clearpage .....} }
\endinput
%%
%% End of file `fltpage.sty'.