summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/fallback/v2.1/caption2.dtx
blob: 23c1f26b862883cb6dea5d96a07e37cd910531e9 (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
% \iffalse meta-comment
% 
% This is file `caption2.dtx'.
% 
% Copyright (C) 1994-2005 Axel Sommerfeldt (caption@sommerfee.de)
% 
% --------------------------------------------------------------------------
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
% 
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Axel Sommerfeldt.
% 
% This work consists of the files caption.ins, caption.dtx,
% caption2.dtx, caption.xml, and anleitung.tex and the derived files
% caption.sty, caption2.sty, caption3.sty, and manual.tex.
% 
% \fi
% \CheckSum{843}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\documentclass{ltxdoc}
\setlength\parindent{0pt}
\setlength\parskip{\smallskipamount}
%
\ifx\pdfoutput\undefined\else
  \ifcase\pdfoutput\else
    \usepackage{mathptmx,courier}
    \usepackage[scaled=0.90]{helvet}
  \fi
\fi
%
\usepackage{caption2}[2004/04/16]
%
%<+driver>\OnlyDescription
%
\begin{document}
  \DocInput{caption2.dtx}
\end{document}
%</driver>
% \fi
%
% \newcommand*{\purerm}[1]{{\upshape\mdseries\rmfamily #1}}
% \newcommand*{\puresf}[1]{{\upshape\mdseries\sffamily #1}}
% \newcommand*{\purett}[1]{{\upshape\mdseries\ttfamily #1}}
% \let\package\puresf\def\thispackage{\package{caption2}}
% \let\env\purett \let\opt\purett
%
% \GetFileInfo{caption2.sty}
% \title{The \thispackage\ package\thanks{This package has version number
%        \fileversion, last revised \filedate.}}
% \author{Axel Sommerfeldt\\\texttt{caption@sommerfee.de}}
% \date{2005/11/02}
% \maketitle
%
% \changes{v2.0}{ 9 Oct 95}{New experimental version: Many new commands and features}
% \changes{v2.0}{ 9 Oct 95}{Support of the longtable package added}
% \changes{v2.1}{20 Feb 02}{Revised: New commands and options}
% \changes{v2.1}{26 Feb 02}{Adapted to version 2.1 of the subfigure package}
% \changes{v2.1a}{12 Nov 03}{Some minor bug fixes and improved compatibility to v2.0}
% \changes{v2.1b}{16 Apr 04}{Some minor bug fixes and improved compatibility to v2.0}
% \changes{v2.1c}{10 May 04}{Some minor bug fixes and improved compatibility to v2.0}
% \changes{v2.1d}{ 3 Oct 05}{Some superfluous brackets removed; warning added}
%
% \providecommand\LaTeXcomp{The \LaTeX{} Companion}
%
% \section*{This package is obsolete!}
%
% The \package{caption2} package used to be an experimental side-version of
% the regular \package{caption} package. It was made public as beta test version
% without documentation in 1995 because of the demand for new features and
% adaptations to other packages like the \package{longtable} and
% \package{subfigure} package.
%
% Even in the next years I found no time to reintegrate some of the
% well-tried features into the regular \package{caption} package. So I
% decided to release a version $2.1$ of the \package{caption2} package in 2002
% instead, which included some minor bug fixes and adaptations to the new
% version $2.1$ of the \package{subfigure} package. Furthermore I started
% to write a documentation for this package, but unfortunately did not get
% very far with this\ldots
%
% In 2003 I finally found some (more) time, so a new regular release $3.0$
% of the \package{caption} package could be build with massive help from
% Frank Mittelbach\cite{A-W:GMS94} and Steven Cochran\cite{subfigure}.
% It was released in December 2003 and superseded the neglected
% \package{caption2} package.
%
% {\small (In parallel, Steven Cochran released the \package{subfig} package which
% superseded the \package{subfigure} package.)}
%
% So please don't use this package for new documents. It's old, it's obsolete
% and it starts to begin smell bad!
% Please ignore all hints in books or other documents which try to tell you
% that the \package{caption2} package should be used instead of the
% \package{caption} package -- these hints are outdated since December 2003.
%
% \section*{How to migrate to the regular \package{caption} package?}
%
% Usually replacing \package{caption2} by \package{caption} is sufficient
% because the \package{caption} package emulates most of the options and
% commands of the \package{caption2} package.
% If you get some errors or wired results afterwards, please take a closer
% look at the \package{caption} package documentation which will hopefully
% help you clearing these problems.
% If all this should fail you can write me an e-mail asking for help.
%
% \section*{What will happen to this package?}
%
% The \package{caption2} package is still some kind of supported, that means
% it will be part of future releases and bugs will still be fixed so existing
% documents using this package will still compile.
% But it will \emph{not} be enhanced in the future or adapted to future versions
% of foreign packages.
%
% This means migrating to the actual \package{caption} package should not be
% necessary for old documents.
%
% \StopEventually{}
%
% \DoNotIndex{\\,\_,\ ,\@@par}
% \DoNotIndex{\@classoptionslist,\@currext,\@currname}
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@expandtwoargs}
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
% \DoNotIndex{\@ifnextchar,\@ifstar,\@ifundefined,\@latex@error}
% \DoNotIndex{\@namedef,\@nameuse}
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempb,\@tempc}
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
% \DoNotIndex{\p@,\z@}
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance}
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\bgroup,\box}
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
% \DoNotIndex{\edef,\egroup,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
% \DoNotIndex{\fi,\footnotesize,\global}
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
% \DoNotIndex{\if,\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
% \DoNotIndex{\ifx,\ignorespaces,\itshape}
% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
% \DoNotIndex{\next,\nobreakspace,\noexpand,\noindent,\numberline}
% \DoNotIndex{\normalsize,\or,\par,\parbox,\parfillskip}
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\providecommand}
% \DoNotIndex{\quad}
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
% \DoNotIndex{\rightskip,\rmfamily}
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
% \DoNotIndex{\small,\string,\space,\strut}
% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
% \DoNotIndex{\undefined,\unvbox,\uparrow,\upshape,\usebox,\usepackage}
% \DoNotIndex{\vbox,\vsize,\vskip,\wd,\width,\z@skip}
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
% \DoNotIndex{\ProcessOptions,\ProvidesPackage}
%
% \clearpage
%
% \section{The Implementation}
% \iffalse
%<*package>
% \fi
%
% \subsection{Identificaton}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{caption2}[2005/10/03 v2.1d Customising captions (AS)]
%\PackageWarning{caption2}{THIS PACKAGE IS OBSOLETE, PLEASE USE caption INSTEAD}
%    \end{macrocode}
%
% \subsection{Preliminary declarations}
%
% \begin{macro}{\captionfont}
% \begin{macro}{\captionlabelfont}
% \cs{captionfont} and \cs{captionlabelfont} will hold the font specifications for the caption.
%    \begin{macrocode}
\newcommand*\captionfont{}
\newcommand*\captionlabelfont{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionlabeldelim}
% \begin{macro}{\captionlabelsep}
% \cs{captionlabeldelim} \& \cs{captionlabelsep} will hold the iterim
% space between caption label and text.
% (\cs{captionlabeldelim} will be typeset within \cs{captionlabelfont},
%  \cs{captionlabelsep} not.)
%    \begin{macrocode}
\newcommand*\captionlabeldelim{}
\newcommand*\captionlabelsep{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionsize}
% The macro \cs{captionsize} is obsolete since v1.4 of the \textsf{caption} package,
% but we still support it to provide backward compatibility.
%    \begin{macrocode}
\newcommand*\captionsize{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captionmargin}
% \begin{macro}{\captionwidth}
% \begin{macro}{\ifcaptionwidth}
% Either \cs{captionmargin} (with specifies an extra margin) or \cs{captionwidth}
% (with specifies an explicit width) can be set, therefore we need the flag \cs{ifcaptionwidth}
% to determine with parameter we should pay attention to.
%    \begin{macrocode}
\newdimen\captionmargin
\newdimen\captionwidth
\newif\ifcaptionwidth
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionindent}
% \cs{captionindent} will be used in caption style \texttt{indent} and specifies the indention
% after the first line.
%    \begin{macrocode}
\newdimen\captionindent
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifcaptionlabel}
% \begin{macro}{\ifonelinecaptions}
% \begin{macro}{\ifignoreLTcapwidth}
% More flags. If \cs{ifcaptionlabel} is not set the caption label should be suppressed;
% we need this flag to support the \cs{caption*} command.
% If \cs{ifonelinecaptions} is set we support the \LaTeX\ base style 'one line captions',
% that means the caption will be typeset centered if it fits to one line.
% If \cs{ifignoreLTcapwidth} is set we ignore the \cs{LTcapwidth} of \textsf{longtable}.
% \changes{v2.1}{20 Feb 02}{New ifs \cs{ifcaptionlabel} and \cs{ifignoreLTcapwidth}}
%    \begin{macrocode}
\newif\ifcaptionlabel\captionlabeltrue
\newif\ifonelinecaptions
\newif\ifignoreLTcapwidth
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\setcaptionmargin}
% \begin{macro}{\setcaptionwidth}
% User-friendly commands to set the caption margin resp.\ width.
% Note that they additionally set the \cs{ifcaptionwidth} flag.
%    \begin{macrocode}
\newcommand*\setcaptionmargin{%
  \captionwidthfalse
  \setlength\captionmargin}
\newcommand*\setcaptionwidth{%
  \captionwidthtrue
  \setlength\captionwidth}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\normalcaptionparams}
% \cs{normalcaptionparams} resets all caption related parameters to it's normal default values.
% \cs{captionfont} will be set to \cs{captionsize} so setting the obsolete \cs{captionsize} will still work.
% Same story with \cs{captiondelim} and the obsolete \cs{captionlabeldelim}.
% \changes{v2.1}{29 Jan 02}{New command \cs{normalcaptionparams}}
%    \begin{macrocode}
\newcommand*\normalcaptionparams{%
  \let\captionsize\@empty
  \renewcommand*\captionfont{\captionsize}%
  \let\captionlabelfont\@empty
  \renewcommand*\captionlabeldelim{:}%
  \renewcommand*\captionlabelsep{\space}%
  \setcaptionmargin\z@\setlength\captionindent\z@
  \onelinecaptionstrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@eh}
% Some commands will produce an error message, use this as help text.
%    \begin{macrocode}
\newcommand*\caption@eh{%
  If you do not understand this error, please take a closer look\MessageBreak
  at the documentation of the `caption2' package.\MessageBreak
  \@ehc}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\defcaptionstyle}
