summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/caption2.dtx
blob: eb4883c0595a532feff3c7d11d435e872001039e (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
% \iffalse meta-comment
% 
% This is file `caption2.dtx'.
% 
% $Id: caption2.dtx 117 2015-09-20 20:43:35Z sommerfeldt $
% $HeadURL: svn+ssh://sommerfeldt@svn.code.sf.net/p/latex-caption/code/branches/3.3/source/caption2.dtx $
%
% Copyright (C) 1994-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
% 
% --------------------------------------------------------------------------
% 
% 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,
% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx,
% the derived files caption.sty, caption2.sty, caption3.sty,
% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty,
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
% 
% \fi
% \CheckSum{862}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesFile{caption2.drv}%
  [2007/11/28 v2.2 Documentated code of the (obsolete) caption2 package]
\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
%\errorcontextlines=3
%
\documentclass{ltxdoc}
\setlength\parindent{0pt}
\setlength\parskip{\smallskipamount}
%
\usepackage{ifpdf}
\ifpdf
  \usepackage{mathptmx,courier}
  \usepackage[scaled=0.90]{helvet}
% \addtolength\marginparwidth{15pt}
\fi
%
\usepackage{hypdoc}
\ifpdf\usepackage{hypdestopt}\fi
\hypersetup{pdfkeywords={LaTeX, package, caption2},pdfstartpage={},pdfstartview={}}
%
\usepackage{caption2}[2008/07/01]
%
%<+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.drv}
% \let\docdate\filedate
% \GetFileInfo{caption2.sty}
%
% \title{The (obsolete) \texorpdfstring{\package{caption2} package\thanks{%^^A
%          This package has version number \fileversion, last revised \filedate.}}%^^A
%        {caption2 package}}
% \author{Axel Sommerfeldt\\
%         \url{http://sourceforge.net/projects/latex-caption/}}
% \date{\docdate}
% \maketitle
%
% \changes{v2.0}{1995/10/09}{New experimental version: Many new commands and features}
% \changes{v2.0}{1995/10/09}{Support of the longtable package added}
% \changes{v2.1}{2002/02/26}{Adapted to version 2.1 of the subfigure package}
% \changes{v2.1a}{2003/11/12}{Some minor bug fixes and improved compatibility to v2.0}
% \changes{v2.1b}{2004/04/16}{Some minor bug fixes and improved compatibility to v2.0}
% \changes{v2.1c}{2004/05/10}{Some minor bug fixes and improved compatibility to v2.0}
% \changes{v2.1d}{2005/10/03}{Some superfluous brackets removed; warning added}
% \changes{v2.2}{2007/04/06}{Uses the caption3 kernel now}
%
% \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 strong demand for new features and
% adaptations to other packages like the \package{longtable} and
% \package{subfigure} one.
%
% But within 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 in cooperation with
% Frank Mittelbach and Steven Cochran.
% 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.
%
% \vfill
% \bigskip
% \pagebreak[4]
%
% \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 offered by 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. You will also find a section called
% `Compatibility to older versions' there which should help you with the
% migration process.
% 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 of the \package{caption} package bundle,
% 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.
%
% This means migrating to the actual \package{caption} package should not be
% necessary for old documents -- they should still compile fine as they are.
% If not, please don't hesitate to write me an e-mail asking for
% maintainance.
%
% \StopEventually{}
%
% \DoNotIndex{\\,\_,\ ,\@@par}
% \DoNotIndex{\@bsphack}
% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@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]
\def\caption@tempa$Id: #1 #2 #3-#4-#5 #6${%
  \def\caption@tempa{#3/#4/#5 }\def\caption@tempb{#2 }}
\caption@tempa $Id: caption2.dtx 117 2015-09-20 20:43:35Z sommerfeldt $
\ProvidesPackage{caption2}[\caption@tempa v2.2-\caption@tempb Customising captions (AR)]
%    \end{macrocode}
%
% \changes{v2.2b}{2007/06/15}{Made obsolete warning even more annoying}
%    \begin{macrocode}
\PackageWarning{caption2}{%
  ****************************************************\MessageBreak
  THIS PACKAGE IS OBSOLETE:\MessageBreak
  This package attempts to provide an `caption2'\MessageBreak
  package v2.0/2.1 author environment so that OLD\MessageBreak
  documents can be successfully processed. It should\MessageBreak
  NOT be used for NEW documents! New documents should\MessageBreak
  use the regular `caption' package v3.x instead.\MessageBreak
  ****************************************************\@gobbletwo}%
%    \end{macrocode}
%
% \subsection{Loading the caption3 kernel}
%
%    \begin{macrocode}
\RequirePackage{caption3}[2007/09/01] % needs v3.1 or newer
%    \end{macrocode}
%
% \subsection{Check against the regular caption package}
% \changes{v2.2}{2007/04/06}{Check against regular \package{caption} package added}
% \changes{v2.2a}{2007/04/11}{Bugfix: Usage of \cs{caption@error} replaced by \cs{PackageError}}
%
%    \begin{macrocode}
\@ifpackageloaded{caption}{%
  \PackageError{caption2}{%
    You can't use both, the (current) caption *and*\MessageBreak
    the (obsolete) caption2 package}\caption@eh
  \endinput
}{}
%    \end{macrocode}
%
% \subsection{Preliminary declarations}
%
% \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}{\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}
\newcommand*\ifcaptionwidth{\ifdim\captionwidth>\z@}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captionindent}
% \changes{v2.2b}{2007/08/12}{Re-added since the \package{caption3} kernel uses \cs{caption@indent} now}
% \cs{captionindent} will be used in caption style \texttt{indent} and specifies the indention
% after the first line.
%    \begin{macrocode}
\let\captionindent\caption@indent
%    \end{macrocode}
% \end{macro}
%
% \changes{v2.1}{2002/02/20}{New ifs \cs{ifcaptionlabel} and \cs{ifignoreLTcapwidth}}
%
% \begin{macro}{\ifcaptionlabel}
% If \cs{ifcaptionlabel} is not set the caption label should be suppressed;
% we need this flag to support the \cs{caption*} command.
% \changes{v2.2}{2007/04/06}{New definition, based on \cs{ifcaption@star}}
%    \begin{macrocode}
\def\ifcaptionlabel{%
  \ifcaption@star
    \@tempswafalse
  \else
    \@tempswatrue
  \fi
  \if@tempswa}
