summaryrefslogtreecommitdiff
path: root/obsolete/macros/latex209/contrib/misc/endfloat.sty
blob: 8427156bc558bc69a8f103d9905c0e3906c9198a (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
%% Save file as: ENDFLOAT.STY			Source: FILESERV@SHSU.BITNET
% Name: endfloat.sty
% Description: LaTeX style to put figures and tables at end of article
% Keywords: LaTeX, style-option, float, figure, table
% Author: James Darrell McCauley <jdm5548@diamond.tamu.edu>
% Latest Version: Version 2.0 <02 Jun 1992>
% Archives: pasture.ecn.purdue.edu, shsu.edu or FILESERV@SHSU.BITNET
% Note: See USAGE, CHANGE LOG, and BUGS below.
% See also: comment.sty, endnotes.sty
%
% WHAT IS THIS STYLE FOR?
% The purpose of this style is to put all figures on pages by themselves
% at the end of an article in a section named Figures. Likewise for tables.
% Reference can be made in the text of where the figure should have been
% (only caption appears - see \markersintext [default] and \nomarkersintext
%  below. \ref and \label always works on the ones at the end). This is
% usually required when preparing submissions to journals.
%
% WARNING!
% This creates two extra files: \jobname.fff and \jobname.ttt
% It may also necessitate another latex cycle because of the float
% movement (when you use \label and \ref) and bibtex.
%
% WHY WRITE THIS STYLE?
% Many journals require tables and figures to be separated from the text
% when you submit those ugly doublespaced copies.  They also usually want
% a list of figures/tables before these sections (capability added in v2.0).
%
% I am writing a set of styles that look exactly like a journal, but just
% by adding one style option, I wanted the user to meet the requirements
% for formatting submissions. I encourage others to do the same.
%
% USAGE:
% if you use:                  \documentstyle{article}
% change it to:                \documentstyle[endfloat]{article}
% That's all you have to do. This will produce two extra files with
% .ttt and .fff extensions (for tables and figures, respectively).
%
% This puts all figures and tables at the end of your document
% and creates a List of Figures and/or List of Tables section
% at the end (when appropriate). If you do not want a these, they
% can be turned off by putting \nofiglist and \notablist in the
% preamble of your document.
%
% It also leaves notes in the text (i.e., ``[Figure 4 about here.]'').
% If you would rather not have these, this can be turned off by
% putting \nomarkersintext in the preamble of your document. If you
% do not like this marker, you can change it by using \renewcommand
% (see PREPARING A FOREIGN LANGUAGE VERSION below).
%
% HOW DID I WRITE THIS?
%
% Overview: redefine the figure and table environment following    % bj
% the \begin{comment} ... \end{comment} environment of             % bj
% comment.sty by Victor Eijkhout <eijkhout@csrd.uiuc.edu>.
% Instead of processing what was between \begin{...} and \end{...},
% every line is written to a file (\jobname.fff for figures, \jobname.ttt
% for tables).  Then, when you do an \end{document}, the figure section
% is processed, then the table section is processed. This could easily
% be reversed (tables first) if necessary.
%
% After initial versions, I received much help from Ronald Kappert
% and Brian Junker (see CHANGE LOG below). <Thanks guys!>
% If anyone has any bugs/suggestions to report, mail them to
% jdm5548@diamond.tamu.edu.
%				Darrell McCauley <02 Jun 1992>
%
% PREPARING A FOREIGN LANGUAGE VERSION
%
% 10-03-92: Announcements in any language can be generated with
%           a \renewcommand{\figureplace} or \renewcommand{\tableplace}
%           with default
%\def\figureplace{\bf\figurename~\thepostfig should be placed near here.}
%           and
%\def\tableplace{\bf\tablename~\theposttbl should be placed near here.}
%           The name of figures and tables is governed by standard
%           LaTeX variables \figurename and \tablename.
%           The name of the section with the figures can be governed with
%           a \renewcommand{\figuresection}{...Name of Figs. section...}
%           Ditto for \tablesection. Default is \def\tablesection{Tables}
%           and \def\figuresection{Figures}.
%
%           URC (RJHK)
%
% CHANGE LOG
% (if you make any changes to this, record them here)
% <25 Feb 1992> v0.1 - created by Darrell McCauley <jdm5548@diamond.tamu.edu>
% <01 Mar 1992> v1.0 - cleaned up and released <jdm5548@diamond.tamu.edu>
%
% <10 Mar 1992> v1.0 - some adaptions for LaTeX 2.09 <14-1-92> and
%                      international namegiving by Ronald Kappert
%                      <R.Kappert@urc.kun.nl>.
% <13 Mar 1992> v1.1 - verified that floats were used before a section was
%                      created for them. <jdm5548@diamond.tamu.edu>
% <14 Mar 1992> v1.2 - corrected typo that may have caused figures not
%                      to be printed. <jdm5548@diamond.tamu.edu>
%
% <27 May 1992> ???? - (1) changed "comment" to "figure" and "komment" to
%                      "table" throughout, to avoid collisions with other
%                      style files' definitions of "\comment".  Also
%                      fixes "\begin{table} ends with \end{komment}"
%                      error generated by my (older) version of PC TeX.
%
%                      (2) Fixed gobble of float position specifiers.
%                      There are two ways to do this: (a) \write
%                      \ifnextchar[{\gobbleuntilnext}{} into every
%                      environment written to \jobname.fff, etc.; (b)
%                      save LaTeX's old def's of \figure and \table
%                      and re-use them when processing fig's and tables.
%                      I chose the latter approach, for maximum
%                      consistency with LaTeX, other style files, etc.
%
%                      (3) Added def's of \tablename and \figurename,
%                      which my version of PC-TeX seemed to need.
%                      <backward compatability for earlier versions :-> %jdm
%
%                      (4) Moved formatting of figure/table markers to
%                      \figureplace and \tableplace.
%
%                      (5) Style change: in-text markers are now
%                      centered reminders like "[Figure 4 about here.]".
%
%                      (6) Style change: added list of tables and
%                      figures to the table and figure sections.
%                      Change back to old format with \nofiglist and
%                      \notablist.
%
%                      (7) Changed default to \markersintext.
%
%                      (8) Fixed trivial typo in \@openposttbls
%
%                      All changes marked "% bj" at end of line.
%                      Brian Junker <brian@stat.cmu.edu>
% <02 Jun 1992> v2.0 - incorporated changes made by Junker (see above).
%                      Corrected problem of extra blank spaces in
%                      the output when \nomarkersintext was in effect
%                      (bug reported by <schultz@unixg.ubc.ca>).
%                      <jdm5548@diamond.tamu.edu>
% BUGS:
% <14 Mar 1992> still needs to gobble float position specifiers.
%
\newif\if@domarkers
\def\markersintext{
 \@domarkerstrue }
\def\nomarkersintext{
 \@domarkersfalse
}
%\nomarkersintext
\markersintext     % bj

\newif\if@tablist                % bj
\def\dotablist{\@tablisttrue}    % bj
\def\notablist{\@tablistfalse}   % bj
\dotablist                       % bj

\newif\if@figlist                % bj
\def\dofiglist{\@figlisttrue}    % bj
\def\nofiglist{\@figlistfalse}   % bj
\dofiglist                       % bj

\newcounter{postfig}
\newwrite\@postfigs
\newif\if@postfigsopen \global\@postfigsopenfalse
 \def\@openpostfigs{\immediate\openout\@postfigs=\jobname.fff\relax
      \message{(\jobname.fff)}%
      \global\@postfigsopentrue}

\newcounter{posttbl}
\newwrite\@posttbls
\newif\if@posttblsopen \global\@posttblsopenfalse

\def\@openposttbls{\immediate\openout\@posttbls=\jobname.ttt\relax
      \message{(\jobname.ttt)}%                                      % bj
      \global\@posttblsopentrue}

\def\makeinnocent#1{\catcode`#1=12 }

%\def\figureplace{\bf\figurename~\thepostfig should be placed near here.} % bj
%\def\tableplace{\bf\tablename~\theposttbl should be placed near here.} % bj

\@ifundefined{figurename}{\def\figurename{Figure}}{}  % bj
\@ifundefined{tablename}{\def\tablename{Table}}{}     % bj

\def\figureplace{\begin{center}          % bj
[\figurename~\thepostfig\ about here.]   % bj
\end{center}}                            % bj
\def\tableplace{\begin{center}           % bj
[\tablename~\theposttbl\  about here.]   % bj
\end{center}}                            % bj

\def\@gobbleuntilnext[#1]{}
%\let\eatarg\@gobbleuntilnext  % bj
%\let\ifnextchar\@ifnextchar   % bj

\let\@bfig\figure             % bj
\let\@efig\endfigure          % bj
\let\@btab\table              % bj
\let\@etab\endtable           % bj
\let\endfigure\relax          % bj
\let\endtable\relax           % bj

%
% the {blank space } appearing with \nomarkersintext was fixed by adding
% a percent sign (%) at strategic locations, determined by setting
% \tracingcommands=1           % Darrell
%

\def\figure{%
%    \if@nextchar[{
    \if@postfigsopen \else \@openpostfigs \fi%
    \immediate\write\@postfigs{\string\begin{figure}}%
%    \immediate\write\@postfigs{\string\ifnextchar[{\string\eatarg}{}} % bj
    \if@domarkers%
       \addtocounter{postfig}{1}% % bj
       \figureplace%              % bj
    \fi%
    \def\@currenvir{figure}%
    \begingroup%
    \let\do\makeinnocent \dospecials%
    \makeinnocent\^^L% and whatever other special cases
    \endlinechar`\^^M \catcode`\^^M=12 \xfigure}%
{\catcode`\^^M=12 \endlinechar=-1 %
 \gdef\xfigure#1^^M{\def\test{#1}%
      \ifx\test\endfiguretest%
          \def\next{\endgroup\end{figure}%
          \immediate\write\@postfigs{\string\end{figure}}%
          \immediate\write\@postfigs{\string\clearpage}%
          \immediate\write\@postfigs{ }}%
      \else\ifx\test\enddblfiguretest%
          \def\next{\endgroup\end{figure}%
          \immediate\write\@postfigs{\string\end{figure}}%
          \immediate\write\@postfigs{\string\clearpage}%
          \immediate\write\@postfigs{ }}%
      % skip over float position specifier (fps)
      \else\@ifnextchar[%
          \@whilesw \ifx\test\CB \fi%
	    \@gobble%
      \else%
          \if@postfigsopen \else \@openpostfigs \fi%
          \immediate\write\@postfigs{#1}%
          \let\next\xfigure%
      \fi \fi \next}%
}%

%hello
{\escapechar=-1%
 \xdef\CB{]}%
 \xdef\endfiguretest{\string\\end\string\{figure\string\}}%
 \xdef\enddblfiguretest{\string\\end\string\{figure*\string\}}%
}%

\def\table{\if@posttblsopen \else \@openposttbls \fi
    \immediate\write\@posttbls{\string\begin{table}}%
%    \immediate\write\@posttbls{\string\ifnextchar[{\string\eatarg}{}} % bj
    \if@domarkers
       \addtocounter{posttbl}{1} % bj
       \tableplace               % bj
    \fi
    \def\@currenvir{table}%
    \begingroup
    \let\do\makeinnocent \dospecials
    \makeinnocent\^^L% and whatever other special cases
    \endlinechar`\^^M \catcode`\^^M=12 \xtable}
{\catcode`\^^M=12 \endlinechar=-1 %
 \gdef\xtable#1^^M{\def\test{#1}
      \ifx\test\enddbltabletest
          \def\next{\endgroup\end{table}
          \immediate\write\@posttbls{\string\end{table}}
          \immediate\write\@posttbls{\string\clearpage}
          \immediate\write\@posttbls{ }}
      \else\ifx\test\endtabletest
          \def\next{\endgroup\end{table}
          \immediate\write\@posttbls{\string\end{table}}
          \immediate\write\@posttbls{\string\clearpage}
          \immediate\write\@posttbls{ }}
      \else
          \if@posttblsopen \else \@openposttbls \fi
          \immediate\write\@posttbls{#1}%
          \let\next\xtable
      \fi \fi \next}
}

{\escapechar=-1
 \xdef\enddbltabletest{\string\\end\string\{table*\string\}}
 \xdef\endtabletest{\string\\end\string\{table\string\}}
}
%% end of stuff from comment.sty

% \let\figure=\figure
%\ let\table=\table
\@namedef{figure*}{\figure}
\@namedef{table*}{\table}
\def\endfloat{\endfigure}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\figuresection{Figures}
\def\tablesection{Tables}

\def\processfigures{
  \if@postfigsopen
  \immediate\closeout\@postfigs \global\@postfigsopenfalse
%  \let\figure={\@float{figure}} % bj
%  \let\endfigure=\end@float     % bj
  \let\figure\@bfig              % bj
  \let\endfigure\@efig           % bj
  \clearpage                                                        % bj
  \if@figlist                                                       % bj
    {\normalsize\listoffigures}                                     % bj
    \clearpage                                                      % bj
  \else                                                             % bj
    \section*{\figuresection}                                       % bj
    \markboth{\uppercase{\figuresection}}{\uppercase{\figuresection}}% bj
  \fi                                                               % bj
  {                                                                 % bj
  \def\baselinestretch{1}\tiny\normalsize                           % bj
  \@input{\jobname.fff}                                             % bj
  }                                                                 % bj
  \fi}

\def\processtables{
\if@posttblsopen
  \immediate\closeout\@posttbls \global\@posttblsopenfalse
%  \let\table={\@float{table}}   % bj
%  \let\endtable=\end@float      % bj
  \let\table\@btab               % bj
  \let\endtable\@etab            % bj
  \clearpage                                                      % bj
  \if@tablist                                                     % bj
    {\normalsize\listoftables}                                    % bj
    \clearpage                                                    % bj
  \else                                                           % bj
    \section*{\tablesection}                                      % bj
    \markboth{\uppercase{\tablesection}}{\uppercase{\tablesection}}% bj
  \fi                                                             % bj
  {                                                               % bj
  \def\baselinestretch{1}\tiny\normalsize                         % bj
  \@input{\jobname.ttt}                                           % bj
  }
  \fi}

\def\enddocument{\onecolumn\processfigures\clearpage\processtables
\@checkend{document}\clearpage\begingroup
\if@filesw \immediate\closeout\@mainaux
\def\global\@namedef##1##2{}\def\newlabel{\@testdef r}%
\def\bibcite{\@testdef b}\@tempswafalse \makeatletter\input \jobname.aux
\if@tempswa \@warning{Label(s) may have changed.  Rerun to get
cross-references right}\fi\fi\endgroup\deadcycles\z@\@@end}

\endinput