summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/preprint/figcaps.dtx
blob: e6c08432cd6879bd6b26d0f192a6f9cbe787a027 (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
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
% \iffalse      THIS IS A META-COMMENT
%<*dtx>
\ProvidesFile
%========================================================================
                       {FIGCAPS.DTX}
%========================================================================
%</dtx>
%% Copyright 1993-1999 Patrick W Daly
%% Max-Planck-Institut f\"ur Aeronomie
%% Max-Planck-Str. 2
%% D-37191 Katlenburg-Lindau
%% Germany
%% E-mail: daly@linmpi.mpg.de
% 
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% This is a contributed file to the LaTeX2e system.
% -------------------------------------------------
% This is a LaTeX package to put tables and figure captions at the end of an
%    article even though the environments appear in the text.
% Installation:
%    LaTeX this file: creates docstrip installation file figcaps.ins
%                         AND the (LaTeX2e) documentation
%    (La)TeX figcaps.ins: creates package files figcaps.sty, and optionally
%                         documentation driver figcaps.drv
%    (figcaps.ins may be edited as needed)
% Docstrip options available:
%        package - to produce a (LaTeX2e) package .sty file
%        plates  - to include plate environments, just like figures
%        longtab - to include longtable environment, for longtable package (2e)
%        sublab  - to include coding for use with sublabel.sty
%        toc     - to enable tables of contents to be used; writes to auxiliary
%                    files .pot and pof instead of .lof and .lot
%        driver  - to produce a driver file to print the documentation
%        209     - (with package) for package that runs under LaTeX 2.09
%        subpack - (with package) for coding included in other packages
%        agu     - (with package,subpack) for inclusion in aguplus package
%        egs     - (with package,subpack) for inclusion in egs package
%--------------------------------------------------------------------------
%<*!subpack>
%<package&209>\def\ProvidesPackage#1#2]
%<package&209>  {\typeout{Style option `#1'#2]}}
%
%  *** Identify the package file:-
%<package&!209>\NeedsTeXFormat{LaTeX2e}[1994/06/01]
%<package>\ProvidesPackage{figcaps}
%</!subpack>
%
%  *** Provide command to dislay module version
%<package&subpack>\def\ModuleVersion#1[#2]{}
%<package&subpack>    \ModuleVersion{figcaps}
%
%  *** Identify the driver file:-
%<driver>\NeedsTeXFormat{LaTeX2e}
%<driver>\ProvidesFile{figcaps.drv}
%
%  *** The DATE, VERSION, and other INFO
%\fi
%\ProvidesFile{figcaps}
        [1999/02/23 4.7 (PWD)]
% \changes{4.0}{1993 Oct 12}{First integrated documented version}
% \changes{4.1}{1993 Oct 29}{Add coding for JGR, GRL, NLINPROC}
% \changes{4.1}{1993 Oct 29}{Add \cs{iffigmark} for marginal notes}
% \changes{4.1}{1993 Oct 29}{Add \cs{@tempa} construct to get \cs{@float}
%                               out of \cs{if} \cs{fi} brackets}
% \changes{4.1}{1993 Nov 15}{For JGR and GRL, tables after captions}
% \changes{4.1}{1993 Nov 20}{Add coding for AGU supplement}
% \changes{4.2}{1993 Nov 20}{Add \cs{figbox} for AGU supplement}
% \changes{4.2}{1993 Nov 20}{AGU supplement: captions in two widths again}
% \changes{4.2}{1993 Dec 16}{Suppress floats for AGU planotable}
% \changes{4.2}{1993 Dec 21}{Add \cs{if@filesw} for extra appendix entries}
% \changes{4.3}{1994 May 19}{Convert to \LaTeXe, add language and other
%     options, add \cs{figmarkon/off} and \cs{figcapson/off}}
% \changes{4.3a}{1994 Jun 06}{For AGU, change \cs{@makefcaption}}
% \changes{4.3b}{1994 Jun 22}{Update to first official release of \LaTeXe}
% \changes{4.3c}{1994 Nov 30}{Bad bug in \cs{figmarkoff} fixed, caused
%      crashes}
% \changes{4.3d}{1995 Jan 3}{Update documentation to PWD standard}
% \changes{4.4}{1995 Jan 8}{Fix bug caused by LTX 94/12/1 \cs{@writefile}}
% \changes{4.5}{1996 Jan 10}{Allow first float to be in appendix}
% \changes{4.5a}{1996 Jun 27}{Change \texttt{nlinproc} option to \texttt{egs}}
% \changes{4.5b}{1996 Jul 22}{Allow \cs{figbox} to scale automatically}
% \changes{4.5c}{1996 Jul 29}{Add \cs{figbox*} to suppress frame}
% \changes{4.5d}{1996 Aug 20}{Fix table notes for AGU}
% \changes{4.5e}{1996 Oct 10}{Zero \cs{parindent} for EGS}
% \changes{4.5f}{1997 Mar 16}{Fix copyright for subpack}
% \changes{4.5g}{1997 Apr 29}{Conform to new \texttt{docstrip}}
% \changes{4.5h}{1997 Nov 18}{Fix appendix problem for AGU}
% \changes{4.6}{1998 Sep 14}{Add \texttt{longtable} environment}
% \changes{4.7}{1999 Feb 23}{Update copyright notice}
%
% \CheckSum{1417}
% \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         \~}
%
% \iffalse
%<*install>
%^^A =============================================
%^^A    Here is the docstrip installation file
%^^A    It is written on first LaTeX run if it 
%^^A    does not already exist
%^^A =============================================
\begin{filecontents*}{figcaps.ins}
% File: figcaps.ins
% Copyright 1999 Patrick W. Daly
%
% This file can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
% 
% It is an installation file for extracting package and driver
% files from the original source file. Simply process it under
% TeX or LaTeX. 

\input docstrip

\preamble
=============================================
IMPORTANT NOTICE:

This program can be redistributed and/or modified under the terms
of the LaTeX Project Public License Distributed from CTAN
archives in directory macros/latex/base/lppl.txt; either
version 1 of the License, or any later version.

This is a generated file.
It may not be distributed without the original source file \inFileName.

Full documentation can be obtained by LaTeXing that original file.
Only a few abbreviated comments remain here to describe the usage.
=============================================
\endpreamble
\postamble

<<<<< End of generated file <<<<<<
\endpostamble

\declarepreamble\driver
============================================
This is the driver file to produce the LaTeX documentation 
from the original source file \inFileName.

Make changes to it as needed. (Never change the file \inFileName!)
============================================
\endpreamble

\declarepostamble\driverq

End of documentation driver file.
\endpostamble

\keepsilent
\askforoverwritefalse

\generate{\file{figcaps.sty}{\from{figcaps.dtx}{package}}
          \file{figcaps.drv}{\usepreamble\driver\usepostamble\driverq
                           \from{figcaps.dtx}{driver}}
         }

\obeyspaces
\Msg{******************************************}%
\Msg{* For documentation, process figcaps.dtx *}%
\Msg{*    or the driver file      figcaps.drv *}%
\Msg{******************************************}

\endbatchfile
\end{filecontents*}
%</install>
%<*driver>
\documentclass{ltxdoc}
%<driver>%\documentclass[twoside]{ltxdoc}
%<driver>%\documentclass[a4paper]{ltxdoc}
%<driver>%\documentclass[twoside,a4paper]{ltxdoc}
\raggedbottom

 %** To include the detailed explanation of the coding, comment out
 %**   the next line
\OnlyDescription

 %** To produce a command index: add the following line for one run,
 %**   then run  makeindex -s gind.ist natbib
 %**   and reprocess, with or without this line (much faster without)
%<driver>% \EnableCrossrefs\CodelineIndex

 %** To produce a change history: add the following line for one run,
 %**   then run  makeindex -s gglo.ist -o natbib.gls natbib.glo
 %**   and reprocess, with or without this line (faster without)
%<driver>% \RecordChanges

\DisableCrossrefs %May stay; zapped by \EnableCrossrefs
\CodelineNumbered %May stay

\begin{document}
   \DocInput{figcaps.dtx}
\end{document}
%</driver>
%\fi
%
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
% \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
% \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument}
% \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError}
% \DoNotIndex{\ClassWarning,\PackageWarning,\ClassWarningNoLine}
% \DoNotIndex{\PackageWarningNoLine,\ClassInfo,\PackageInfo,\MessageBreak}
% \DoNotIndex{\space,\protect,\DeclareRobustCommand,\CheckCommand}
% \DoNotIndex{\newcommand,\renewcommand,\providecommand,\newenvironment}
% \DoNotIndex{\renewenvironment,\newif,\newlength,\newcounter,\setlength}
% \DoNotIndex{\setcounter,\if,\ifx,\ifcase,\ifnum,\ifdim,\else,\fi}
% \DoNotIndex{\texttt,\textbf,\textrm,\textsl,\textsc}
% \DoNotIndex{\textup,\textit,\textmd,\textsf,\emph}
% \DoNotIndex{\ttfamily,\rmfamily,\sffamily,\mdseries,\bfseries,\upshape}
% \DoNotIndex{\slshape,\scshape,\itshape,\em,\LaTeX,\LaTeXe}
% \DoNotIndex{\filename,\fileversion,\filedate,\let}
% \DoNotIndex{\@ifundefined,\@input,\@latexerr,\@makecaption,\@makeother}
% \DoNotIndex{\@mkboth,\@namedef,\@tempa,\@tempb,\@writefile,\\,\{,\},\^}
% \DoNotIndex{\active,\addcontentsline,\addtocontents,\begingroup,\bgroup}
% \DoNotIndex{\bigskip,\catcode,\clearpage,\closeout,\def,\do,\dospecials}
% \DoNotIndex{\egroup,\else,\end@dblfloat,\end@float,\endgroup,\expandafter}
% \DoNotIndex{\fi,\filedate,\filename,\fileversion,\gdef,\ifx,\immediate}
% \DoNotIndex{\jobname,\label,\let,\long,\newcounter,\newif,\newpage}
% \DoNotIndex{\newwrite,\openout,\par,\refstepcounter,\relax,\space}
% \DoNotIndex{\stepcounter,\string,\typeout,\uppercase,\vbox,\vskip}
% \DoNotIndex{\vspace,\marginpar,\if@filesw,\parindent}
% \DoNotIndex{\advance,\divide,\fboxrule,\fboxsep,\fnum@figure,\fnum@plate}
% \DoNotIndex{\fnum@table,\framebox,\hbox,\hfil,\hsize,\newdimen}
% \DoNotIndex{\providecommand,\section,\setcounter,\small,\textwidth}
% \DoNotIndex{\vrule,\vss,\z@}
% \DoNotIndex{\@caption,\@captype,\@dblfloat,\@depth,\@float,\@height}
% \DoNotIndex{\@ifnextchar,\@tempdima,\@term,\@width,\cl@section}
% \DoNotIndex{\cr@relax,\fbox}
%
% \setcounter{IndexColumns}{2}
% \setlength{\IndexMin}{10cm}
% \setcounter{StandardModuleDepth}{1}
%
% \GetFileInfo{figcaps}
%
% \title{\bfseries A Package to Put Figures and Tables at the End of
%             an Article}
%
% \author{Patrick W. Daly}
%
% \date{This paper describes package \texttt{\filename}\\
%       version \fileversion{} from \filedate\\[1ex]
%     \textsl{It is part of the \texttt{preprint} collection of packages}
%  }
%
% \maketitle
%
% \pagestyle{myheadings}
% \markboth{P. W. Daly}{PUTTING FIGURES AND TABLES AT THE END}
%
%^^A In order to keep all marginal notes on the one (left) side:
%^^A (otherwise they switch sides disasterously with twoside option)
% \makeatletter \@mparswitchfalse \makeatother
%
% \newcommand{\thestyle}{\texttt{\filename}}
%
%\begin{small}\begin{center}\textbf{Summary}\end{center}
% The stripped version of this file contains the following brief description:
%\iffalse
%<*package&!subpack>
%\fi
% \begin{verbatim}
 %  This option allows the figure captions to be collected throughout
 %    the paper and printed on a separate page at the end. The figures
 %    themselves will not appear in the text. This is for purposes of
 %    a manuscript for submission.
 %  Similarly, tables are not printed in the text, but are outputted at
 %    the end, after the figure captions.
%<*plates>
 %  A plate environment also exists, handled just like figures.
%</plates>
%<*longtab>
 % A longtable environment exists, for use with the longtable tools package.
%</longtab>
 %  The figures themselves may appear, with captions, at
 %    the end, after the tables. This is done with command \printfigures
 %    in the preamble. This only makes sense if the figures have been
 %    generated by LaTeX or if they are being imported.
 %  Marginal notes added where environments placed if \figmarkon given.
 %  NOTE: Only works for article-like styles at present, where \section is
 %        the highest sectioning level.
%<*!toc>
 %  NOTE: Tables of contents (incl figures and tables) cannot be used
%</!toc>
 %  NOTE: This file must be read in AFTER \appendix has been defined;
%<*sublab>
 %        if sublabel.sty is also used, it must be read in first.
%</sublab>
%<agu> % The captions are formatted as for AGU journals.
%<egs> % The captions are formatted as for EGS journals.
%<*!209>
 %
 % Options with LaTeX2e:
 %   printfigures  - prints the figures at the end of the article, (is
 %                   like issuing the \printfigures command)
 %   figmark       - turns on the markers for figures and tables in the text,
 %                   (is like issuing \figmarkon)
 %   figon/off     - activates or deactivates the whole procedure (is like
 %                   (issuing \figcapson or \figcapsoff). Default=on.
 %   mylang        - (default) leaves explicit text (e.g. `Figure Captions'
 %                   as is, or if undefined, makes them English
 %   english,american,german,austrian,french,esperanto - changes explicit
 %                   texts accordingly
 %   blank         - makes explicit texts empty.
%</!209>
% \end{verbatim}
%\iffalse
 %-----------------------------------------------------------
%</package&!subpack>
%\fi
%\end{small}
%
% \section{Introduction}
% Often when producing manuscripts for submission to a journal, it is
% required that the figure captions be listed at the end on a separate
% page, and also that tables be put at the end too. Then when the
% manuscript is ready and camera-ready copy, or a preprint, is to be
% generated, one has to move them all back to the proper positions in the
% paper.
%
% This style alleviates this problem. The \texttt{figure} and \texttt{table}
% environments are placed in the text as they should be for the preprint or
% camera-ready copy, but the tables actually are printed at the end. The
% figures are not printed at all, but their captions are listed on a
% separate page at the end. Optionally, the figures themselves may be
% printed at the very end. This last only makes sense if there is something
% in the figures, i.e., they have been produced with \texttt{picture} or are
% imported graphics.
%
% \section{Invoking the Package}
% The macros in this package are included in the main document
% with the |\usepackage| command of \LaTeXe,
% \begin{quote}
% |\documentclass[..]{...}|\\
% |\usepackage[|\emph{options}|]{|\texttt{\filename}|}|
% \end{quote}
% where the possible \emph{options} are described below.
%
% Alternatively, the name of the package is added as an option to the
% |\documentstyle| command in \LaTeX~2.09 compatibility mode, as
% \begin{quote}
% |\documentstyle[..|\texttt{\filename}|..]{...}|
% \end{quote}
%
% It may only be used for \texttt{article}, or an article-like main class.
% That is, for one that does not contain the |\chapter| level of
% sectioning.
%
% The order in which other packages are loaded is important for certain
% features. If my package
% \texttt{sublabel} is included, then it must come before \thestyle.
% Furthermore, \thestyle{} adds to the existing definition of
% |\appendix|, so that if the author has any packages that alter this
% definition, they must come before \thestyle. Clearly, |\appendix| may
% not be redefined afterwards.
%
% \section{Using the Package}
% \DescribeMacro{\figcapson}\DescribeMacro{\figcapsoff}
% The macro package in \thestyle{} operates pretty much automatically.
% The whole thing may be turned on and off with the commands |\figcapson|
% and |\figcapsoff|. The default is \meta{on}. One might want to
% control the placement of figures and tables with this flag rather than by
% adding and removing the option from the |\documentclass| command.
%
% Alternatively, the \LaTeXe{} options \texttt{figon} and \texttt{figoff}
% have the same effect, with \texttt{figon} being the default.
%
% \DescribeMacro{\printfigures}
% The only other means of interacting with the macros is with the command
% |\printfigures|, which, when given anywhere in the text, enables the
% figures themselves to be output at the very end of the paper. Without
% this, only the captions are listed. With it, both captions and figures
% are output.
%
% The \LaTeXe{} option \texttt{printfigures} in |\usepackage| is
% equivalent to issuing the command |\printfigures| in the text.
%
% \DescribeMacro{\figmarkon}
% \DescribeMacro{\figmarkoff}
% Another option is to put marginal notes into the text at the place
% where the float environment is entered. This is useful for camera-ready
% copy that will be cut-and-pasted together to indicate where the figures
% and tables should appear. The commands |\figmarkon| and |\figmarkoff|
% control this feature, with the default being \meta{off}.
%
% The \LaTeXe{} option \texttt{figmark} in |\usepackage| sets this
% default to \meta{on}; in other words, it is equivalent to issuing
% |\figmarkon| in the text.
%
% \DescribeMacro{\figurecapname}
% \DescribeMacro{\tablepagename}
% \DescribeMacro{\figurepagename}
% The text that is written as header at the top of the special pages is
% defined in three commands |\figurecapname|, |\tablepagename|, and
% |\figurepagename|. They default to English text, but may be redefined to
% other languages, or suppressed altogether, with |\renewcommand| or with
% \LaTeXe{} options (see page~\pageref{names}).
%
% \section{How it Works}
% The contents of all the \texttt{figure} and \texttt{table} environments are
% written to auxiliary files {\tt.lof} and {\tt.lot} respectively, and then
% these are read in again at the end of the paper. Since these auxiliary
% files are normally used to write information for the lists of figures and
% tables, this capability is lost. However, it is not likely that one wants
% such lists, or even a table of contents, in a manuscript. In fact, the
% commands |\tableofcontents|, |\listoffigures|, |\listoftables| are turned
% off (they issue a warning message).
%
% If you really do need tables of contents, then see the extra features
% below.
%
% \subsection{With the \texttt{longtable} Package}
% This package may optionally be used with the \texttt{longtable} environment defined 
% in the package of the same name. Since such tables are normally long, i.e.\ 
% over a page, the list of tables at the back will always start a new page for 
% each of these. 
% 
% For preprints, when the tables are not moved to the back (|\figcapsoff|), it 
% makes sense to put the \texttt{longtable} environment inside the |\afterpage| 
% command (from the \texttt{afterpage} package). However, with |\figcapson|, 
% and the table is move, this is useless. In this case, the |\afterpage| 
% command is deactivated. One should realize this in case it is used for other 
% purposes.
% 
% \subsection{As Module to Journal-Specific Styles}
% Although \thestyle{} is meant to be an all-purpose bibliographic style
% \emph{package}, it may also be incorporated as a module to other
% packages for specific journals. In this case, many of the general features may
% be left off. This is allowed for with \texttt{docstrip} options that not
% only leave off certain codelines, but also include extra ones. So far,
% options exist for
% \begin{description}
% \item[\ttfamily egs] for \textsl{European Geophysical Society} journals.
% \item[\ttfamily agu] for \textsl{American Geophysical Union} journals.
% \end{description}
%
% Previous options \texttt{jgr} and \texttt{grl} have become obsolete due
% to revisions in these journals; they have been replaced by the more
% general \texttt{agu} option.
%
% \section{\LaTeXe{} Options}
% Under \LaTeXe, \emph{options} may be added to the |\usepackage| command
% that loads the package. Available options for \thestyle{} set certain
% control flags, thus replacing the equivalent commands, or select the
% language for the texts that are printed by |\figurecapname|,
% |\tablepagename|, and |\figurepagename|.
% \begin{description}
% \item[\ttfamily figon] (default) activates the whole procedure of moving
%     figures and tables to the back of the article, (same as
%     |\figcapson|);
%
% \item[\ttfamily figoff] deactivates the whole procedure, (same as
%     |\figcapsoff|);
%
% \item[\ttfamily printfigures] allows the figures themselves and not just
%     their captions to be output at the very end, in addition to the
%     caption page, (same as |\printfigures|); by default this is not done;
%
% \item[\ttfamily figmark] enables marking of figure and table environments
%     in the text with marginal notes; (same as |\figmarkon|);
%
% \item[\ttfamily mylang] (default) leaves the three \texttt{name} commands
%     as they are; however if they are not defined at all, then they are
%     given English values; since these name commands are not standard, one
%     cannot expect them to be set by other language adaption packages;
%
% \item[\ttfamily english, american, german, austrian, french, esperanto]
%     \label{names}
%     set the \texttt{name} commands to the translation in the
%     corresponding language, overwriting any previous definitions;
%
% \item[\ttfamily blank] sets the text of |\figurecapname|,
%     |\tablepagename|, and |\figurepagename| to nothing.
% \end{description}
%
% \StopEventually{\PrintIndex\PrintChanges}
%
% \section{Options with \texttt{docstrip}}
% The source \texttt{.dtx} file is meant to be processed with
% \texttt{docstrip}, for which a number of options are available:
% \begin{description}
% \item[\ttfamily plates] permits \texttt{plate} and \texttt{plate*}
%    environments to be treated just like \texttt{figure} and
%    \texttt{figure*}; the contents are written to the same auxiliary file
%    and the captions are mixed with those of the figures. The environments
%    must already exist though, for with this option the coding is included
%    to treat plates like figures, but it does not define such plate
%    environments.
%
% \item[\ttfamily longtab] permits \texttt{longtable} environment from the
%    \texttt{longtable} tools package to be treated too (\LaTeXe\ only).
%
% \item[\ttfamily sublab] adds coding to enable the \thestyle{} macros to
%    function with my other option \texttt{sublabel}, which permits objects
%    to be numbered 4{\it a}, 4{\it b}, etc. This coding may always be
%    included, even if \texttt{sublabel} is not invoked; the converse is
%    not true: if \texttt{sublabel} is present, then this coding must also
%    be there, and \texttt{sublabel} must precede \thestyle{} in the list
%    of options.
%
% \item[\ttfamily toc] allows auxiliary files with the extensions {\tt.pof}
%    and {\tt.pot} so that there is no conflict with the tables of contents
%    files. Thus |\tableofcontents|, |\listoffigures|, |\listoftables|, and
%    possibly |\listofplates| may be used as normal.
%
% \item[\ttfamily package] to produce a \texttt{.sty} package file with most
%    comments removed;
%
% \item[\ttfamily 209] for a style option file that will run under the older
%     \LaTeX~2.09;
%
% \item[\ttfamily subpack] (together with \texttt{package}) for coding that
%    is to be included inside a larger package; even more comments are
%    removed, as well as \LaTeXe{} option handling and identification;
%
% \item[\ttfamily agu] (with \texttt{package,subpack}) for special coding
%    for the \textsl{AGU$^{++}$} package;
%
% \item[\ttfamily egs] (with \texttt{package,subpack}) for special
%    coding for the \textsl{EGS} package;
%
% \item[\ttfamily driver] to produce a driver \texttt{.drv} file that will
%     print out the documentation under \LaTeXe. The documentation cannot
%     be printed under \LaTeX~2.09.
%
% \end{description}
% The source file \texttt{\filename.dtx} is itself a driver file and can
% be processed directly by \LaTeXe.
%
% \section{The Coding}
% This section presents and explains the actual coding of the macros.
% It is nested between |%<*package>| and |%</package>|, which
% are indicators to \texttt{docstrip} that this coding belongs to the package
% file.
%
% The \texttt{docstrip} option |<subpack>| should only be called if the
% coding is to be included as part of another package, in which case the
% announcement text and \LaTeXe{} options are suppressed.
%
% An inferior version of this coding is provided for running as a
% style file under \LaTeX~2.09. Code lines belonging to this are
% indicated with guard |<209>|; those for LaTeXe{} only with |<!209>|.
%
% Now test that the main style is article-like, i.e., it has no chapters.
% This is because the figure caption list as well as the tables page are output
% under a |\section*|, and because of the relabelling of figures, tables,
% equations within appendices. (Maybe someday this will be changed.)
%    \begin{macrocode}
%<*package>
\@ifundefined{chapter}{}{%
%<209>    \@latexerr
%<!209>    \PackageError{figcaps}
     {`figcaps' may only be used with article-like classes}
     {There is no help. You just cannot use `figcaps'}}
%    \end{macrocode}
%
% \begin{macro}{\iffigcaps}
% \begin{macro}{\iffigmark}
% \changes{4.1}{1993 Oct 18}{Add flag to switch marginal notes on/off}
% \begin{macro}{\if@figpage}
% Define a few flags that control the operations, such as whether the whole
% procedure is turned on, whether figures and tables are marked in the text
% where they should appear, and whether a page of figures (not just
% captions) is output. These are set by commands defined below and/or by
% \LaTeXe options.
%    \begin{macrocode}
\newif\iffigcaps \figcapstrue
\newif\iffigmark \figmarkfalse
\newif\if@figpage \@figpagefalse
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \subsection{Setting Defaults and \LaTeXe{} Options}
% \begin{macro}{\figurecapname}
% \begin{macro}{\tablepagename}
% \begin{macro}{\figurepagename}
% Define explicit text with name commands that may be changed by language
% adaptations. Since these are non-standard, it is unlikely that they
% already exist, but nevertheless, it does not hurt to assume that they do.
%    \begin{macrocode}
%<*subpack|209>
\@ifundefined{figurecapname}{\def\figurecapname{Figure Captions}}{}
\@ifundefined{tablepagename}{\def\tablepagename{Tables}}{}
\@ifundefined{figurepagename}{\def\figurepagename{Figures}}{}
%</subpack|209>
%    \end{macrocode}
%
% \begin{macro}{\DeclareOption}
% \changes{4.3}{1994 May 19}{Add language options for \LaTeXe}
% In \LaTeXe, the initial values of these commands can be set with options
% to the |\usepackage| command. They are processed in the order given, not
% in the order defined (starred version of |\ProcessOptions|).
%    \begin{macrocode}
%<*!subpack&!209>
\DeclareOption{english}{\def\figurecapname{Figure Captions}%
                        \def\tablepagename{Tables}%
                        \def\figurepagename{Figures}}
\DeclareOption{american}{\ExecuteOptions{english}}
\DeclareOption{german}{\def\figurecapname{Untertiteln der Abbildungen}%
                        \def\tablepagename{Tabellen}%
                        \def\figurepagename{Abbildungen}}
\DeclareOption{austrian}{\ExecuteOptions{german}}
\DeclareOption{french}{\def\figurecapname{Titres des Figures}%
                        \def\tablepagename{Tableaux}%
                        \def\figurepagename{Figures}}
\DeclareOption{esperanto}{\def\figurecapname{Titroj de la Figuroj}%
                        \def\tablepagename{Tabeloj}%
                        \def\figurepagename{Figuroj}}
\DeclareOption{blank}{\def\figurecapname{}%
                        \def\tablepagename{}%
                        \def\figurepagename{}}
\DeclareOption{blank}{\def\appendixname{}}
\DeclareOption{mylang}{\providecommand{\figurecapname}{Figure Captions}%
                       \providecommand{\tablepagename}{Tables}%
                       \providecommand{\figurepagename}{Figures}}
\DeclareOption{figmark}{\figmarktrue}
\DeclareOption{printfigures}{\@figpagetrue}
\DeclareOption{figon}{\figcapstrue}
\DeclareOption{figoff}{\figcapsfalse}
\ExecuteOptions{mylang,figon}
\ProcessOptions*
%</!subpack&!209>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \subsection{Low Level Routines --- the Tricky Bits}
% The way in which this routine is to work is as follows: the float
% commands |\figure|, |\table|, and optionally |\plate| are redefined so
% that they write everything up to the corresponding |\end| command to an
% auxiliary file. These files have extensions {\tt.lof} (for figures and
% plates) and {\tt.lot} (for tables). The entire contents must be written
% literally, that is as verbatim, without any expansion. The terminal
% |\end| text must also be literal.
%
% The actual internal commands that will do this are called |\@vfig|,
% |\@vsfig|, etc., where the second variant is for the starred version of
% the float command. These must be defined in such a way that |\|, |{|,
% and |}| are temporarily characters (catcode=12); their functionality is
% taken over by \verb!|!, |[|, and |]|. Furthermore, the carriage return
% |^^M| must also be made active so that it may be used as a character
% within the template of the definitions. Its function is to separate the
% individual lines of text. It must be active, not `other', because
% |\set@literal| (see below) will give it a definition of |\relax|. (It
% probably cannot be made `other' anyway because it is unprintable.)
%
% Switch the category codes, within a group, of course, to keep them local.
%    \begin{macrocode}
\begingroup
  \catcode `|=0 \catcode `[= 1
  \catcode`]=2 \catcode `\{=12 \catcode `\}=12
  \catcode`\^^M=13 \catcode`\\=12 %
%    \end{macrocode}
% \begin{macro}{\@vfig}
% Now define the true working commands. Take |\@vfig| as prototype for all
% the others. Its arguement is everything up to the literal text
% |\end{figure}|. This argument is expanded and used as argument to
% |\writelof| with an extra line termination (|^^M|) and the text
% |\end{figure}| added. The function |\writelof| dissects its argument into
% individual lines (as indicated by the active |^^M|) and writes them to
% the {\tt.lof} file, until it finds a line of text equal to |\@term|.
% Hence, this termination command is first defined as |\end{figure}|.
% Finally, |\@vfig| issues the \emph{command} (not the literal text)
% |\end{figure}| in order to close the \texttt{figure} environment. This last
% command appears in the definition as \verb!|end[figure]! because of the
% altered category codes.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
|long|gdef|@vfig#1\end{figure}[|def|@term[\end{figure}]%
          |expandafter|writelof#1^^M\end{figure}^^M|end[figure]]%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@vsfig}
% The equivalent function for \texttt{figure*} is now defined.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
|long|gdef|@vsfig#1\end{figure*}[|def|@term[\end{figure*}]%
          |expandafter|writelof#1^^M\end{figure*}^^M|end[figure*]]%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@vtab}
% \begin{macro}{\@vstab}
% Next, the same functions for tables. Here |\writelot| is used instead
% of |\writelof| because the text goes to a different auxiliary file.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
|long|gdef|@vtab#1\end{table}[|def|@term[\end{table}]%
          |expandafter|writelot#1^^M\end{table}^^M|end[table]]%
|long|gdef|@vstab#1\end{table*}[|def|@term[\end{table*}]%
          |expandafter|writelot#1^^M\end{table*}^^M|end[table*]]%
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\@vltab}
% \changes{4.6}{1998 Sep 14}{Add macro for \texttt{longtable} package}
% For use with the \texttt{longtable} package and its environment of the same 
% name, need special coding. This environment is never put into a 
% \texttt{figure} environment, but rather is used on its own.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
%<*longtab&!209>
 |long|gdef|@vltab#1\end{longtable}[|def|@term[\end{longtable}]%
           |expandafter|writelot#1^^M\end{longtable}^^M|end[longtable]]%
%</longtab&!209>
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\@vpla}
% \begin{macro}{\@vspla}
% For the event that a \texttt{plate} environment is also present (as in
% \textsl{AGU}, for example) we must include two more such functions. These
% operate exactly like \texttt{figure}, even using |\writelof| instead of
% |\writelot|.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
%<*plates>
|long|gdef|@vpla#1\end{plate}[|def|@term[\end{plate}]%
          |expandafter|writelof#1^^M\end{plate}^^M|end[plate]]%
|long|gdef|@vspla#1\end{plate*}[|def|@term[\end{plate*}]%
          |expandafter|writelof#1^^M\end{plate*}^^M|end[plate*]]%
%</plates>
%    \end{macrocode}
% \end{macro}\end{macro}
% \begin{macro}{\@vptab}
% \changes{4.5f}{1997 Mar 16}{For AGU only}
% In the AGU supplement, there is an additional \texttt{table} environment
% called \texttt{planotable}. This must then be provided for here. It has
% no starred version.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
%<agu> |long|gdef|@vptab#1\end{planotable}[|def|@term[\end{planotable}]%
%<agu>           |expandafter|writelot#1^^M\end{planotable}^^M|end[planotable]]%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@fcaponly}
% \changes{4.1}{1993 Nov 20}{Remove caption-only commands for AGU}
% \begin{macro}{\@feject}
% \begin{macro}{\@pcaponly}
% \begin{macro}{\@peject}
% Some more special commands are needed with literal commands in their
% templates. These are used to print only the captions when the figures
% auxiliary file is reread in. First |\@fcaponly| reads everything up to
% the |\caption| and throws it away. Then |\@feject| removes all text from
% its current position (which will be right after |\caption|) to the end of
% the \texttt{figure} environment. Similar functions exist for \texttt{plate},
% but not for \texttt{table}, since tables are always reproduced in full.
%
% The AGU supplement does not make use of these commands, since it works
% in a different way.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
%<*!agu>
|long|gdef|@fcaponly#1\caption[|endgroup|@fcaption]%
|long|gdef|@feject#1\end{figure}[|end[figure]]%
%<*plates>
|long|gdef|@pcaponly#1\caption[|endgroup|@pcaption]%
|long|gdef|@peject#1\end{plate}[|end[plate]]%
%</plates>
%</!agu>
  |endgroup
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
% Here the category codes are restored to their normal values with the
% ending of the group. Note that each of the above lines must have |%| at
% the end to avoid \meta{end-of-line}, which is active.
%
% \begin{macro}{\FC@writefile}
% \changes{4.4}{1995 Jan 8}{Add macro, equal to old definition of standard
%      \cmd{\@writefile}}
% The release of \LaTeX\ on 1995/12/01 changed the internal definition
% of |\@writefile| such as to make it robuster: the text is written literally
% to the file. This means that my |\string\begin{figure}| is written as
% |\string \begin {figure}| instead of |\begin{figure}|. To get around this,
% keeping capatibility with older versions, and not interfering with
% other uses of |\@writefile|, I add may own version, equal to the
% older definition.
%    \begin{macrocode}
\long\def\FC@writefile#1#2{\@ifundefined{tf@#1}{}{%
  \immediate\write\csname tf@#1\endcsname{#2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\writelof}
% \begin{macro}{\writelot}
% \changes{4.0}{1993 Oct 12}{Add \texttt{toc} option to determine extension
%       of auxiliary files. Tables of contents were previously allowed, now
%       only optionally allowed.}
% Now, the command that write the text to the auxiliary file |\writelof|
% takes the text one line at a time, checks if it
% equals |\@term|; if not, it is output to {\tt.lof} and |\writelof| is
% called again; if yes, the routine comes to an end. The
% \meta{end-of-line} |^^M| must be made active again at this stage so that
% it has the correct category code in the definition. For tables, the
% corresponding |\writelot| is analogous.
%
% Before we do this, however, it should be pointed out that these auxiliary
% files are normally used for lists of figures and tables information. Thus
% they may not be used for this purpose. Normally, one does not have such
% tables of contents in an article, but if that should be required, then
% we provide a \texttt{docstrip} option \texttt{toc} to change the extensions
% to {\tt.pof} and {\tt.pot}.
%    \begin{macrocode}
%<*!toc>
\def\lof{lof} \def\lot{lot}
%</!toc>
%<toc>\def\lof{pof} \def\lot{pot}

{\catcode`\^^M=13%
  \long\gdef\writelof#1^^M{\def\@tempb{#1}%
      \ifx\@tempb\@term\let\@tempa\relax\else
      \if@filesw\FC@writefile{pof}{#1}\fi\let\@tempa\writelof\fi \@tempa}
  \long\gdef\writelot#1^^M{\def\@tempb{#1}%
      \ifx\@tempb\@term\let\@tempa\relax\else
      \if@filesw\FC@writefile{pot}{#1}\fi\let\@tempa\writelot\fi \@tempa}
}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \subsection{Caption Commands}
% \begin{macro}{\@fcaption}
% \changes{4.1}{1993 Nov 20}{Remove caption-only commands for AGU}
% \begin{macro}{\@@fcapopt}
% \begin{macro}{\@@fcap}
% Here are the modified |\caption| commands for printing only the captions.
% In |\@figurecaps|, the command |\@fcaponly| is called at the start of
% a \texttt{figure} environment, which ejects all text up to the |\caption|
% command, and then calls |\@fcaption|. This then selects |\@@fcap| or
% |\@@fcapopt| depending on the presence of the optional argument. Both do
% essentially the same thing: they call the true caption command
% |\@caption| to process the argument, and then call |\@feject| to remove
% the remaining text in the \texttt{figure} environment. Note: this is only
% done when the auxiliary {\tt.lof} file is being read in to produce a list
% of captions.
%    \begin{macrocode}
%<*!agu>
\def\@fcaption{\refstepcounter\@captype \@ifnextchar[{\@@fcapopt}{\@@fcap}}
\def\@@fcapopt[#1]#2{\@caption\@captype[]{#2}\begingroup\set@literal\@feject}
\def\@@fcap#1{\@caption\@captype[]{#1}\begingroup\set@literal\@feject}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\@pcaption}
% \begin{macro}{\@@pcapopt}
% \begin{macro}{\@@pcap}
% The same thing for plates.
%    \begin{macrocode}
%<*plates>
\def\@pcaption{\refstepcounter\@captype \@ifnextchar[{\@@pcapopt}{\@@pcap}}
\def\@@pcapopt[#1]#2{\@caption\@captype[]{#2}\begingroup\set@literal\@peject}
\def\@@pcap#1{\@caption\@captype[]{#1}\begingroup\set@literal\@peject}
%</plates>
%</!agu>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \subsection{The High Level Commands for Float Environments}
% \begin{macro}{\figcapson}
% \changes{4.3}{1994 May 19}{Add on/off commands to set whole thing
%            on/off}
% \begin{macro}{\figcapsoff}
% \changes{4.3}{1994 May 19}{Add on/off commands to set whole thing
%            on/off}
% Here are the new definitions of the figure and table, which are to
% be executed in the main text where the environments are entered. These
% new definitions are only in effect if the flag \texttt{figcaps} is
% \meta{true}, otherwise the original definitions hold. This flag allows
% the style to be input in the |\documentstyle| line, or with
% |\usepackage|, even if it is not yet, or no longer, wanted.
%    \begin{macrocode}
\def\figcapson{\figcapstrue}
\def\figcapsoff{\figcapsfalse}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\figmarkon}
% \changes{4.3}{1994 May 19}{Add on/off commands to set flag
%          \cmd{\iffigmark}, consistent with older manuals!}
% \begin{macro}{\figmarkoff}
% \changes{4.3}{1994 May 19}{Add on/off commands to set flag
%          \cmd{\iffigmark}, consistent with older manuals!}
% \changes{4.3c}{1994 Nov 30}{Correct very bad bug!}
% Another flag allows the figures and tables in the text to be marked with
% a marginal note to indicate where they are first referred to. Since this is
% only necessary for cut-and-paste procedures, the default is to have the
% flag set \meta{false} unless the \LaTeXe{} option \texttt{figmark} has
% been given. These commands set the state of the flag.
%    \begin{macrocode}
\def\figmarkon{\figmarktrue}
\def\figmarkoff{\figmarkfalse}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\figure}
% \changes{4.1}{1993 Oct 18}{Add marginal note with \cmd{\iffigmark}}
% \changes{4.1}{1993 Oct 29}{Add \cmd{\@zfigure} to bring
%                   float out of the if clause}
% \changes{4.5}{1996 Jan 10}{Test for \cs{ifFC@appendix}}
% In the new definitions, the
% necessary auxiliary file is opened, the counter is stepped, the caption
% type determined (these are normal functions of the float routine), and
% then |\begin{figure}| is written literally to the auxiliary file.
% Finally, |\@vfig|, or equivalent, is called to process the rest of the
% environment's contents.
%
% If |figcaps| is \meta{false}, then the normal |\@float| command is used.
%    \begin{macrocode}
\def\figure{\iffigcaps \let\@tempb=\@zfigure \else \let\@tempb=\@float\fi
  \@tempb{figure}}
\def\@zfigure#1{\begingroup\set@literal\@ifnextchar[{\@figure}{\@figure[]}}
\def\@figure[#1]{\@ifundefined{tf@pof}{\newwrite\tf@pof
     \if@filesw\immediate\openout\tf@pof\jobname.\lof\relax
     \ifFC@appendix\FC@writefile{pof}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{figure}\iffigmark\marginpar{\fbox{\fnum@figure}}\fi
  \def\@captype{figure}\if@filesw\FC@writefile{pof}{\string\begin{figure}}\fi
  \@vfig}

\def\endfigure{\iffigcaps
    \endgroup\if@filesw\FC@writefile{pof}{\string\end{figure}}\fi\else
    \end@float\fi}

\@namedef{figure*}{\iffigcaps \let\@tempb=\@zsfigure \else
  \let\@tempb=\@dblfloat\fi \@tempb{figure}}
\def\@zsfigure#1{\begingroup\set@literal\@ifnextchar[{\@sfigure}{\@sfigure[]}}
\def\@sfigure[#1]{\@ifundefined{tf@pof}{\newwrite\tf@pof
     \if@filesw\immediate\openout\tf@pof\jobname.\lof\relax
     \ifFC@appendix\FC@writefile{pof}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{figure}\iffigmark\marginpar{\fbox{\fnum@figure}}\fi
  \def\@captype{figure}\if@filesw\FC@writefile{pof}{\string\begin{figure}}\fi
  \@vsfig}

\@namedef{endfigure*}{\iffigcaps\endfigure\else\end@dblfloat\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\plate}
% \changes{3.2}{1993 Feb 9}{Add possibility of plate environments}
% \changes{4.1}{1993 Oct 18}{Add marginal note with \cmd{\iffigmark}}
% \changes{4.1}{1993 Oct 29}{Add \cmd{\@zfigure} to bring
%                   float out of the if clause}
% \changes{4.5}{1996 Jan 10}{Test for \cs{ifFC@appendix}}
%  Plates are defined in the same way, and write to the same auxiliary
% file as figures. We must first test if there really is a plate counter,
% otherwise we will have trouble later.
%    \begin{macrocode}
%<*plates>
\@ifundefined{c@plate}{\newcounter{plate}}{}

\def\plate{\iffigcaps \let\@tempb=\@zplate \else \let\@tempb=\@float\fi
  \@tempb{plate}}
\def\@zplate#1{\begingroup\set@literal\@ifnextchar[{\@plate}{\@plate[]}}
\def\@plate[#1]{\@ifundefined{tf@pof}{\newwrite\tf@pof
     \if@filesw\immediate\openout\tf@pof\jobname.\lof\relax
     \ifFC@appendix\FC@writefile{pof}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{plate}\iffigmark\marginpar{\fbox{\fnum@plate}}\fi
  \def\@captype{plate}\if@filesw\FC@writefile{pof}{\string\begin{plate}}\fi
  \@vpla}

\def\endplate{\iffigcaps
    \endgroup\if@filesw\FC@writefile{pof}{\string\end{plate}}\fi\else
    \end@float\fi}

\@namedef{plate*}{\iffigcaps \let\@tempb=\@zsplate \else
  \let\@tempb=\@dblfloat\fi \@tempb{plate}}
\def\@zsplate#1{\begingroup\set@literal\@ifnextchar[{\@splate}{\@splate[]}}
\def\@splate[#1]{\@ifundefined{tf@pof}{\newwrite\tf@pof
     \if@filesw\immediate\openout\tf@pof\jobname.\lof\relax
     \ifFC@appendix\FC@writefile{pof}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{plate}\iffigmark\marginpar{\fbox{\fnum@plate}}\fi
  \def\@captype{plate}\if@filesw\FC@writefile{pof}{\string\begin{plate}}\fi
  \@vspla}

\@namedef{endplate*}{\iffigcaps\endplate\else\end@dblfloat\fi}
%</plates>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\table}
% \changes{4.1}{1993 Oct 18}{Add marginal note with \cmd{\iffigmark}}
% \changes{4.1}{1993 Oct 29}{Add \cmd{\@zfigure} to bring
%                   float out of the if clause}
% \changes{4.5}{1996 Jan 10}{Test for \cs{ifFC@appendix}}
% \changes{4.5d}{1996 Aug 20}{Add \cs{spew@tblnotes} for AGU}
% The table environments are made up the same way, but write to {\tt.lot}
% instead of {\tt.lof}.
%    \begin{macrocode}
\def\table{\iffigcaps \let\@tempb=\@ztable \else \let\@tempb=\@float\fi
  \@tempb{table}}
\def\@ztable#1{\begingroup\set@literal\@ifnextchar[{\@table}{\@table[]}}
\def\@table[#1]{\@ifundefined{tf@pot}{\newwrite\tf@pot
     \if@filesw\immediate\openout\tf@pot\jobname.\lot\relax
     \ifFC@appendix\FC@writefile{pot}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{table}\iffigmark\marginpar{\fbox{\fnum@table}}\fi
  \def\@captype{table}\if@filesw\FC@writefile{pot}{\string\begin{table}}\fi
  \@vtab}

\def\endtable{\iffigcaps
   \endgroup\if@filesw\FC@writefile{pot}{\string\end{table}}\fi\else
%<agu>   \spew@tblnotes
   \end@float\fi}

\@namedef{table*}{\iffigcaps \let\@tempb=\@zstable \else
  \let\@tempb=\@dblfloat\fi \@tempb{table}}
\def\@zstable#1{\begingroup\set@literal\@ifnextchar[{\@stable}{\@stable[]}}
\def\@stable[#1]{\@ifundefined{tf@pot}{\newwrite\tf@pot
     \if@filesw\immediate\openout\tf@pot\jobname.\lot\relax
     \ifFC@appendix\FC@writefile{pot}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{table}\iffigmark\marginpar{\fbox{\fnum@table}}\fi
  \def\@captype{table}\if@filesw\FC@writefile{pot}
    {\string\begin{table}}%
    \fi\@vstab}

\@namedef{endtable*}{\iffigcaps\endtable\else
%<agu>   \spew@tblnotes
   \end@dblfloat\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\longtable}
% \changes{4.6}{1998 Sep 14}{Add macro for \texttt{longtable} package}
% For the \texttt{longtable} package, add environment of same name.
% This coding to be added after the preamble so that the order of loading
% \thestyle{} and \texttt{longtable} is unimportant. The \cs{LT@makecaptions}
% is fixed to use the \cs{\@makecaptions} format that is current.
% Since it makes sense to use the \texttt{longtable} environment with the 
% \texttt{afterpage} command, but not when the table is moved to the back,
% switch off that command when moving is active.
%    \begin{macrocode}
%<*longtab&!209>
\AtBeginDocument{\let\FC@ltab=\longtable                                       
  \let\FC@endltab=\endlongtable
\def\longtable{\iffigcaps \let\@tempb=\@ltable \else 
  \let\@tempb=\FC@ltab\fi \@tempb}
\def\@ltable{\begingroup\set@literal
     \@ifundefined{tf@pot}{\newwrite\tf@pot
     \if@filesw\immediate\openout\tf@pot\jobname.\lot\relax
     \ifFC@appendix\FC@writefile{pot}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{table}\iffigmark\marginpar{\fbox{\fnum@table}}\fi
  \def\@captype{table}\if@filesw\FC@writefile{pot}
     {\string\begin{longtable}}\fi \@vltab}
\def\endlongtable{\iffigcaps
   \endgroup\if@filesw\FC@writefile{pot}{\string\end{longtable}}\fi\else
   \FC@endltab\fi}
\@ifpackageloaded{longtable}{%
\def\LT@makecaption#1#2#3{%
  \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
   \@makecaption{#1{#2}}{#3}%
    \endgraf\vskip\baselineskip}%
  \hss}}}}{}
\@ifpackageloaded{afterpage}{%
 \let\FC@afterpage=\afterpage
 \def\afterpage{\iffigcaps \let\@tempb\relax \else \let\@tempb\FC@afterpage\fi
   \@tempb}}{}
  }
%</longtab&!209>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\planotable}
% \changes{4.1}{1993 Nov 20}{Add for AGU supplement}
% \changes{4.5}{1996 Jan 10}{Test for \cs{ifFC@appendix}}
% For the AGU supplement, we need to add the environment \texttt{planotable}.
%    \begin{macrocode}
%<agu>\let\aguplano=\planotable
%<agu>\let\endaguplano=\endplanotable
%<agu>
%<agu>\def\planotable{\iffigcaps \let\@tempb=\@ptable \else
%<agu>  \let\@tempb=\aguplano\fi \@tempb}
%<agu>\def\@ptable{\begingroup\set@literal
%<agu>     \@ifundefined{tf@pot}{\newwrite\tf@pot
%<agu>     \if@filesw\immediate\openout\tf@pot\jobname.\lot\relax
%<agu>     \ifFC@appendix\FC@writefile{pot}{\string\doappendix}\fi\fi}{}%
%<agu>  \refstepcounter{table}\iffigmark\marginpar{\fbox{\fnum@table}}\fi
%<agu>  \def\@captype{table}\if@filesw\FC@writefile{pot}
%<agu>     {\string\begin{planotable}}\fi \@vptab}
%<agu>
%<agu>\def\endplanotable{\iffigcaps
%<agu>   \endgroup\if@filesw\FC@writefile{pot}{\string\end{planotable}}\fi\else
%<agu>   \endaguplano\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tableofcontents}
% \changes{4.4}{1995 Jan 8}{Use \LaTeXe{} warning command}
% \begin{macro}{\listoffigures}
% \changes{4.4}{1995 Jan 8}{Use \LaTeXe{} warning command}
% \begin{macro}{\listoftables}
% \changes{4.4}{1995 Jan 8}{Use \LaTeXe{} warning command}
% \begin{macro}{\listofplates}
% \changes{4.4}{1995 Jan 8}{Use \LaTeXe{} warning command}
% Unless the \texttt{docstrip} option \texttt{toc} has been selected, turn off
% the tables of contents commands, because they will interfere with the
% writing of the auxiliary files.
%    \begin{macrocode}
%<*!toc>
\def\tableofcontents{%
%<209>  \@@warning
%<!209>  \PackageWarningNoLine{figcaps}
   {Ignored: \protect\tableofcontents\space command}}
\def\listoffigures{%
%<209>  \@@warning
%<!209>  \PackageWarningNoLine{figcaps}
   {Ignored: \protect\listoffigures\space command}}
\def\listoftables{%
%<209>  \@@warning
%<!209>  \PackageWarningNoLine{figcaps}
   {Ignored: \protect\listoftables\space command}}
%<*plates>
\def\listofplates{%
%<209>  \@@warning
%<!209>  \PackageWarningNoLine{figcaps}
   {Ignored: \protect\listofplates\space command}}
%</plates>
\def\addtocontents#1#2{\relax}
\def\addcontentsline#1#2#3{\relax}
%</!toc>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\set@literal}
% \changes{3.1}{1992 Oct 14}{Use {\tt\symbol{94}\symbol{94}M!=\protect\bslash
%    relax} in place of {\tt\protect\bslash obeylines} which caused problems
%    with floats inside paragraphs because then
%    {\tt\symbol{94}\symbol{94}M!=\protect\bslash par}}
% Here is the command that makes all characters literal. It especially
% makes |^^M| to be active, defined to be |\relax|. In earlier versions,
% |\obeylines| was used instead, but that sets |^^M| to |\par| and there
% were problems when the floats appeared in the middle of a paragraph.
%    \begin{macrocode}
{\catcode`\^^M=\active \gdef\cr@relax{\catcode`\^^M=\active \let^^M=\relax}}
\def\set@literal{\cr@relax \let\do\@makeother\dospecials}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Commands to Put Saved Text at the End}
% \begin{macro}{\@figurecaps}
% \changes{4.1}{1993 Nov 20}{Revisions for AGU supplement}
% \changes{4.3a}{1994 Jun 6}{Zero \cmd{\parindent} for AGU}
% \changes{4.5e}{1996 Oct 17}{Zero \cmd{\parindent} generally}
% Now define the routine to read in the {\tt.lof} auxiliary file with the
% purpose of listing only the captions. Since the list is to be made under
% a |\section*|, there may be trouble if |\appendix| has been called
% already. The redefined |\section*| command may print out |\appendixname|.
% Thus this name is set to blank if it exists.
%
% The |\reset@figtab| command is called to reset the figure, plate, table
% counters to zero. This is because they are to go through their automatic
% sequence once more as they are read in. Actually, this is not necessary,
% since the |\caption|s were never really called in the text part. However,
% it is better to be certain that the counters are where we expect them.
%
% An entry is made to the running heads and to the table of contents.
% The \texttt{figure} environment is redefined yet again to make use of
% |\@fcaponly|, and |\addcontentsline| is set to swallow its arguments.
% This latter is called by the |\@caption| command and we do not want the
% entries to be made at this point. The |\@makecaption| command must be
% altered to a special format for the captions list.
% Finally, the auxiliary file {\tt.lof} is input.
%
% For the AGU supplement, the procedure is different. Instead of ignoring
% everything except the |\caption|, all printable text is contained in
% a |\figbox|, which here is defined to swallow its argument. (Actually the
% internal |\@figbox| is redefined.)
%
% For AGU, need to call |\noappendix| and to set |\parindent| to zero.
% This is because the manuscript part of AGU\TeX{} redefines |\@caption|
% so that this is no longer done there.
%
% Also need to zero |\parindent| for EGS. So why not do it generally?
%
% Note: no distinction is made between \texttt{figure} and \texttt{figure*},
% since both environments write the unstarred variant to the auxiliary
% file. For a list of captions, there is no need for a distinction.
%
%    \begin{macrocode}
\def\@figurecaps{\@ifundefined{tf@pof}{}{\if@filesw
  \immediate\closeout\tf@pof\fi
  \@ifundefined{appendixname}{}{\def\appendixname{}}
%<agu>  \noappendix
  \parindent\z@
  \reset@figtab\clearpage\section*{\figurecapname}\vspace{1cm}%
    \@mkboth{\uppercase{\figurecapname}}{\uppercase{\figurecapname}}%
    \addcontentsline{toc}{section}{\figurecapname}%
  \def\figure{\def\addcontentsline####1####2####3{}%
    \def\@captype{figure}%
%<*!agu>
    \begingroup\set@literal\@fcaponly
   }\def\endfigure{\endgroup\bigskip}%
%</!agu>
%<agu>    \vbox\bgroup
%<agu>   }\def\endfigure{\egroup\bigskip}%
%<*plates>
  \def\plate{\def\addcontentsline####1####2####3{}%
    \def\@captype{plate}%
%<*!agu>
    \begingroup\set@literal\@pcaponly
%</!agu>
%<agu>    \vbox\bgroup
   }\let\endplate=\endfigure
%</plates>
  {\let\@makecaption=\@makefcaption
%<agu>  \def\@figbox##1##2##3{\relax}
  \@input{\jobname.\lof}}%
  \clearpage}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@tablepage}
% \changes{4.1}{1993 Oct 22}{For NLINPROC, add explicit
%            {\tt\protect\bslash small}}
% \changes{4.1}{1993 Nov 20}{Revisions for AGU supplement}
% \changes{4.2}{1993 Dec 16}{For AGU: suppress floats for \texttt{planotable}}
% \changes{4.3a}{1994 Jun 6}{Zero \cmd{\parindent} for AGU}
% \changes{4.5e}{1996 Oct 17}{Zero \cmd{\parindent} generally}
% The page(s) of tables are written similarly, except no effort is made to
% list only the captions. The whole set of tables is read in as is,
% except that the tables are not to `float'.
%    \begin{macrocode}
\def\@tablepage{\@ifundefined{tf@pot}{}{\if@filesw
  \immediate\closeout\tf@pot\fi
  \@ifundefined{appendixname}{}{\def\appendixname{}}
%<agu>  \noappendix
  \parindent\z@
  \reset@figtab\clearpage\section*{\tablepagename}
    \@mkboth{\uppercase{\tablepagename}}{\uppercase{\tablepagename}}%
   \def\table{\def\@captype{table}\vbox\bgroup
%<egs>    \small
%<*!agu>
   }\def\endtable{\egroup\bigskip}%
%</!agu>
%<agu>   }\def\endtable{\spew@tblnotes\egroup\bigskip}%
%<agu>   \let\planotable=\aguplano \let\endplanotable=\endaguplano
%<agu>   \def\@float##1{\def\@captype{table}\vbox\bgroup}
%<agu>   \let\@dblfloat=\@float \let\clearpage=\newpage
%<longtab&!209>   \def\longtable{\newpage\FC@ltab} \let\endlongtable=\FC@endltab
  \@input{\jobname.\lot}
  \clearpage}}
%    \end{macrocode}
%
% Note that \texttt{agu} needs to provide for \texttt{planotable}. Since that
% environment calls |\@float| or |\@dblfloat| explicitly, the only way to
% turn of the floating mechanism is to redefine those commands. The
% |\clearpage| is also turned into |\newpage| otherwise \texttt{planotable}
% tries to eject some pseudo floats when tables are continued, resulting in
% an unwanted blank page.
%
% The \texttt{longtable} environment does not call the floating mechanism, 
% but we do have to restore the original definitions here. But add 
% \cs{newpage} to \cs{longtable} so that each such table starts on a new page.
% \end{macro}
%
% \begin{macro}{\printfigures}
% A similar page of figures (as opposed to their captions only) is added
% only optionally if the command |\printfigures| is given in the preamble.
%    \begin{macrocode}
\def\printfigures{\@figpagetrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@figurepage}
% \changes{4.1}{1993 Nov 20}{Revisions for AGU supplement}
% \changes{4.3a}{1994 Jun 6}{Zero \cmd{\parindent} for AGU}
% \changes{4.3a}{1994 Jun 6}{Add \cmd{\figurewidth} and \cmd{\platewidth} for
%      AGU}
% The page(s) of figures are much like those for the tables, except that
% the |\label| command must be switched off. This is because the labels
% have already been defined during the list of captions. However, any
% entries to a list of figures will be made here, since
% |\addtocontentsline| is in effect.
%
% For AGU, make the |\figurewidth| and |\platewidth| commands set |\hsize|
% (as well as |\pt@width|) in order to avoid overfull hboxes.
%    \begin{macrocode}
\def\@figurepage{\if@figpage\@ifundefined{tf@pof}{}{%
  \@ifundefined{appendixname}{}{\def\appendixname{}}
%<agu>  \noappendix \parindent\z@
  \reset@figtab\clearpage\section*{\figurepagename}%
  \@mkboth{\uppercase{\figurepagename}}{\uppercase{\figurepagename}}%
  \begingroup
%<agu>  \def\figurewidth##1{\pt@width##1\hsize##1}
  \def\figure{\def\@captype{figure}\vbox\bgroup}\def\endfigure{\egroup
    \vspace{20pt}}%
%<*plates>
%<agu>  \let\platewidth=\figurewidth
  \def\plate{\def\@captype{plate}\vbox\bgroup}\let\endplate=\endfigure
%</plates>
  \def\label##1{}%
  \@input{\jobname.\lof}\newpage\endgroup}\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@makefcaption}
% The special caption format for the captions list is defined here. The
% difference between this and the regular |\@makecaption| is that it is
% never centered if the text is less than one line. Unfortunately, this may
% alter the style of the caption. Maybe some better solution can be found.
% (The specific journals have special definitions of |\@makefcaption|
% that are given later.)
%    \begin{macrocode}
%<*!agu&!egs>
\long\def\@makefcaption#1#2{%
   \vskip 10pt
    #1. #2\par }
%</!agu&!egs>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\reset@figtab}
% The command to reset the figure and table counters.
%    \begin{macrocode}
\def\reset@figtab{%
  \setcounter{figure}{0}\setcounter{table}{0}
%<*plates>
  \setcounter{plate}{0}
%</plates>
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\enddocument}
% \changes{3.4}{1993 Aug 10}{Change order of pages to tables, figcaps,
%      figures}
% \changes{4.1}{1993 Nov 15}{For AGU, order is figcaps, tables, figures}
% The pages of figures, tables, and captions should be printed
% automatically at the end of the document without any extra commands from
% the author. To do this, put them into the |\end{document}|.
% (This can be done much more easily in \LaTeXe.)
%    \begin{macrocode}
%<*209>
\let\@nddoc=\enddocument
%<!agu>\def\enddocument{\iffigcaps\@tablepage\@figurecaps\@figurepage\fi\@nddoc}
%<agu>\def\enddocument{\iffigcaps\@figurecaps\@tablepage\@figurepage\fi\@nddoc}
%</209>
%<*!209>
%<!agu>\AtEndDocument{\iffigcaps\@tablepage\@figurecaps\@figurepage\fi}
%<agu>\AtEndDocument{\iffigcaps\@figurecaps\@tablepage\@figurepage\fi}
%</!209>
%    \end{macrocode}
% \end{macro}
%
% \subsection{Complications with the Appendix}
% The problem is that the figures etc.\ are stored to auxiliary files
% {\tt.lof} or {\tt.lot} and then read in later at the end of the paper.
% Thus these files must know when the |\appendix| has been given and when
% |\section| commands have been issued (new appendices) in order to keep the
% number labels straight. It is also necessary to reset things to their
% previous status. The |\@addtoreset| command must be undone, something that
% is not normally allowed for.
%
% The modifications here are added to the |\appendix| definition that
% exists \emph{before} this file is read in. The |\appendix| is not
% defined here, nor need it even include such subnumbering.
% The following macros merely allow such subnumbering to function properly
% under this style option.
%
% \begin{macro}{\appendix}
% \changes{3.3}{1993 Jul 23}{Add possibility of subnumbered figures and
%                            tables in appendix}
% \changes{4.2}{1993 Dec 21}{Add auxiliary file switch test for the appendix
%      entries to the \texttt{pof} and \texttt{pot} files}
% \changes{4.5}{1996 Jan 10}{Add flag to indicate appendix is on}
% \changes{4.5h}{1997 Nov 18}{Globally \cs{let} some things be redefined}
% The existing definition of |\appendix| is stored and the new |\appendix|
% command is defined. It writes |\doappendix| to the auxiliary files,
% redefines |\section| so that it puts a |\stepcounter{section}| command
% into the auxiliary files, and executes |\doappendix|.
% The definition of the |\section| command must be stored at a number of
% locations: |\@section| is the original non-appendix version, while
% |\@@section| contains any redinitions made by |\doappendix|, i.e., by the
% original |\appendix| command.
%
% Both |\@section| and |\reset@figtab| are globally set to avoid a problem
% if the appendix occurs inside an environment. This does occur with the
% AGU |\begin{article}|\dots|\end{article}| feature.
%
% The flag |\ifFC@appendix| is used to test if the appendix is active when
% the first float appears, so that when the auxiliary file is opened, the
% |\doappendix| is written immediately to it. Previously, without this, if
% the first figure or table appeared in the appendix, the listed captions
% did not have appendix numbering because this command was missing in the
% captions files.
%
%    \begin{macrocode}
\let\@appendix=\appendix
\newif\ifFC@appendix \FC@appendixfalse
\def\appendix{\FC@appendixtrue
  \@ifundefined{tf@pof}{}{\if@filesw\FC@writefile{pof}{\string\doappendix}\fi}%
  \@ifundefined{tf@pot}{}{\if@filesw\FC@writefile{pot}{\string\doappendix}\fi}%
  \global\let\@section=\section
  \doappendix
  \let\@@section=\section
  \def\section{%
    \@ifundefined{tf@pof}{}{\if@filesw\FC@writefile{pof}{\string
        \stepcounter{section}}\fi}%
    \@ifundefined{tf@pot}{}{\if@filesw\FC@writefile{pot}{\string
        \stepcounter{section}}\fi}%
    \@@section}
  \global\let\reset@figtab=\@unappendix}
%    \end{macrocode}
% The last step alters |\reset@figtab| so that appendix features are
% reset as well as the counters.
% \end{macro}
%
% \begin{macro}{\doappendix}
% \changes{4.5h}{1997 Nov 18}{Globally \cs{let} some things be redefined}
% The |\doappendix| contains those commands that must be executed when
% |\appendix| is given, both in the main text, and when the auxiliary files
% are reread in. It first saves the current definitions of |\thexxx|
% and of |\cl@section| (the list of counters that are reset when the section
% counter is incremented).
%    \begin{macrocode}
\def\doappendix{%
  \global\let\@thefigure=\thefigure
  \global\let\@thetable=\thetable
%<*plates>
  \global\let\@theplate=\theplate
%</plates>
  \global\let\@cl@section=\cl@section
  \@appendix
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@unappendix}
% The |\@unappendix| undoes the changes made by |\doappendix|.
% It becomes |\reset@figcaps| when |\appendix| is called.
% It is thus invoked by |\@figurecaps|, |\@tablepage|, and |\@figurepage|.
%    \begin{macrocode}
\def\@unappendix{\FC@appendixfalse
  \setcounter{figure}{0}\setcounter{table}{0}
  \let\thefigure=\@thefigure
  \let\thetable=\@thetable
%<*plates>
  \setcounter{plate}{0}%
  \let\theplate=\@theplate
%</plates>
  \let\cl@section=\@cl@section
  \let\section=\@section
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Complications with \texttt{sublabel.sty}}
% \begin{macro}{\sublabon}
% \changes{3.3}{1993 Jul 23}{Additions to allow for style option {\tt
%                            sublabel.sty}}
% \begin{macro}{\sublaboff}
% A similar problem exists if the style option \texttt{sublabel} has been
% activated. This could mean that figures and tables are subnumbered even
% outside of an appendix. Subnumbering here means e.g., 4{\it a}, 4{\it b},
% etc. As for the appendix, here too the auxiliary files must know when
% subnumbering is turned on and off. This means that these commands must be
% written to the auxiliary files whenever issued.
%
% These modifications here can only be made \emph{after}
% \texttt{sublabel.sty} has been read in, for obvious reasons.
%    \begin{macrocode}
%<*sublab>
\let\orisubon=\sublabon
\let\orisuboff=\sublaboff
\def\sublabon#1{\orisubon{#1}\if@filesw
    \iffigcaps\def\@tempb{#1}
    \def\@tempa{figure}\ifx\@tempa\@tempb
    \@ifundefined{tf@pof}{\newwrite\tf@pof
        \immediate\openout\tf@pof\jobname.\lof}{}%
    \FC@writefile{pof}{\string\orisubon{#1}}\fi
%<*plates>
    \def\@tempa{plate}\ifx\@tempa\@tempb
    \@ifundefined{tf@pof}{\newwrite\tf@pof
        \immediate\openout\tf@pof\jobname.\lof}{}%
    \FC@writefile{pof}{\string\orisubon{#1}}\fi
%</plates>
    \def\@tempa{table}\ifx\@tempa\@tempb
    \@ifundefined{tf@pot}{\newwrite\tf@pot
        \immediate\openout\tf@pot\jobname.\lot}{}%
    \FC@writefile{pot}{\string\orisubon{#1}}\fi
\fi\fi}
\def\sublaboff#1{\orisuboff{#1}\if@filesw
    \iffigcaps\def\@tempb{#1}
    \def\@tempa{figure}\ifx\@tempa\@tempb
    \@ifundefined{tf@pof}{\newwrite\tf@pof
        \immediate\openout\tf@pof\jobname.\lof}{}%
    \FC@writefile{pof}{\string\orisuboff{#1}}\fi
%<*plates>
    \def\@tempa{plate}\ifx\@tempa\@tempb
    \@ifundefined{tf@pof}{\newwrite\tf@pof
        \immediate\openout\tf@pof\jobname.\lof}{}%
    \FC@writefile{pof}{\string\orisuboff{#1}}\fi
%</plates>
    \def\@tempa{table}\ifx\@tempa\@tempb
    \@ifundefined{tf@pot}{\newwrite\tf@pot
        \immediate\openout\tf@pot\jobname.\lot}{}%
    \FC@writefile{pot}{\string\orisuboff{#1}}\fi
\fi\fi}
%</sublab>
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \subsection{Journal-Specific Coding}
% \changes{4.1}{1993 Oct 22}{Add extra coding for JGR, GRL, and NLINPROC}
% \changes{4.1}{1993 Nov 20}{Add extra coding for AGU supplement}
% \changes{4.3}{1994 May 19}{Remove obsolete JGR, GRL coding}
% When \thestyle{} is used as a module to other main styles for specific
% journals, there are some extra details that must be seen to.
%
% \begin{macro}{\figbox}
% \changes{4.2}{1993 Nov 20}{Add for AGU supplement, to remove figures
%     from list of figure captions}
% \changes{4.5b}{1996 Jul 22}{Let size fit contents automatically}
% \changes{4.5c}{1996 Jul 29}{Add starred version for no frame}
% For the AGU supplement, figures and plates are put into a |\figbox|
% which reserves space for them, or which can contain a real figure.
% During the printing of the captions, this command is set to swallow
% its argument. The normal captions-only system cannot be used for this
% because there may be additional width commands in the |figure| environment
% for setting the caption widths, which must be observed, i.e., read in.
% This box takes three arguments: width, height, and contents, which
% are centered horizontally and vertically in the box. The box is framed
% with |\framebox| so the parameters |\fboxsep| and |\fboxrule| may
% be used to control its appearance.
% The starred version of this command suppresses the frame without changing
% the |\framebox| parameters. It actually uses |\makebox| instead.
% It is better to use |\figbox*| to remove the frame because |\framebox|
% is also used in the marginal notes for the figures, which always should
% have the frame.
%
% If the first argument (width) is left empty, the box is made to fit its
% contents, both vertically and horizontally. If only the second argument
% (width) is left empty, the width will be as given and the height is scaled
% automatically. This is for use with |\epsfig| and relatives.
%    \begin{macrocode}
%<agu>\def\figbox{\@ifstar{\let\agubox\makebox\@figbox}
%<agu>  {\let\agubox\framebox\@figbox}}
%<agu>\def\@figbox#1#2#3{\hbox to \hsize{\hfil
%<agu>  \ifx!#1!\agubox{#3}\else
%<agu>  \agubox[#1][c]{\ifx!#2!#3\else\@tempdima#2\relax
%<agu>  \divide\@tempdima by2\relax
%<agu>  \advance\@tempdima by-\fboxsep \advance\@tempdima by-\fboxrule
%<agu>  \vrule\@height\@tempdima\@depth\@tempdima\@width\z@
%<agu>  \vbox to \z@{\vss\hbox{#3}\vss}\fi}\fi\hfil}}
%    \end{macrocode}
% \end{macro}
%
% The marking of figures and tables with marginal notes should be
% enabled by default.
%    \begin{macrocode}
%<agu>\figmarktrue
%    \end{macrocode}
%
% For the AGU supplement, the necessary flag is |\if@preprint|. Furthermore,
% for AGU preprints and manuscripts, we need to turn off the |\figurewidth|
% and |\platewidth| commands that come with the AGU-supplied macros.
%    \begin{macrocode}
%<agu>\if@preprint \figcapsfalse
%<agu>  \def\figurewidth#1{\pt@width=\hsize}
%<agu>  \def\platewidth#1{\pt@width=\hsize}
%<agu>\fi
%<agu>\if@draft
%<agu>  \def\figurewidth#1{\pt@width=\hsize}
%<agu>  \def\platewidth#1{\pt@width=\hsize}
%<agu>\fi
%    \end{macrocode}
%
% \begin{macro}{\@makefcaption}
% \changes{4.2}{1993 Nov 20}{Redefine for AGU supplement, to print captions
%      in two widths}
% \changes{4.3a}{1994 Jun 6}{For AGU, set \cmd{\hsize} to avoid overfull
%      hbox messages}
% Now define |\@makefcaption|, the special version of |\@makecaption| for
% the page of captions, for AGU. This is either the supplied version of
% the macro, or a special version that prints the caption twice, in two
% widths.
%    \begin{macrocode}
%<agu>\let\ori@makecap=\@makecaption
%<agu>\def\@makefcaption#1#2{{\if@dblcap\if@camera\pt@width=\textwidth
%<agu> \ori@makecap{#1}{#2}
%<agu> \pt@width=\wpt@width
%<agu> \hsize=\pt@width
%<agu> \vskip10pt \def\label##1{}\fi\fi
%<agu> \ori@makecap{#1}{#2}}
%<agu>}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\doublecaption}
% \changes{4.2}{1993 Nov 20}{Add for AGU supplement, to enable doubled captions
%      in two widths}
% To enable this double caption, one must give |\doublecaption|
% with the width of the wider caption as argument in the preamble.
% A normal value for \textsl{AGU} journals is 35~pc.
%    \begin{macrocode}
%<agu>\newdimen\wpt@width
%<agu>\newif\if@dblcap \@dblcapfalse
%<agu>\def\doublecaption#1{\wpt@width=#1\relax\@dblcaptrue}
%    \end{macrocode}
% \end{macro}
% Finally, for \emph{EGS}, the regular |\@makecaptions|
% macro is sufficient. In that journal, all captions are flush-left to
% begin with, so this might as well be kept for the figure captions too.
%    \begin{macrocode}
%<egs>\let\@makefcaption=\@makecaption
%    \end{macrocode}
% The whole figure caption business is activated only for |draft| mode.
%    \begin{macrocode}
%<egs>\if@draft\figcapstrue\else\figcapsfalse\fi
%    \end{macrocode}
%
% This terminates the special coding, and thus the style file.
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \Finale