% \begin{macro}{\newcaptionstyle}
% \begin{macro}{\renewcaptionstyle}
% These macros will define a new caption style. \cs{newcaptionstyle} and \cs{renewcaptionstyle}
% will additionally check if the caption style already exists or not.
%    \begin{macrocode}
\newcommand*\defcaptionstyle[1]{%
  \@namedef{caption@@#1}}
%
\newcommand*\newcaptionstyle[1]{%
  \expandafter\ifx\csname caption@@#1\endcsname\relax
    \expandafter\defcaptionstyle
  \else
    \PackageError{caption2}{Caption style `#1' already defined}{\caption@eh}%
    \expandafter\@gobbletwo
  \fi
  {#1}}
%
\newcommand*\renewcaptionstyle[1]{%
  \expandafter\ifx\csname caption@@#1\endcsname\relax
    \PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}%
    \expandafter\@gobbletwo
  \else
    \expandafter\defcaptionstyle
  \fi
  {#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\dummycaptionstyle}
% This macro will also define a new caption style, but a one which is based on the
% actual set caption style. Therefore you can't set a caption style made with this
% command with \cs{captionstyle} -- we check this to avoid an endless recursion.
%    \begin{macrocode}
\newcommand*\dummycaptionstyle[2]{%
  \defcaptionstyle{#1}{%
    \expandafter\ifx\csname caption@@\caption@style\expandafter\endcsname%
                    \csname caption@@#1\endcsname
      \PackageError{caption2}{You can't use the caption style `#1' directy}{%
        The caption style `#1' is only a dummy and does not really exists.%
        \MessageBreak You have to redefine it (with \protect\renewcaptionstyle)
        before you can select\MessageBreak it with \protect\captionstyle.
        \space\caption@eh}%
    \else
      #2\usecaptionstyle\caption@style
    \fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captionstyle}
% \cs{captionstyle} sets the actual caption style. It includes a check if the given caption
% style is defined or not.
%    \begin{macrocode}
\newcommand*\captionstyle[1]{%
  \expandafter\ifx\csname caption@@#1\endcsname\relax
    \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}%
  \else
    \def\caption@style{#1}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{style `normal'}
% \begin{macro}{style `center'}
% \begin{macro}{style `centerlast'}
% \begin{macro}{style `flushleft'}
% \begin{macro}{style `flushright'}
% \begin{macro}{style `hang'}
% \begin{macro}{style `indent'}
% The predefined caption styles `normal', `center', `flushleft', `flushright', `centerlast',
% `hang', `hang+X', and `indent'. Because they are quite similar they all are based on the macro
% \cs{caption@make}.
%    \begin{macrocode}
\newcaptionstyle{normal}{\caption@make{normal}}
\newcaptionstyle{center}{\caption@make{center}}
\newcaptionstyle{centerlast}{\caption@make{centerlast}}
\newcaptionstyle{flushleft}{\caption@make{flushleft}}
\newcaptionstyle{flushright}{\caption@make{flushright}}
\newcaptionstyle{hang}{\caption@make{hang}}
\newcaptionstyle{hang+center}{\caption@make{hang@center}}
\newcaptionstyle{hang+centerlast}{\caption@make{hang@centerlast}}
\newcaptionstyle{hang+flushleft}{\caption@make{hang@flushleft}}
\newcaptionstyle{indent}{\caption@make{indent}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@makecaption}
% Our predefined caption styles. \cs{caption@makecaption} takes the style
% name as parameter, it does the common stuff and calls a macro
% (build out of the style name) to do the uncommon stuff if neccessary.
% \changes{v2.1}{26 Feb 02}{Renamed from \cs{caption@make} to \cs{caption@makecaption}}
% \changes{v2.1b}{16 Apr 04}{We offer and use \cs{caption@make}, again}
% \changes{v2.1c}{10 May 04}{Bugfix: Extra \cs{par} added}
%    \begin{macrocode}
\newcommand*\caption@makecaption[1]{%
  \usecaptionmargin
%
  \ifcaptionlabel
    \def\caption@label{%
      {\captionlabelfont\captionlabel\captionlabeldelim}\captionlabelsep}%
  \else
    \let\caption@label\@empty
  \fi
%
  \captionfont
  \onelinecaption
    {\caption@label\captiontext}%
    {\parbox[b]\captionlinewidth{\strut\@nameuse{caption@@@#1}\par}\par}}
\newcommand*\caption@make{\caption@makecaption}
%    \end{macrocode}
% \end{macro}
%
% \changes{v2.1}{26 Feb 02}{Removed all extra parboxes from caption styles}
% \changes{v2.1a}{12 Nov 03}{\ldots and put the parbox into \cs{caption@makecaption} instead}
%
% \begin{macro}{\caption@@@normal}
% The `normal' caption style. Just typeset caption (label \& text) as paragraph.
%    \begin{macrocode}
\newcommand*\caption@@@normal{%
  \caption@label\captiontext}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@center}
% The `center' caption style. Typeset the caption centered within a parbox.
%    \begin{macrocode}
\newcommand*\caption@@@center{%
  \centering\caption@label\captiontext}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@centerlast}
% The `centerlast' caption style.
% The idea how to do this was taken from Br\"uggemann-Klein\cite{Anne},
% it is also mentioned in Kopka\cite[p227]{Kopka-E}.
%    \begin{macrocode}
\newcommand*\caption@centerlast{%
  \advance\leftskip by 0pt plus 1fil%
  \advance\rightskip by 0pt plus -1fil%
  \parfillskip0pt plus 2fil\relax}
%
\newcommand*\caption@@@centerlast{%
  \caption@centerlast\caption@label\captiontext}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@flushleft}
% The `flushleft' caption style. Typeset the caption raggedright within a parbox.
%    \begin{macrocode}
\newcommand*\caption@@@flushleft{%
  \raggedright\caption@label\captiontext}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@flushright}
% The `flushright' caption style. Typeset the caption raggedleft within a parbox.
%    \begin{macrocode}
\newcommand*\caption@@@flushright{%
  \raggedleft\caption@label\captiontext}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@hang}
% \begin{macro}{\caption@hangplus}
% The `hang' caption style.
% This code was taken from \LaTeXcomp\cite[p155]{A-W:GMS94} and modified.
%    \begin{macrocode}
\newcommand*\caption@@@hang{%
  \sbox\@tempboxa{\caption@label}%
  \hangindent\wd\@tempboxa\noindent
  \usebox\@tempboxa\caption@hangplus\captiontext}
%
\newcommand*\caption@hangplus{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@@@hang@center}
% The `hang+flushleft' caption style.
%    \begin{macrocode}
\newcommand*\caption@@@hang@center{%
  \let\caption@hangplus\centering\caption@@@hang}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@hang@centerlast}
% The `hang+flushleft' caption style.
%    \begin{macrocode}
\newcommand*\caption@@@hang@centerlast{%
  \let\caption@hangplus\caption@centerlast\caption@@@hang}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@hang@flushleft}
% The `hang+flushleft' caption style.
%    \begin{macrocode}
\newcommand*\caption@@@hang@flushleft{%
  \let\caption@hangplus\raggedright\caption@@@hang}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@indent}
% The `indent' caption style. Is is quite like the `hang' style but the
% indention is given as \cs{captionindent}.
%    \begin{macrocode}
\newcommand*\caption@@@indent{%
  \hangindent\captionindent\noindent
  \caption@label\captiontext}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Options}
%
% \begin{macro}{normal}
% \begin{macro}{center}
% \begin{macro}{centerlast,anne}
% \begin{macro}{flushleft}
% \begin{macro}{flushright}
% \begin{macro}{hang,isu}
% \begin{macro}{indent}
% These options will set the caption style.
% (`normal' is the default one.)
%
% The options `anne' and `isu' are for
% backward compatibility only.
%    \begin{macrocode}
\DeclareOption{normal}{\captionstyle{normal}}
\DeclareOption{center}{\captionstyle{center}}
\DeclareOption{centerlast}{\captionstyle{centerlast}}
\DeclareOption{flushleft}{\captionstyle{flushleft}}
\DeclareOption{flushright}{\captionstyle{flushright}}
\DeclareOption{anne}{\ExecuteOptions{centerlast}}
\DeclareOption{hang}{\captionstyle{hang}}
\DeclareOption{hang+center}{\captionstyle{hang+center}}
\DeclareOption{hang+centerlast}{\captionstyle{hang+centerlast}}
\DeclareOption{hang+flushleft}{\captionstyle{hang+flushleft}}
\DeclareOption{isu}{\ExecuteOptions{hang}}
\DeclareOption{indent}{\captionstyle{indent}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{scriptsize}
% \begin{macro}{footnotesize}
% \begin{macro}{small}
% \begin{macro}{normalsize}
% \begin{macro}{large,Large}
% These options will set the caption size. We use \cs{g@addto@macro} so more that one
% option can be set.
%    \begin{macrocode}
\DeclareOption{scriptsize}{\g@addto@macro\captionsize\scriptsize}
\DeclareOption{footnotesize}{\g@addto@macro\captionsize\footnotesize}
\DeclareOption{small}{\g@addto@macro\captionsize\small}
\DeclareOption{normalsize}{\g@addto@macro\captionsize\normalsize}
\DeclareOption{large}{\g@addto@macro\captionsize\large}
\DeclareOption{Large}{\g@addto@macro\captionsize\Large}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{up,it,sl,sc}
% \begin{macro}{md,bf}
% \begin{macro}{rm,sf,tt}
% These options will set the caption label.
%    \begin{macrocode}
\DeclareOption{up}{\g@addto@macro\captionlabelfont\upshape}
\DeclareOption{it}{\g@addto@macro\captionlabelfont\itshape}
\DeclareOption{sl}{\g@addto@macro\captionlabelfont\slshape}
\DeclareOption{sc}{\g@addto@macro\captionlabelfont\scshape}
\DeclareOption{md}{\g@addto@macro\captionlabelfont\mdseries}
\DeclareOption{bf}{\g@addto@macro\captionlabelfont\bfseries}
\DeclareOption{rm}{\g@addto@macro\captionlabelfont\rmfamily}
\DeclareOption{sf}{\g@addto@macro\captionlabelfont\sffamily}
\DeclareOption{tt}{\g@addto@macro\captionlabelfont\ttfamily}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{oneline}
% \begin{macro}{nooneline}
% These options will set the `oneline' flag.
% (`oneline' is the default.)
%    \begin{macrocode}
\DeclareOption{oneline}{\onelinecaptionstrue}
\DeclareOption{nooneline}{\onelinecaptionsfalse}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@package}
% A helper macro, a value of 1 within parameter \#2 will activate the support
% of the package given in parameter \#1, a value of 0 will deactivate it.
%    \begin{macrocode}
\newcommand*\caption@package[1]{\@namedef{caption@pkt@#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{float}
% \begin{macro}{longtable}
% \begin{macro}{subfigure}
% \changes{v2.1}{19 Feb 02}{New options for interaction with other packages}
% These options will enable or suppress the support of the packages
% \textsf{float}, \textsf{longtable}, and \textsf{subfigure}.
%    \begin{macrocode}
\DeclareOption{float}{\caption@twozerofalse\caption@package{float}{1}}
\DeclareOption{longtable}{\caption@twozerofalse\caption@package{longtable}{1}}
\DeclareOption{subfigure}{\caption@twozerofalse\caption@package{subfigure}{1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{none}
% \begin{macro}{all}
% These options will enable or suppress the support of all the above packages.
%    \begin{macrocode}
\DeclareOption{none}{\caption@twozerofalse
  \caption@package{float}{0}\caption@package{longtable}{0}%
  \caption@package{subfigure}{0}}
\DeclareOption{all}{\ExecuteOptions{float,longtable,subfigure}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{ruled}
% \begin{macro}{boxed}
% The option `ruled' introduced in \textsf{caption} v1.2 is obsolete now, but
% we will still support it. The option `boxed' was introduced in version 2.0
% and is obsolete now, too.
%    \begin{macrocode}
\newif\ifcaption@ruled
\DeclareOption{ruled}{\caption@ruledtrue}
\DeclareOption{boxed}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{ignoreLTcapwidth}
% This option will make the caption code ignore the setting of \cs{LTcapwidth}
% and use the setting of \cs{setcaptionmargin} or \cs{setcaptionwidth} instead.
%    \begin{macrocode}
\DeclareOption{ignoreLTcapwidth}{\ignoreLTcapwidthtrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{debug}
% This option will put additional debug information in the log file.
%    \begin{macrocode}
\DeclareOption{debug}{\caption@debugtrue}
%    \end{macrocode}
% \end{macro}
%
% That's it! Now set the default values and start processing the options.
% (If \cs{caption@twozero} is set to true (default) we will emulate the package
% load algorithm of \textsf{caption} v2.0: If the package is already loaded
% patch it, otherwise do nothing.)
% \changes{v2.1}{19 Feb 02}{\cs{ProcessOptions} changed to \cs{ProcessOptions*}}
%    \begin{macrocode}
\newif\ifcaption@debug
\newif\ifcaption@twozero
\normalcaptionparams
\ExecuteOptions{none,normal}
\caption@twozerotrue
\ProcessOptions*
\ifcaption@twozero
  \PackageInfo{caption2}{Running in caption2 v2.0 compatibility mode}
\fi
%    \end{macrocode}
%
% \subsection{More declarations}
%
% \begin{macro}{\captionof}
% \begin{macro}{\captionof*}
% \cs{captionof} resp.\ \cs{captionof*} will just set \cs{@captype} and do the normal
% \cs{caption} resp.\ \cs{caption*}, so we can also typeset captions outside floating
% environments.
% \changes{v2.1}{19 Feb 02}{New commands \cs{captionof} and \cs{captionof*}}
%    \begin{macrocode}
\def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}}
\newcommand*\caption@of[2]{\def\@captype{#2}#1}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\abovecaptionskip}
% \begin{macro}{\belowcaptionskip}
% Not all document classes define \cs{abovecaptionskip} and \cs{belowcaptionskip}
% (like \textsf{ucthesis}), so we do it here if not already done.
% \changes{v2.1}{19 Feb 02}{\cs{abovecaptionskip} and \cs{belowcaptionskip} will be defined if neccessary}
%    \begin{macrocode}
\@ifundefined{abovecaptionskip}{%
  \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
\@ifundefined{belowcaptionskip}{%
  \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionlinewidth}
% \changes{v2.1}{26 Feb 02}{Renamed from \cs{realcaptionwidth} to \cs{captionlinewidth}}
% \changes{v2.1a}{12 Nov 03}{We offer \cs{realcaptionwidth}, again}
% \begin{macro}{\captionlabel}
% \begin{macro}{\captiontext}
% These values are only set and used within the caption code itself.
% \cs{captionlinewidth} will be set to the given vertical space for the caption,
% normally this is \cs{linewidth}. (This value was called \cs{realcaptionwidth}
% within \thispackage\ \mbox{2.0}, so we will offer this, too.)
%
% \cs{captionlabel} and \cs{captiontext} will be set to the caption label
% resp.\ the caption text.
% (Because \cs{captionlabel} and \cs{captiontext} will be locally defined with
% \cs{def} we do not need to define them here.)
%    \begin{macrocode}
\newdimen\captionlinewidth
\newdimen\realcaptionwidth
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\usecaptionmargin}
% A helper macro for caption style authors:
% It calculates \cs{leftskip} and \cs{rightskip} out of
% \cs{captionlinewidth} and \cs{captionmargin} resp.\ \cs{captionwidth}.
% Also \cs{captionlinewidth} will be corrected to the appropriate value.
%    \begin{macrocode}
\newcommand*\usecaptionmargin{%
  \ifcaptionwidth
    \leftskip\captionlinewidth
    \advance\leftskip by -\captionwidth
    \divide\leftskip by 2
    \rightskip\leftskip
    \captionlinewidth\captionwidth
  \else
    \leftskip\captionmargin
    \rightskip\captionmargin
    \advance\captionlinewidth by -2\captionmargin
  \fi
  \realcaptionwidth\captionlinewidth}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\onelinecaption}
% This macro definition helps setting captions the \LaTeX\ base classes way:
% If \cs{ifonelinecaptions} is set and the 1st argument fits within \cs{captionlinewidth},
% we typeset it centered -- otherway we typeset the 2nd argument.
% (We use the savebox \cs{@tempboxa} as helper for this.)
%    \begin{macrocode}
\newcommand\onelinecaption[1]{%
  \let\next\@firstofone
  \ifonelinecaptions
    \sbox\@tempboxa{#1}%
    \ifdim\wd\@tempboxa >\captionlinewidth
    \else
      \def\next{{\centering\usebox\@tempboxa\par}\@gobble}%
    \fi
  \fi\next}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\usecaptionstyle}
% First we check if we are inside a caption -- if \cs{captiontext} is undefined we are not.
% If we are we call the appropriate caption definition.
%
% \changes{v2.1b}{16 Apr 04}{Missing percent added (and extra space removed)}
%    \begin{macrocode}
\newcommand*\usecaptionstyle[1]{%
  \@ifundefined{captiontext}{%
    \PackageError{caption2}{You can't use \protect#1
      in normal text}{The usage of \protect#1 is only
      allowed inside code declared with\MessageBreak \protect\defcaptionstyle,
      \protect\newcaptionstyle \space or \protect\renewcaptionstyle.
      \space\caption@eh}
  }{%
    \@ifundefined{caption@@#1}%
      {\PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}}%
      {\@nameuse{caption@@#1}}%
  }}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@makecaption}
% This is the heart of the \thispackage\ package -- the redefinition of the
% core caption code. It was taken from the \LaTeXe\ standard classes and modified.
% It's very easy -- apart from using \cs{abovecaptionskip} and \cs{belowcaptionskip}
% we just set \cs{captionlinewidth}, \cs{captionlabel} and \cs{captiontext}
% to its appropriate values and using the code of the actual caption style via
% \cs{usecaptionstyle}.
%    \begin{macrocode}
\renewcommand\@makecaption[2]{%
  \vskip\abovecaptionskip
  \captionlinewidth\hsize
  \realcaptionwidth\hsize
  \def\captionlabel{#1}%
  \def\captiontext{#2}%
  \usecaptionstyle\caption@style
  \vskip\belowcaptionskip}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Support of other packages}
%
% \begin{macro}{\caption@package}
% This macro will execute the code needed to support the package
% named within argument \#1. The parameter \#2 is the command
% which shows if the package is loaded -- it is defined, it is
% already loaded, otherwise not. The parameter \#3 contains code
% which will be executed if no support is required -- this is for
% cleanup purposes. The final parameter \#4 contains the code itself.
% \changes{v2.1c}{9 May 04}{Compatibility warning removed}
%    \begin{macrocode}
\renewcommand*\caption@package[3]{%
  \if1\@nameuse{caption@pkt@#1}%
    \@ifundefined{#2}%
      {\let\next\AtBeginDocument}%
      {\let\next\@firstofone}%
  \else\ifcaption@twozero
    \@ifundefined{#2}%
      {#3\let\next\@gobble}%
      {\let\next\@firstofone}%
  \else
    #3\let\next\@gobble
  \fi\fi
  \expandafter\let\csname caption@pkt@#1\endcsname\undefined
  \ifcaption@debug
    \ifx\next\@gobble\PackageInfo{caption2}{#1 => gobble}%
    \else\ifx\next\@firstofone\PackageInfo{caption2}{#1 => firstofone}%
    \else\ifx\next\AtBeginDocument\PackageInfo{caption2}{#1 => AtBeginDocument}%
    \fi\fi\fi
  \fi
  \next}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Support of the \puresf{float} package}
%
%    \begin{macrocode}
\caption@package{float}{floatc@plain}{}{%
  \ifx\floatc@plain\relax
    \PackageWarning{caption2}{%
      Option `float' was set but there is no float package loaded}
  \else
    \PackageInfo{caption2}{float package v1.2 (or newer) detected}
%    \end{macrocode}
%
% \begin{macro}{\caption@floatc}
% First we define a helper macro to typeset the caption via \cs{usecaptionstyle},
% the 1st parameter is the caption style name,
% the 2nd and 3rd are the caption label and text.
%
% \textsf{caption2} has the goal not to modify the output just by
% loading it (without options), therefore we have to be tricky here to
% support \cs{@fs@cfont} which is in fact the same as our \cs{captionlabelfont}.
% So we test if a \cs{captionlabelfont} has been set by the user -- if not
% \cs{@fs@cfont} will be used, otherwise \cs{captionlabelfont}.
%
% \changes{v2.1b}{19 Mar 04}{\cs{realcaptionwidth}$=$\cs{hsize} was missing here}
%    \begin{macrocode}
    \newcommand\caption@floatc[3]{%
      \ifx\captionlabelfont\@empty
        \let\captionlabelfont\@fs@cfont
      \fi
      \captionlinewidth\hsize
      \realcaptionwidth\hsize
      \def\captionlabel{#2}%
      \def\captiontext{#3}%
      \usecaptionstyle{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\floatc@plain}
% Now we can redefine the caption code of the \textsf{float} package.
% Here we redefine \cs{floatc@plain} to use our caption code, so
% \texttt{plain} and \texttt{boxed} float types will use the actual
% caption style set by the user.
%    \begin{macrocode}
    \renewcommand*\floatc@plain{\caption@floatc{\caption@style}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\floatc@ruled}
% The support of the \texttt{ruled} float type is a little
% more complex. First we define a caption style `ruled' so the end-user
% can change this caption style afterwards. If the (obsolete) option
% `ruled' is set, we define it in a \textsf{caption} v1.x compatible way,
% otherwise we define it in a \textsf{float} compatible way.
%
% Then we redefine \cs{floatc@ruled} so the caption style `ruled' will
% be used.
%    \begin{macrocode}
    \ifcaption@ruled
      \dummycaptionstyle{ruled}{\onelinecaptionsfalse\setcaptionmargin{\z@}}%
    \else
      \newcaptionstyle{ruled}{%
        \ifcaptionlabel
          {\@fs@cfont\captionlabel}\space%
        \fi\captiontext\par}%
    \fi
%
    \renewcommand*\floatc@ruled{\caption@floatc{ruled}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@of}
% Typesetting captions outside floats is not so easy with redefined floats,
% because
% \begin{itemize}
% \item The caption code of the \textsf{float} package needs not only
% \cs{@captype} defined, but \cs{@fs@capt} (the command which will typeset the
% caption itself) either.
% \item The caption is only saved within a \cs{vbox}, so the \textsf{float}
% package can typeset the caption later at it's float style specific place
% (that means at top or at the bottom of the float).
% \end{itemize}
%
% Here is the new code: First we check if it's a restyled float by checking if
% \cs{fst@<floattype>} is defined. If yes, we use this command (it will define
% \cs{@fs@capt}).
% Then we execute \cs{@float@setevery}, if it exists (that means we are
% dealing with the \textsf{float} package 1.3 or newer here).
% Now comes the basic trick:
% We redefine the caption typesetting command \cs{@fs@capt}, so it will close
% the \cs{vbox}, typeset the caption outside the vbox and finally start the
% group again so the original \cs{@fs@capt} is happy with closing the group.
%
%    \begin{macrocode}
    \renewcommand*\caption@of[2]{\def\@captype{#2}%
      \@ifundefined{fst@#2}{}{%
        \@nameuse{fst@#2}%
        \@ifundefined{@float@setevery}{}{\@float@setevery{#2}}%
        \let\caption@fs@capt\@fs@capt
        \let\@fs@capt\caption@of@float}%
      #1}
%    \end{macrocode}
%
%    \begin{macrocode}
    \newcommand\caption@of@float[2]{\egroup
      \vskip\abovecaptionskip
      \normalsize\caption@fs@capt{#1}{#2}%
      \vskip\belowcaptionskip
      \bgroup}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  \fi}
%    \end{macrocode}
%
% \subsubsection{Support of the \puresf{longtable} package}
%
%    \begin{macrocode}
\caption@package{longtable}{LT@makecaption}{}{%
  \ifx\LT@makecaption\relax
    \PackageWarning{caption2}{%
      Option `longtable' was set but there is no longtable package loaded}
  \else
    \PackageInfo{caption2}{longtable package v3.15 (or newer) detected}
%    \end{macrocode}
%
% \begin{macro}{\LT@makecaption}
% David Carlisle was so kind to introduce a macro called
% \cs{LT@makecaption} in version 3.15 of the \textsf{longtable}
% package which typeset the caption and can be easily redefined.
%
% This is the original definition:
% \begin{quote}
% |\def\LT@makecaption#1#2#3{%|\\
% |  \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%|\\
% |    |$\langle$\textit{typeset} |#1{#2: }#3| \textit{as caption}$\rangle$\\
% |    \endgraf\vskip\baselineskip}%|\\
% |  \hss}}}|
% \end{quote}
%
% So we do here:
% First we define a new (dummy) caption style `longtable',
% than we redefine \cs{LT@makecaption} so this style will be used.
% (Remember: |#1| is |\@gobble| in star form of |\caption|,
% and |\@firstofone| otherwise.)
%    \begin{macrocode}
    \dummycaptionstyle{longtable}{}
%
    \renewcommand\LT@makecaption[3]{%
      \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{%
        \ifignoreLTcapwidth
        \else
          \setcaptionwidth\LTcapwidth
        \fi
        \captionlinewidth\hsize
        \realcaptionwidth\hsize
        \captionlabelfalse#1\captionlabeltrue
        \def\captionlabel{#2}%
        \def\captiontext{#3}%
        \usecaptionstyle{longtable}%
        \endgraf\vskip\baselineskip}%
      \hss}}}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  \fi}
%    \end{macrocode}
%
% \subsubsection{Support of the \puresf{subfigure} package}
%
% Some of the following code will not work within \cs{if},
% because of the (yet) undefined \cs{if}\textit{xxx}s. So we simply define
% the critical code within the helper commands \cs{setsubcapstyle}
% and \cs{caption@makesubcaption} already here.
%
% \begin{macro}{\setsubcapstyle}
% This sets the subcaptionstyle to a appropriate value.
%
% If \cs{ifsubcapraggedright} is undefined (it was introduced
% into v2.1 of the \textsf{subfigure} package) we define it first.
%    \begin{macrocode}
\newcommand*\setsubcapstyle{%
  \@ifundefined{subcapraggedrightfalse}{%
    \newif\ifsubcapraggedright}{}%
  \ifsubcaphang
    \ifsubcapcenter
      \subcapstyle{hang+center}%
    \else\ifsubcapcenterlast
      \subcapstyle{hang+centerlast}%
    \else\ifsubcapraggedright
      \subcapstyle{hang+flushleft}%
    \else
      \subcapstyle{hang}%
    \fi\fi\fi
  \else\ifsubcapcenter
    \subcapstyle{center}%
  \else\ifsubcapcenterlast
    \subcapstyle{centerlast}%
  \else\ifsubcapraggedright
    \subcapstyle{flushleft}%
  \else
    \subcapstyle{normal}%
  \fi\fi\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@makesubcaption}
% This will typeset the subcaption.
% We just set all our \cs{caption}\textit{xxx} values to
% the values of \cs{subcap}\textit{xxx} and typeset the
% caption like \textsf{subfigure} within a \cs{hbox},
% but with the help of \cs{usecaptionstyle}.
%
% But this is not as easy as it seems. We typeset the caption like this:
% \begin{quote}
%   |\captionfont|\\
%   |  {\capionlabelfont\captionlabel\captionlabeldelim}%|\\
%   |\captionlabelsep\captiontext|
% \end{quote}
% Within \textsf{subfigure} 2.0 the caption will be set quite similar to:
% \begin{quote}
%   |\subcapsize|\\
%   |  {\subcaplabelfont\captionlabel}%|\\
%   |\space\captiontext|
% \end{quote}
% But within \textsf{subfigure} 2.1 this has changed to:
% \begin{quote}
%   |\subcapsize|\\
%   |  {\subcaplabelfont\captionlabel}%|\\
%   |\hskip\subfiglabelskip|\\
%   |  {\subcapfont\captiontext}}|
% \end{quote}
% So we have to be tricky here: We set \cs{captionlabelfont} to \cs{normalfont} plus
% \cs{subcapsize} \& \cs{subcaplabelfont}, so the font setting in \cs{captionfont}
% will not affect the caption label in subfigure captions.
%
% Note that \cs{hfil} has changed to \cs{hss} from subfigure 2.0 to 2.1,
% so we use \cs{caption@subfig@hss} instead. (We will define this later on.)
%    \begin{macrocode}
\newcommand\caption@makesubcaption[2]{%
  \renewcommand*\captionfont{\subcapsize\subcapfont}%
  \renewcommand*\captionlabelfont{\normalfont\subcapsize\subcaplabelfont}%
  \let\captionlabeldelim\subcaplabeldelim
  \let\captionlabelsep\subcaplabelsep
  \ifsubfigcapwidth\captionwidthtrue\else\captionwidthfalse\fi
  \setlength\captionmargin\subfigcapmargin
  \setlength\captionwidth\subfigcapwidth
  \captionindent\subcapindent
  \ifsubcapnooneline\onelinecaptionsfalse\else\onelinecaptionstrue\fi
  \hbox to\@tempdima{%
    \caption@subfig@hss\parbox[t]\@tempdima{%
      \captionlinewidth\@tempdima
      \realcaptionwidth\@tempdima
      \captionlabeltrue
      \def\captionlabel{#1}%
      \def\captiontext{\ignorespaces #2}%
      \usecaptionstyle\caption@substyle}%
    \caption@subfig@hss}}
%    \end{macrocode}
% \end{macro}
%
% If the subfigure support is not needed, we throw
% the helper macros in the garbage can.
%
%    \begin{macrocode}
\caption@package{subfigure}{@makesubfigurecaption}{%
  \let\setsubcapstyle\undefined
  \let\caption@makesubcaption\undefined}{%
  \ifx\@makesubfigurecaption\relax
    \PackageWarning{caption2}{%
      Option `subfigure' was set but there is no subfigure package loaded}
    \let\setsubcapstyle\undefined
    \let\caption@makesubcaption\undefined
  \else
%    \end{macrocode}
%
% Some stuff has changed from version 2.0 to 2.1 of the
% \textsf{subfigure} package, so we make a branch here.
% If \cs{subcapfont} is undefined we assume v2.0,
% otherwise we assume v2.1 or newer.
%
%    \begin{macrocode}
    \ifx\subcapfont\undefined
      \PackageInfo{caption2}{subfigure package v2.0 detected}
%    \end{macrocode}
%
% \begin{macro}{\subcapfont}
% We define \cs{subcapfont} here so we can use it later
% in common code for \textsf{subfigure} v2.0 and v2.1 (or newer).
%    \begin{macrocode}
      \let\subcapfont\@empty
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subfigcapwidth}
% \begin{macro}{\setsubcapmargin}
% \begin{macro}{\setsubcapwidth}
% Analogous to \cs{captionwidth}, \cs{setcaptionmargin}, and
% \cs{setcaptionwidth} we define \cs{subfigcapwidth},
% \cs{setsubcapmargin}, and \cs{setsubcapwidth}.
%
% Note: \cs{subfigcapmargin} is a command in v2.0 of \textsf{subfigure}.
% So we make \cs{subfigcapwidth} a command, too.
%    \begin{macrocode}
      \newcommand*\subfigcapwidth{\z@}
      \newcommand*\setsubcapmargin{%
        \subfigcapwidthfalse
        \renewcommand*\subfigcapmargin}
      \newcommand*\setsubcapwidth{%
        \subfigcapwidthtrue
        \renewcommand*\subfigcapwidth}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\subcaplabelsep}
% Analogous to \cs{captionlabelsep} we define \cs{subcaplabelsep}.
%    \begin{macrocode}
      \newcommand*\subcaplabelsep{\space}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@subfig@hss}
% This will be uses within the caption code itself.
%    \begin{macrocode}
      \let\caption@subfig@hss\hfil
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
    \else
      \PackageInfo{caption2}{subfigure package v2.1 (or newer) detected}
%    \end{macrocode}
%
% \begin{macro}{\subfigcapwidth}
% \begin{macro}{\setsubcapmargin}
% \begin{macro}{\setsubcapwidth}
% Analogous to \cs{captionwidth}, \cs{setcaptionmargin}, and
% \cs{setcaptionwidth} we define \cs{subfigcapwidth},
% \cs{setsubcapmargin}, and \cs{setsubcapwidth}.
%
% Note: \cs{subfigcapmargin} is a length in v2.1 of \textsf{subfigure}.
% So we make \cs{subfigcapwidth} a length, too.
%    \begin{macrocode}
      \newdimen\subfigcapwidth
      \newcommand*\setsubcapmargin{%
        \subfigcapwidthfalse
        \setlength\subfigcapmargin}
      \newcommand*\setsubcapwidth{%
        \subfigcapwidthtrue
        \setlength\subfigcapwidth}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\subcaplabelsep}
% Analogous to \cs{captionlabelsep} we define \cs{subcaplabelsep}.
%    \begin{macrocode}
      \newcommand*\subcaplabelsep{\hskip\subfiglabelskip}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@subfig@hss}
% This will be uses within the caption code itself.
%    \begin{macrocode}
      \let\caption@subfig@hss\hss
%    \end{macrocode}
%
% \end{macro}
%    \begin{macrocode}
    \fi
%    \end{macrocode}
%
% Here starts the common code for \textsf{subfigure} v2.0 and v2.1.
%
% \begin{macro}{\ifsubfigcapwidth}
% \begin{macro}{\subcapindent}
% \begin{macro}{\subcaplabeldelim}
% Analogous to \cs{ifcaptionwidth}, \cs{captionindent} \& \cs{captionlabeldelim}
% we define \cs{ifsubfigcapwidth}, \cs{subcapindent} \& \cs{subcaplabeldelim}
%    \begin{macrocode}
    \newif\ifsubfigcapwidth
    \newdimen\subcapindent
    \newcommand*\subcaplabeldelim{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\subcapstyle}
% Analogous to \cs{captionstyle} we define \cs{subcapstyle}
% and set it (via \cs{setsubcapstyle}) to a appropriate value.
%    \begin{macrocode}
    \newcommand*\subcapstyle[1]{%
      \expandafter\ifx\csname caption@@#1\endcsname\relax
        \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}%
      \else
        \def\caption@substyle{#1}%
      \fi}
    \setsubcapstyle
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@thesubfigure}
% \begin{macro}{\@thesubtable}
% The \textsf{subfigure} package makes use of \cs{subcaplabelfont} and
% \cs{subfiglabelskip} within its \cs{@thesub}\textit{xxx} macros.
% This is totally in contrast to the way the \textsf{caption2} package
% handle these settings. So we redefine the \cs{@thesub}\textit{xxx}
% to be just the plain label and nothing else.
%
%    \begin{macrocode}
    \renewcommand*\@thesubfigure{\thesubfigure}
    \renewcommand*\@thesubtable{\thesubtable}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@makesubfigurecaption}
% \begin{macro}{\@makesubtablecaption}
% Now we are ready to redefine \cs{@makesubfigurecaption}.
%    \begin{macrocode}
    \let\@makesubfigurecaption\caption@makesubcaption
    \let\@makesubtablecaption\caption@makesubcaption
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
  \fi}
%    \end{macrocode}
%
% That's all folks!
%
%    \begin{macrocode}
\let\caption@package\undefined
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
%
% \begin{thebibliography}{9}
% \bibitem{float}
%   Anselm Lingnau:
%   \textsl{An Improved Environment for Floats},
%   2001/11/08
% \bibitem{longtable}
%   David Carlisle:
%   \textsl{The longtable package},
%   2000/10/22
% \bibitem{rotating}
%   Sebastian Rahtz and Leonor Barroca:
%   \textsl{A style option for rotated objects in \LaTeX},
%   1997/09/26
% \bibitem{subfigure}
%   Steven Douglas Cochran:
%   \textsl{The subfigure package},
%   2002/02/14
% \bibitem{A-W:GMS94}
%   Michel Goossens, Frank Mittelbach and Alexander Samarin:
%   \newblock \textsl{The {\LaTeX} Companion},
%   \newblock Addison-Wesley, Reading, Massachusetts, 1994.
% \bibitem{Anne}
%   Anne Br\"uggemann-Klein:
%   \textsl{Einf\"uhrung in die Dokumentverarbeitung},
%   B.G. Teubner, Stuttgart, 1989
% \bibitem{Kopka-E}
%   Helmut Kopka:
%   \textsl{\LaTeX -- Erweiterungsm\"oglichkeiten},
%   3. \"uberarbeitete Auf\/lage, Addison-Wesley, Bonn, 1991
% \end{thebibliography}
%
% \Finale
%
\endinput