\def\captionlabeltrue{\caption@starfalse}
\def\captionlabelfalse{\caption@startrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifonelinecaptions}
% 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.
% \changes{v2.2}{2007/04/06}{New definition, based on \cs{caption@ifslc}}
%    \begin{macrocode}
\def\ifonelinecaptions{%
  \caption@ifslc{\@tempswatrue}{\@tempswafalse}%
  \if@tempswa}
\def\onelinecaptionstrue{\caption@setbool{slc}{1}}
\def\onelinecaptionsfalse{\caption@setbool{slc}{0}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifignoreLTcapwidth}
% If \cs{ifignoreLTcapwidth} is set we ignore the \cs{LTcapwidth} of \textsf{longtable}.
%    \begin{macrocode}
\newif\ifignoreLTcapwidth
%    \end{macrocode}
% \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}{2002/01/29}{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}{\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}}
%    \end{macrocode}
%    \begin{macrocode}
\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}}
%    \end{macrocode}
%    \begin{macrocode}
\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}{2002/02/26}{Renamed from \cs{caption@make} to \cs{caption@makecaption}}
% \changes{v2.1b}{2004/04/16}{We offer and use \cs{caption@make}, again}
% \changes{v2.1c}{2004/05/10}{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}}
%    \end{macrocode}
% \end{macro}
%
% \changes{v2.1}{2002/02/26}{Removed all extra parboxes from caption styles}
% \changes{v2.1a}{2003/11/12}{\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}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@@centerlast{%
  \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}
%    \end{macrocode}
%    \begin{macrocode}
\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\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{Declaration of 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@setpackage}
% 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@setpackage[1]{\@namedef{caption@pkt@#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{float}
% \begin{macro}{longtable}
% \begin{macro}{subfigure}
% \changes{v2.1}{2002/02/19}{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@setpackage{float}{1}}
\DeclareOption{longtable}{%
  \caption@twozerofalse\caption@setpackage{longtable}{1}}
\DeclareOption{subfigure}{%
  \caption@twozerofalse\caption@setpackage{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@setpackage{float}{0}\caption@setpackage{longtable}{0}%
  \caption@setpackage{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}{\captionsetup{debug}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Execution of options}
%
% Now we 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}{2002/02/19}{\cs{ProcessOptions} changed to \cs{ProcessOptions*}}
%    \begin{macrocode}
\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}{2002/02/19}{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}{2002/02/19}{\cs{abovecaptionskip} and \cs{belowcaptionskip} will be defined if neccessary}
%    \begin{macrocode}
\caption@ifundefined\abovecaptionskip{%
  \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
\caption@ifundefined\belowcaptionskip{%
  \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionlinewidth}
% \changes{v2.1}{2002/02/26}{Renamed from \cs{realcaptionwidth} to \cs{captionlinewidth}}
% \changes{v2.1a}{2003/11/12}{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}{2004/04/16}{Missing percent added (and extra space removed)}
% \changes{v2.2}{2007/04/06}{\cs{let}\cs{caption@make}\cs{caption@makecaption} added}
%    \begin{macrocode}
\newcommand*\usecaptionstyle[1]{%
  \caption@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}}%
      {\let\caption@make\caption@makecaption
       \@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@ifpackage}
% 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}{2004/05/09}{Compatibility warning removed}
%    \begin{macrocode}
\newcommand*\caption@ifpackage[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
  \caption@ifdebug{%
    \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}{}%
  \next}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Support of the float package}
%
%    \begin{macrocode}
\caption@ifpackage{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}{2004/03/19}{\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
%    \end{macrocode}
%    \begin{macrocode}
    \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}%
        \caption@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 longtable package}
%
%    \begin{macrocode}
\caption@ifpackage{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}{}
%    \end{macrocode}
%    \begin{macrocode}
    \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 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{%
  \caption@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}
% \changes{v2.2c}{2008/07/01}{Bugfix: Usage of \cs{ifcaptionwidth} removed}
% 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
    \setcaptionwidth\subfigcapwidth
  \else
    \setcaptionmargin\subfigcapmargin
  \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@ifpackage{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@ifpackage\undefined
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
%
% \clearpage
% \begin{thebibliography}{9}
%   \bibitem{float}
%   Anselm Lingnau:
%   \href{http://www.ctan.org/pkg/float}%
%        {\emph{An Improved Environment for Floats}},
%   2001/11/08
%
%   \bibitem{longtable}
%   David Carlisle:
%   \href{http://www.ctan.org/pkg/longtable}%
%        {\emph{The longtable package}},
%   2000/10/22
%
%   \bibitem{rotating}
%   Sebastian Rahtz and Leonor Barroca:
%   \href{http://www.ctan.org/pkg/rotating}%
%        {\emph{A style option for rotated objects in \LaTeX}},\\
%   1997/09/26
%
%   \bibitem{subfigure}
%   Steven D. Cochran:
%   \href{http://www.ctan.org/pkg/subfigure}%
%        {\emph{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