summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/caption/bicaption.dtx
blob: 8d51567a6cb39b6dd0c6fd5e1656c3cd7541eb43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
% \iffalse meta-comment
% 
% This is file `bicaption.dtx'.
% 
% Copyright (C) 2010-2022 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, caption-light.dtx, caption2.dtx, caption3.dtx,
%   caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx,
%   caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx,
%   caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx,
% the derived files
%   caption.sty, caption-light.sty, caption2.sty, caption3.sty,
%   caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto,
%   caption-koma.sto, caption-memoir.sto, caption-ntg.sto,
%   caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty.
% 
% \fi
%
% \CheckSum{626}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesFile{bicaption.drv}[2022/03/06 v1.5 Adds a bilingual caption feature to the caption package]
\hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up.
%\errorcontextlines=3
%
\documentclass[german,english]{ltxdoc}
\setlength\parindent{0pt}
\setlength\parskip{\smallskipamount}
%
\usepackage{ifpdf}
\ifpdf
  \usepackage{mathptmx,courier}
  \usepackage[scaled=0.90]{helvet}
  \addtolength\marginparwidth{15pt}
\fi
%
\usepackage[T1]{fontenc}
\usepackage[german,english]{babel}
%\usepackage{selinput}\SelectInputMappings{adieresis={ä},germandbls={ß}}
\usepackage[utf8]{inputenc}
%
\usepackage[bottom]{footmisc}
%
\usepackage{hypdoc}
\ifpdf\usepackage{hypdestopt}\fi
\hypersetup{pdfkeywords={LaTeX, package, bicaption},pdfstartpage={},pdfstartview={}}
%
\usepackage{bicaption}[2016/03/27]
\usepackage{subcaption}[2016/02/21]
%
\newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
\newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
\newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
\let\package\puresf
\let\env\purett \let\opt\purett
%
\newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
\newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
\newcommand*\version[2][]{v$#2$}
%
\usepackage{marvosym}
\makeatletter
\newcommand*\INFO{\@ifstar{\@INFO{}}{\@INFO{\vbox to \ht\strutbox}}}
\newcommand*\@INFO[1]{\MARGINSYM{#1{\LARGE\Info}}}
\makeatother
%
\usepackage[alpine]{ifsym}
\newenvironment{background}{\par\bigskip\csname background*\endcsname}{\csname endbackground*\endcsname}
\newenvironment{background*}{\small\MARGINSYM{\Mountain}\ignorespaces}{\par}
%
\makeatletter
\newcommand*\MARGINSYM[1]{\hskip 1sp \marginpar{\raggedleft\textcolor{blue}{{#1}}}}
\newcommand*\NEW[1]{\@ifstar{\@NEW{#1}{\vskip2pt}}{\@NEW{#1}{}}}
\newcommand*\@NEW[3]{\MARGINSYM{#2\footnotesize#1\\#3}}
\makeatother
%
\newenvironment{Options}[1]%
  {\list{}{\renewcommand\makelabel[1]{\texttt{##1}\hfil}%
   \settowidth\labelwidth{\texttt{#1\space}}%
   \setlength\leftmargin{10pt}%
   \addtolength\leftmargin{\labelwidth}%
   \addtolength\leftmargin{\labelsep}}}%
  {\endlist}
%
\begin{document}
  \DocInput{bicaption.dtx}
\end{document}
%</driver>
% \fi
%
% \let\subsectionautorefname\sectionautorefname
% \let\subsubsectionautorefname\sectionautorefname
%
% \def\thispackage{the \package{bicaption} package}
% \def\Thispackage{The \package{bicaption} package}
%
% \newcommand\NEWfeature{\NEW{New feature}}
% \newcommand\NEWdescription{\NEW{New description}}
%
% \GetFileInfo{bicaption.drv}
% \let\docdate\filedate
% \let\docversion\fileversion
% \GetFileInfo{bicaption.sty}
%
% \title{\texorpdfstring{\Thispackage\thanks{%^^A
%          This package has version number \docversion.}}%^^A
%        {The bicaption package}}
% \author{Axel Sommerfeldt\\
%         \url{https://gitlab.com/axelsommerfeldt/caption}}
% \date{\docdate}
% \maketitle
% 
% \begin{abstract}
% This package supports the typesetting of bilangual captions.
% \end{abstract}
%
% \setcounter{tocdepth}{2}
% \tableofcontents
%
% \clearpage
% \section{Loading the package}
% \label{sec:loading}
%
% This package will be loaded by
% \begin{quote}
%   |\usepackage|\oarg{options}|{bicaption}|\quad.
% \end{quote}
% The options for \thispackage\ are the same ones as for the \package{caption}
% package and specify settings which are used for the second language
% \emph{additionally}.
% In fact
% \begin{quote}
%   |\usepackage|\oarg{options}|{bicaption}|
% \end{quote}
% is identical to
% \begin{quote}
%   |\usepackage{bicaption}|\\
%   |\captionsetup[bi-second]|\marg{options}\quad.
% \end{quote}
%
% When used with the \package{babel} or \package{polyglossia} package, the
% \package{bicaption} package should be loaded \emph{after} it, so the main
% language will be set automatically. See \autoref{sec:babel} for details.
%
% \section{Setting options}
% \label{sec:options}
%
% \DescribeMacro\captionsetup
% The command
% \begin{quote}
%   |\captionsetup[bi]|\marg{options}
% \end{quote}
% does setup options which will be used for bilanguage captions \emph{additionally}
% to the ones which are setup for the specific floating environment.
%
% \begin{quote}
%   |\captionsetup[bi-first]|\marg{options}
% \end{quote}
% does setup options which will be used for the \emph{first} heading
% of the bilanguage captions \emph{additionally}
% to the ones which are setup for the specific floating environment
% and the ones which are setup by |\captionsetup[bi]{|\ldots|}|.
%
% \begin{quote}
%   |\captionsetup[bi-second]|\marg{options}
% \end{quote}
% does setup options which will be used for the \emph{second} heading
% of the bilanguage captions \emph{additionally}
% to the ones which are setup for the specific floating environment
% and the ones which are setup by |\captionsetup[bi]{|\ldots|}|.
%
% \bigskip
%
% Options specified with |\use|\-|package[|\ldots|]{bi|\-|cap|\-|tion}| and
% |\cap|\-|tion|\-|setup[bi|\ldots|]{|\ldots|}| will override the ones specified by
% |\cap|\-|tion|\-|setup{|\ldots|}| and |\cap|\-|tion|\-|setup[fig|\-|ure]{|\ldots|}|
% (same for `table'). So finally we have the following order how
% settings for bilingual captions are applied:
% \begin{enumerate}
% \item Global settings
%  {\small(|\usepackage[|\ldots|]{caption}| and |\captionsetup{|\ldots|}|)}
% \item Environmental settings
%  {\small(|\captionsetup[figure|\emph{ -or- }|table]{|\ldots|}|)}
% \item Local settings
%  {\small(|\captionsetup{|\ldots|}| inside |figure| or |table| environment)}
% \item Custom `bi' settings
%  {\small(|\captionsetup[bi]{|\ldots|}|)}
% \item Custom `bi-first' resp.~`bi-second' settings
%  {\small(|\usepackage[|\ldots|]{bicaption}| and
%          |\caption|\-|setup[bi-first]{|\ldots|}|
%    resp.~|\caption|\-|setup[bi-second]{|\ldots|}|)}
% \end{enumerate}
% An example:
% \begin{quote}
%   |\usepackage[labelsep=quad,indention=10pt]{caption}|\\
%   |\usepackage[labelfont=bf]{bicaption}|\\
%   |\captionsetup[table]{labelfont=it,position=top}|
% \end{quote}
% causes the second heading of the bilingual caption inside |table| environments
% to be typeset with the settings
% \begin{quote}
%   |labelsep=quad,indention=10pt,position=top,labelfont=bf|~.
% \end{quote}
%
% \bigskip
%
% To limit |bi|, |bi-first|, or |bi-second| options to specific environments one can use
% multiple optional arguments for |\caption|\-|setup|, e.g.:
% \begin{quote}
%   |\captionsetup[figure][bi-first]|\oarg{options}
% \end{quote}
% will limit the settings to the first heading of |figure| environments only.
% Please note that the environment name (|figure|, |table|, \ldots) has to be specified
% as first optional argument while the bilingual selection (|bi|, |bi-first|, or |bi-second|)
% as second one.
%
% \section{Additional options}
% \label{sec:additional-options}
%
% These options are available additional to the ones offered by the
% \package{caption} package:
%
% \begin{Options}{language=}
%   \item[lang=]
%   Sets the language of the caption, e.g.
%   \begin{quote}|\use|\-|package|\-|[lang=eng|\-|lish]{bi|\-|caption}|\end{quote}
%   will typeset the second caption of bilingual captions in English.
%   (The language will be set with |\select|\-|caption|\-|language| internally,
%    see \autoref{sec:babel} for details.)
%
%   \item[bi-lang=]
%   Causes a selection of the headings of bilingual captions.
%   \begin{quote}|\captionsetup{bi-lang=both}|\end{quote}
%   will cause that both caption headings are being typeset.\\
%   (This is the default.)
%   \begin{quote}|\captionsetup{bi-lang=first}|\end{quote}
%   will cause that only the \emph{first} heading is being typeset, and
%   \begin{quote}|\captionsetup{bi-lang=second}|\end{quote}
%   will cause that only the \emph{second} heading is being typeset.
%
%   \item[bi-slc=]
%   \begin{quote}|\captionsetup{bi-slc=|\meta{bool}|}|\end{quote}
%   switches the common single-line-check |on| or |off|, i.e.~when switched on
%   only a single check will be done for both captions, and the result will affect
%   both captions afterwards. So if only one caption is longer than a single line,
%   both captions will be treated as if they are longer than a single line, even if
%   the second one isn't. (The default is |on|.)
%
%   \item[bi-swap=]
%   \begin{quote}|\captionsetup{bi-swap}|\end{quote}
%   will swap the primary and secondary language,
%   making the first language the second one and vice versa. (The default is |false|.)
%
%   \item[bi-separator=]
%   \NEWfeature{v1.3}
%   The vertical distance between the first and second bilingual caption is usually
%   determined by the \TeX\ skips set by |\normal|\-|size| which is applied right
%   before both captions get typesetted.
%   (This behaviour is inherited from the original \LaTeX\ code for |\caption| which
%   applies |\normal|\-|size| right before |\@make|\-|caption|, too.)
%   \begin{quote}|\captionsetup{bi-separator=|\meta{name}|}|\end{quote}
%   will select an additional separator between first and second bilingual caption.
%   You could choose one of the following: `none' (which is the default one
%   and could also be addressed as `default'), `smallskip', `medskip',
%   `largeskip', or a self-defined one using
%   \DescribeMacro{\DeclareBiCaption-\\Separator}
%   \begin{quote}|\DeclareBiCaptionSeparator|\marg{name}\marg{code}\end{quote}
%   Examples:
%   \begin{quote}
%     |\captionsetup{bi-separator=smallskip}|
%   \end{quote}
%   will put a |\smallskip| between the two bilingual captions.
%   \begin{quote}
%     |\DeclareBiCaptionSeparator{hrule}{\hrule}|\\
%     |\captionsetup{bi-separator=hrule}|
%   \end{quote}
%   will draw a horizontal line between the two bilingual captions.
%   \begin{quote}
%     |\DeclareBiCaptionSeparator{3pt}{\vspace{3pt}}|\\
%     |\captionsetup{bi-separator=3pt}|
%   \end{quote}
%   will place |3pt| extra vertical space between the two bilingual captions.
%   \par\medskip
%   \textit{Note:} In contrast to the original \LaTeX\ code for |\caption| the
%   \package{caption} package does not apply |\normal|\-|size| directly
%   but will apply the caption font definition |normal|\-|size| instead
%   (which is usually defined as |\normal|\-|size|).
%   Therefore the vertical space between both captions
%   could also be influenced by redefining it, e.g.:
%   |\Declare|\-|Caption|\-|Font{normal|\-|size}{|\ldots|}|
% \end{Options}
%
% \section{The \cs{bicaption} commands}
% \label{sec:bicaption}
%
% \DescribeMacro\bicaption
% Bilingual captions will be typeset by
% \begin{quote}
%   |\bicaption|\oarg{list entry \#1}\marg{heading \#1}\\
%   |          |\oarg{list entry \#2}\marg{heading \#2}\\
%   |\bicaption*|\marg{heading \#1}\marg{heading \#2}
% \end{quote}
% The |\label| should be placed either after this command, or inside the first heading.
%
% \DescribeMacro\bicaptionbox
% Bilingual caption boxes will be typeset by
% \begin{quote}
%   |\bicaptionbox|\oarg{list entry \#1}\marg{heading \#1}\\
%   |             |\oarg{list entry \#2}\marg{heading \#2}\\
%   |             |\oarg{width}\oarg{inner-pos}\marg{contents}\\
%   |\bicaptionbox*|\marg{heading \#1}\marg{heading \#2}\\
%   |              |\oarg{width}\oarg{inner-pos}\marg{contents}
% \end{quote}
% The |\label| should be placed inside the first heading.
%
% \begingroup\small
% (For a description of the optional parameters \meta{width} and \meta{inner-pos}
% please take a look at the \package{caption} package documentation,
% \cs{captionbox}.)
% \endgroup
%
% \pagebreak[3]
% \section{Customising lists}
% \label{sec:lists}
%
% \DescribeMacro{list=}
% As default both caption texts will be insert into the List of Figures resp. List of Tables.
% To suppress the second entry just pass the option |list=off| to the \package{bicaption}
% package, e.g.:
% \begin{quote}
%   |\usepackage[lang=english,|\ldots|,list=off]{bicaption}|
% \end{quote}
%
% \pagebreak[3]
% \DescribeMacro{listtype+=}
% Another option is separating the lists. For that purpose the option
% \begin{quote}
%   |listtype+=|\meta{list type extension}
% \end{quote}
% can be used to tell the \package{bicaption} package to use a different list
% for the second caption text.
% The given value will be appended to the current environment type;
% for example with |listtype+=X| the list entries will be put into the list
% responsible for the types
% |figureX| ($=$ |figure| $+$ |X|), |tableX| ($=$ |table| $+$ |X|) etc.
%
% Such a \meta{list type} can be defined using |\Declare|\-|Floating|\-|Environment|
% offered by the \package{newfloat} package, but some document classes
% or other packages offer macros for defining new floating environment types
% (and their corresponding lists) as well.
%
% A sample document:
% \begin{quote}
%   |\documentclass[a4paper]{article}|\\
%   ||\\
%   |% Use "ngerman" as 1st language, "english" as 2nd one|\\
%   |\usepackage[english,ngerman]{babel}|\\
%   ||\\
%   |% Load the bicaption package with 2nd language set to|\\
%   |% "english", and list type "figureEng" resp. "tableEng"|\\
%   |\usepackage[lang=english,listtype+=Eng]{bicaption}|\\
%   ||\\
%   |\usepackage{newfloat}|\\
%   |% Define type "figureEng" and \listoffigureEng|\\
%   |\DeclareFloatingEnvironment[fileext=lof2]{figureEng}|\\
%   |                   [Figure][List of Figures]|\\
%   |% Define type "tableEng" and \listoftableEng|\\
%   |\DeclareFloatingEnvironment[fileext=lot2]{tableEng}|\\
%   |                   [Table][List of Tables]|\\
%   ||\\
%   |\begin{document}|\\
%   ||\\
%   |\listoffigures    % typeset "Abbildungsverzeichnis"|\\
%   |\listoffigureEng  % typeset "List of Figures"|\\
%   ||\\
%   |\begin{figure}|\\
%   |  \centering|\\
%   |  A placeholder for an image or whatever|\\
%   |  \bicaption{Deutscher Text}{English text}|\\
%   |\end{figure}|\\
%   ||\\
%   |\end{document}|
% \end{quote}
%
% \pagebreak[3]
% A different approach is using one list for both languages, but with different formatting.
% Since the \package{caption} package does not offer options and commands for
% customising the format of the lists, one need an additional package for this purpose,
% for example the \package{titletoc} package:
%
% \begin{quote}
%   |\documentclass[a4paper]{article}|\\
%   ||\\
%   |% Use "ngerman" as 1st language, "english" as 2nd one|\\
%   |\usepackage[english,ngerman]{babel}|\\
%   ||\\
%   |% Load the bicaption package with 2nd language set to|\\
%   |% "english", and list type "figure2" resp. "table2"|\\
%   |\usepackage[lang=english,listtype+=2]{bicaption}|\\
%   ||\\
%   |% We load the titletoc package for customizing lists|\\
%   |% Note: Loading titletoc should be done prior|\\
%   |% defining additional floating environments with|\\
%   |% \DeclareFloatingEnvironment|\\
%   |\usepackage{titletoc}|\\
%   ||\\
%   |\usepackage{newfloat}|\\
%   |% Define the new floating environment type "figure2"|\\
%   |% Use the same file extension as for "figure" (.lof) here|\\
%   |\DeclareFloatingEnvironment[fileext=lof]{figure2}|\\
%   |% Define the new floating environment type "table2"|\\
%   |% Use the same file extension as for "table" (.lot) here|\\
%   |\DeclareFloatingEnvironment[fileext=lot]{table2}|\\
%   ||\\
%   |% We use the titletoc package for customizing "figure2"|\\
%   |% which is appropriate for the second language captions|\\
%  \iffalse
%   |\contentsuse{figure2}{lof}|\\
%  \fi
%   |\titlecontents{figure2}[3.8em]|\\
%   |  {} % no above code|\\
%   |  {} % empty numbered entry format|\\
%   |  {} % empty numberless entry format|\\
%   |  {} % empty filler page format|\\
%   ||\\
%   |\begin{document}|\\
%   ||\\
%   |\renewcommand\listfigurename|\\
%   |  {Abbildungsverzeichnis / List of Figures}|\\
%   |\listoffigures|\\
%   ||\\
%   |\begin{figure}|\\
%   |  \centering|\\
%   |  A placeholder for an image or whatever|\\
%   |  \bicaption{Deutscher Text}{English text}|\\
%   |\end{figure}|\\
%   ||\\
%   |\end{document}|
% \end{quote}
%
% \section{Language Selection}
% \label{sec:babel}
%
% For language selection \thispackage\ uses two macros internally:
%
% \medskip
%
% \DescribeMacro\captionmainlanguage
% |\caption|\-|main|\-|lan|\-|guage| contains the main language, for example
% `french' or `german'.
% If not set manually, \thispackage\ will try to obtain this setting from
% the \package{babel} or \package{polyglossia} package after the preamble of
% the document, i.e.~at |\begin{doc|\-|u|\-|ment}|.
%
% So if you are using either \package{babel} or \package{polyglossia}, and want to inherit
% the main language setting from it, then simply forget about the
% |\caption|\-|main|\-|lan|\-|guage| stuff and skip the rest of the section.
%
% \pagebreak[3]
% Otherwise one can define |\caption|\-|main|\-|lan|\-|guage| manually, e.g.:
% \begin{quote}
%   |\newcommand\captionmainlanguage{french}|\\
%   |\usepackage[lang=english]{bicaption}|
% \end{quote}
%
% \pagebreak[3]
% Note: Prior to \version{1.5} |\caption|\-|main|\-|language| needed to be defined
% \emph{before} loading \thispackage. Since \version{1.5} is could be defined either
% before or after loading \thispackage.
%
% \medskip
%
% \DescribeMacro\selectcaptionlanguage
% \NEWfeature*{v1.1}
% |\select|\-|caption|\-|lan|\-|guage| will be used internally  to select the language:
% \begin{quote}
%   |\selectcaptionlanguage|\marg{font-or-list-entry}\marg{language}
% \end{quote}
% For setting the language of the caption \meta{font-or-list-entry} will be |\@first|\-|of|\-|two|,
% for setting the language of the list entry \meta{font-or-list-entry} will be
% |\@second|\-|of|\-|two|.~\footnote{\cs{@firstoftwo} and \cs{@secondoftwo} are defined
% in the \LaTeX\ kernel and simply pick either the 1st or 2nd argument.}
% It defaults to |\select@lan|\-|guage| (caption) resp.~|\select|\-|lan|\-|guage| (list entry)
% offered by the \package{babel} and \package{polyglossia} package:
% \begin{quote}
%   |\providecommand*\selectcaptionlanguage[2]{%|\\
%   |  #1{\select@language}{\selectlanguage}{#2}}|
% \end{quote}
% If you need to alter this, just either define |\select|\-|caption|\-|lan|\-|guage| prior
% loading \thispackage, or redefine it afterwards.
%
% \pagebreak[3]
% Example document using \package{babel}:
% \begin{quote}
%   |\documentclass[a4paper]{article}|\\
%   ||\\
%   |% Use "ngerman" as 1st language, "english" as 2nd one|\\
%   |\usepackage[english,ngerman]{babel}|\\
%   ||\\
%   |% Add custom translations to babel|\\
%   |\addto\captionsgerman{%|\\
%   |% \renewcommand\whatevername{Wasauchimmer}%|\\
%   |% |\ldots\\
%   |}|\\
%   |\addto\captionsenglish{%|\\
%   |% \renewcommand\whatevername{Whatever}%|\\
%   |% |\ldots\\
%   |}|\\
%   ||\\
%   |% Load the bicaption package with 2nd language set to|\\
%   |% "english"|\\
%   |\usepackage[lang=english]{bicaption}|\\
%   ||\\
%   |\begin{document}|\\
%   ||\\
%   |\begin{figure}|\\
%   |  \centering|\\
%   |  A placeholder for an image or whatever|\\
%   |  \bicaption{Deutscher Text}{English text}|\\
%   |\end{figure}|\\
%   ||\\
%   |\end{document}|
% \end{quote}
%
% \pagebreak[3]
% The same example document but using a custom implementation of
% |\caption|\-|main|\-|language| and |\select|\-|caption|\-|language|
% instead of \package{babel}:
% \begin{quote}
%   |\documentclass[a4paper]{article}|\\
%   ||\\
%   |% Load the bicaption package with 2nd language set to|\\
%   |% "english"|\\
%   |\usepackage[lang=english]{bicaption}|\\
%   ||\\
%   |% Set "german" as main bi-caption language|\\
%   |\newcommand\captionmainlanguage{german}|\\
%   ||\\
%   |% Declare an own language switching mechanism|\\
%   |% for bi-captions (instead of using babel)|\\
%   |\renewcommand\selectcaptionlanguage[2]{%|\\
%   |  \csname captions#2\endcsname}|\\
%   |\newcommand\captionsgerman{%|\\
%   |  \renewcommand\figurename{Abbildung}%|\\
%   |  \renewcommand\tablename{Tabelle}%|\\
%   |% \renewcommand\whatevername{Wasauchimmer}%|\\
%   |% |\ldots\\
%   |}|\\
%   |\newcommand\captionsenglish{%|\\
%   |  \renewcommand\figurename{Figure}%|\\
%   |  \renewcommand\tablename{Table}%|\\
%   |% \renewcommand\whatevername{Whatever}%|\\
%   |% |\ldots\\
%   |}|\\
%   ||\\
%   |\begin{document}|\\
%   ||\\
%   |\begin{figure}|\\
%   |  \centering|\\
%   |  A placeholder for an image or whatever|\\
%   |  \bicaption{Deutscher Text}{English text}|\\
%   |\end{figure}|\\
%   ||\\
%   |\end{document}|
% \end{quote}
%
% \pagebreak[3]
% \NEWfeature{v1.5}
% Since \version{1.5} a warning is issued if the main language could neither be
% detected automatically nor was it set explicitly by the user.
% If you really don't want to set languages for bi-captions but are annoyed by
% the warning you could trick the \package{bicaption} by defining a custom
% dummy language-selection mechanism, e.g.:
% \begin{quote}
%   |\newcommand\captionmainlanguage{dummy}|\\
%   |\renewcommand\selectcaptionlanguage[2]{}|\\
% \end{quote}
%
% \medskip
%
% \DescribeMacro{\DeclareCaption-\\LangOption}
% \NEWfeature*{v1.2}
% For internal implementation reasons the selection of language will be done delayed,
% i.e.~not done immediately at |lang=|\meta{language}. So if you do
% \begin{quote}
%   |\captionsetup[bi-second]{lang=ngerman,labelsep=quad}|
% \end{quote}
% the language |ngerman| will only be stored internally, and the label separator will
% be set to |quad| afterwards. Some time later, right before the caption is actually
% typeset, the language will be set to |ngerman|.
%
% Usually this is no problem, but think of options which will be overwritten by the
% language selection, or options which act on the language currently set, for example
% \begin{quote}
%   |\captionsetup[bi-second]{lang=ngerman,name=Bild}|\quad.
% \end{quote}
% |lang=ngerman| changes the environment name to ``Abbildung'', and |name=Bild|
% changes the environment name to ``Bild''. One would expect that the name is
% finally ``Bild'', but because of the delayed nature of |lang=ngerman| it will
% be ``Abbildung'' instead, at least if we don't take action about this.
%
% For that reason the command
% \begin{quote}
%   |\DeclareCaptionLangOption|\marg{caption option name}
% \end{quote}
% is offered. Options handled this way will be applied twice if used after the |lang=|
% option, when the option is actually used, and right after the language is selected.
%
% \begin{quote}
%   |\DeclareCaptionLangOption{name}|
% \end{quote}
% will be done by \thispackage\ automatically, since the environment name will usually
% be overwritten by a language selection. So actually
% \begin{quote}
%   |\captionsetup[bi-second]{lang=ngerman,name=Bild}|
% \end{quote}
% will give the expected result, i.e. the environment name is typeset as ``Bild''.
%
% \section{Required packages}
% \label{sec:caption}
%
% \NEWfeature{v1.4}
% Starting with version $1.4$ the \package{bicaption} package requires at least version $3.2$
% of the \package{caption} package and loads it automatically.
% (Older versions of the \package{bicaption} package have required exactly the version of the
% \package{caption} package which was released with it.)
%
% \pagebreak[3]
% If you need to use a specific version of the \package{caption} package you need to load it
% \emph{before} the \package{bicaption} package, e.g.:
% \begin{quote}
%   |\usepackage[| \ldots |]{caption}[=v3.5]|\\
%   |\usepackage[| \ldots |]{bicaption}|
% \end{quote}
%
% \pagebreak[3]
% Note that there are limitations if an older version of the \package{caption} package
% is used:
% \begin{itemize}
%   \item Full support of list entries of the \env{lstlisting} environment
%         (offered by the \package{listings} package) needs at least \package{caption} \version{3.6}.
% \end{itemize}
%
% \section{Supported packages}
% \label{sec:packages}
%
% The \package{bicaption} package was adapted to the following packages which deals with captions, too:
% \package{listings}~\cite{listings}, \package{longtable}~\cite{longtable}, and \package{subcaption}~\cite{subcaption}.
%
% \subsection{Support of the listings package}
% \label{sec:listings}
%
% \NEWfeature{v1.5}
% If the \package{listings} package~\cite{listings} is loaded, the \package{listings} options \opt{caption1}
% and \opt{caption2} are available additionally, where option \opt{caption1} specifies the
% caption of the first language and \opt{caption2} of the second one.
%
% Example document, using distinctive lists for each language:
% \begin{quote}
%   |\documentclass[a4paper]{article}|\\
%   |\usepackage{graphicx}|\\
%   ||\\
%   |% Use "ngerman" as 1st language, "english" as 2nd one|\\
%   |\usepackage[english,ngerman]{babel}|\\
%   ||\\
%   |% Load the bicaption package with 2nd language set to|\\
%   |% "english", and list type "figureEng" resp. "tableEng"|\\
%   |\usepackage[lang=english,listtype+=Eng,font=it]{bicaption}|\\
%   |\captionsetup{slc=off} % do not center short captions|\\
%   ||\\
%   |\usepackage{listings}|\\
%   ||\\
%   |% Set German names|\\
%   |\addto\captionsgerman{%|\\
%   |  \renewcommand\lstlistingname{Quelltext}%|\\
%   |  \renewcommand\lstlistlistingname{Quelltextverzeichnis}%|\\
%   |}|\\
%   |\AtBeginDocument{\captionsgerman}% or load listings before babel|\\
%   ||\\
%   |% Set English names|\\
%   |\addto\captionsenglish{%|\\
%   |  \renewcommand\lstlistingname{Listing}%|\\
%   |  \renewcommand\lstlistlistingname{List of Listings}%|\\
%   |}|\\
%   ||\\
%   |\usepackage{newfloat}|\\
%   |% Define the new floating environment type "lstlistingEng"|\\
%   |% (just to get an extra list for English listing captions)|\\
%   |\DeclareFloatingEnvironment[fileext=lol2]{lstlistingEng}|\\
%   |                           [Listing][List of Listings]|\\
%   ||\\
%   |\begin{document}|\\
%   ||\\
%   |\lstlistoflistings    % German|\\
%   |\listoflstlistingEng  % English|\\
%   ||\\
%   |\clearpage|\\
%   ||\\
%   |\begin{lstlisting}|\\
%   |      [language=C,|\\
%   |       caption1=Deutscher Titel,|\\
%   |       caption2=English Title]|\\
%   |  int main()|\\
%   |  {|\\
%   |      printf( "Hello world!\n" );|\\
%   |      return 0;|\\
%   |  }|\\
%   |\end{lstlisting}|\\
%   ||\\
%   |\end{document}|
% \end{quote}
%
% \subsection{Support of the longtable package}
% \label{sec:longtable}
%
% If the \package{longtable} package~\cite{longtable} is loaded, |\bicaption| is available
% in the \env{longtable} environment as well, e.g.:
% \begin{quote}
%   |\documentclass[a4paper]{article}|\\
%   ||\\
%   |% Use "ngerman" as 1st language, "english" as 2nd one|\\
%   |\usepackage[english,ngerman]{babel}|\\
%   ||\\
%   |% Load the bicaption package with 2nd language set to|\\
%   |% "english"|\\
%   |\usepackage[lang=english]{bicaption}|\\
%   ||\\
%   |\usepackage{longtable}|\\
%   ||\\
%   |\begin{document}|\\
%   ||\\
%   |\begin{longtable}{ll}|\\
%   |  \bicaption{Deutscher Titel}{English Title}\\|\\
%   |  A & B \\|\\
%   |  C & D \\|\\
%   |  |\ldots\\
%   |\end{longtable}|\\
%   ||\\
%   |\end{document}|
% \end{quote}
%
% \subsection{Support of the subcaption package}
% \label{sec:subcaption}
%
% If the \package{subcaption} package~\cite{subcaption} is loaded, these commands are available
% additionally:
%
% \smallskip
%
% \DescribeMacro\bisubcaption
% Bilingual sub-captions will be typeset by
% \begin{quote}
%   |\bisubcaption|\oarg{list entry \#1}\marg{heading \#1}\\
%   |             |\oarg{list entry \#2}\marg{heading \#2}\\
%   |\bisubcaption*|\marg{heading \#1}\marg{heading \#2}
% \end{quote}
% The |\label| should be placed either after this command, or inside the first heading.
%
% \DescribeMacro\bisubcaptionbox
% Bilingual sub-caption boxes will be typeset by
% \begin{quote}
%   |\bisubcaptionbox|\oarg{list entry \#1}\marg{heading \#1}\\
%   |                |\oarg{list entry \#2}\marg{heading \#2}\\
%   |                |\oarg{width}\oarg{inner-pos}\marg{contents}\\
%   |\bisubcaptionbox*|\marg{heading \#1}\marg{heading \#2}\\
%   |                 |\oarg{width}\oarg{inner-pos}\marg{contents}
% \end{quote}
% The |\label| should be placed inside the first heading.
%
% \begingroup\small
% (For a description of the optional parameters \meta{width} and \meta{inner-pos}
% please take a look at the \package{subcaption} package documentation,
% \cs{subcaptionbox}.)
% \endgroup
%
% \pagebreak[3]
% \subsubsection{A sample document}
%
% \begin{quote}
%   |\documentclass[english,ngerman]{article}|\\
%   |\usepackage{selinput}|\\
%   |\SelectInputMappings{adieresis={ä},germandbls={ß}}|\\
%   ||\\
%   |\usepackage{babel}|\\
%   |\usepackage[lang=english,font=it]{bicaption}|\\
% \iffalse
%   |\usepackage[format=hang,list=on]{subcaption}|\\
% \else
%   |\usepackage[format=hang]{subcaption}|\\
% \fi
%   ||\\
%   |\begin{document}|\\
%   ||\\
% \iffalse
%   |\listoffigures|\\
%   ||\\
% \fi
%   |\begin{figure}[!htb]|\\
%   |  \centering|\\
%   |  \bisubcaptionbox|\\
%   |    {Teilabbildung A\label{fig:test:A}}|\\
%   |    {Subfigure A}[0.4\textwidth]{IMAGE}%|\\
%   |  \qquad|\\
%   |  \bisubcaptionbox|\\
%   |    {Teilabbildung langer Titel B\label{fig:test:B}}|\\
%   |    {Subfigure long title B}[0.4\textwidth]{IMAGE}%|\\
%   |  \bicaption{Deutscher Titel}{English Title}|\\
%   |  \label{fig:test}|\\
%   |\end{figure}|\\
%   ||\\
% \iffalse
%   |\captionsetup{bi-lang=2nd}|\\
%   ||\\
%   |\begin{figure}[!htb]|\\
%   |  \centering|\\
%   |  \bisubcaptionbox|\\
%   |    {Teilabbildung A\label{fig:test2:A}}|\\
%   |    {Subfigure A}[0.4\textwidth]{IMAGE}%|\\
%   |  \qquad|\\
%   |  \bisubcaptionbox|\\
%   |    {Teilabbildung langer Titel B\label{fig:test2:B}}|\\
%   |    {Subfigure long title B}[0.4\textwidth]{IMAGE}%|\\
%   |  \bicaption{Deutscher Titel}{English Title}|\\
%   |  \label{fig:test2}|\\
%   |\end{figure}|\\
%   ||\\
% \fi
%   |\captionsetup{bi-lang=both}|\\
%   ||\\
%   |\begin{figure}[!htb]|\\
%   |  \centering|\\
%   |  \bisubcaptionbox[A]|\\
%   |    {Und eine gaaaanz lange Caption: Teilabbildung A}|\\
%   |    {Subfigure A}[0.4\textwidth]{IMAGE}%|\\
%   |  \qquad|\\
%   |  \bisubcaptionbox[B]|\\
%   |    {Teilabbildung B}|\\
%   |    {Subfigure B}[0.4\textwidth]{IMAGE}%|\\
%   |  \bicaption[Abbildungsverzeichnistitel]|\\
%   |    {Und eine noch viel viel viel|\\
%   |     längere deutsche Beschriftung: Deutscher Titel}|\\
%   |    {Short English heading}|\\
%   |\end{figure}|\\
%   ||\\
%   |\captionsetup{bi-slc=off}|\\
%   ||\\
%   |\begin{figure}[!htb]|\\
%   |  \centering|\\
%   |  \bisubcaptionbox[A]|\\
%   |    {Und eine gaaaanz lange Caption: Teilabbildung A}|\\
%   |    {Subfigure A}[0.4\textwidth]{IMAGE}%|\\
%   |  \qquad|\\
%   |  \bisubcaptionbox[B]|\\
%   |    {Teilabbildung B}|\\
%   |    {Subfigure B}[0.4\textwidth]{IMAGE}%|\\
%   |  \bicaption[Abbildungsverzeichnistitel]|\\
%   |    {Und eine noch viel viel viel|\\
%   |     längere deutsche Beschriftung: Deutscher Titel}|\\
%   |    {Short English heading}|\\
%   |\end{figure}|\\
%   ||\\
%   |\captionsetup{slc=off}|\\
%   ||\\
%   |\begin{figure}[!htb]|\\
%   |  \centering|\\
%   |  \bisubcaptionbox[A]|\\
%   |    {Und eine gaaaanz lange Caption: Teilabbildung A}|\\
%   |    {Subfigure A}[0.4\textwidth]{IMAGE}%|\\
%   |  \qquad|\\
%   |  \bisubcaptionbox[B]|\\
%   |    {Teilabbildung B}|\\
%   |    {Subfigure B}[0.4\textwidth]{IMAGE}%|\\
%   |  \bicaption[Abbildungsverzeichnistitel]|\\
%   |    {Und eine noch viel viel viel|\\
%   |     längere deutsche Beschriftung: Deutscher Titel}|\\
%   |    {Short English heading}|\\
%   |\end{figure}|\\
%   ||\\
%   |\end{document}|
% \end{quote}
%
% \pagebreak[3]
% \captionsetup[bi-first]{lang=german}
% \captionsetup[bi-second]{lang=english,font=it}
% \captionsetup[sub]{format=hang,list=on}
%
% \iffalse
% \listoffigures
% \bigskip
% \fi
%
% \begin{minipage}{\linewidth}
%   \setcaptiontype{figure}
%   \centering
%   \bisubcaptionbox
%     {Teilabbildung A\label{fig:test:A}}
%     {Subfigure A}[0.4\textwidth]{IMAGE}%
%   \qquad
%   \bisubcaptionbox
%     {Teilabbildung langer Titel B\label{fig:test:B}}
%     {Subfigure long title B}[0.4\textwidth]{IMAGE}%
%   \bicaption{Deutscher Titel}{English Title}
%   \label{fig:test}
% \end{minipage}
%
% \iffalse
% \bigskip
% \captionsetup{bi-lang=2nd}
%
% \begin{minipage}{\linewidth}
%   \setcaptiontype{figure}
%   \centering
%   \bisubcaptionbox
%     {Teilabbildung A\label{fig:test2:A}}
%     {Subfigure A}[0.4\textwidth]{IMAGE}%
%   \qquad
%   \bisubcaptionbox
%     {Teilabbildung langer Titel B\label{fig:test2:B}}
%     {Subfigure long title B}[0.4\textwidth]{IMAGE}%
%   \bicaption{Deutscher Titel}{English Title}
%   \label{fig:test2}
% \end{minipage}
% \fi
%
% \bigskip
% \captionsetup{bi-lang=both}
%
% \begin{minipage}{\linewidth}
%   \setcaptiontype{figure}
%   \centering
%   \bisubcaptionbox[A]
%     {Und eine gaaaanz lange Caption: Teilabbildung A}
%     {Subfigure A}[0.4\textwidth]{IMAGE}%
%   \qquad
%   \bisubcaptionbox[B]
%     {Teilabbildung B}
%     {Subfigure B}[0.4\textwidth]{IMAGE}%
%   \bicaption[Abbildungsverzeichnistitel]
%     {Und eine noch viel viel viel
%      längere deutsche Beschriftung: Deutscher Titel}
%     {Short English heading}
% \end{minipage}
%
% \bigskip
% \captionsetup{bi-slc=off}
%
% \begin{minipage}{\linewidth}
%   \setcaptiontype{figure}
%   \centering
%   \bisubcaptionbox[A]
%     {Und eine gaaaanz lange Caption: Teilabbildung A}
%     {Subfigure A}[0.4\textwidth]{IMAGE}%
%   \qquad
%   \bisubcaptionbox[B]
%     {Teilabbildung B}
%     {Subfigure B}[0.4\textwidth]{IMAGE}%
%   \bicaption[Abbildungsverzeichnistitel]
%     {Und eine noch viel viel viel
%      längere deutsche Beschriftung: Deutscher Titel}
%     {Short English heading}
% \end{minipage}
%
% \bigskip
% \captionsetup{slc=off}
%
% \begin{minipage}{\linewidth}
%   \setcaptiontype{figure}
%   \centering
%   \bisubcaptionbox[A]
%     {Und eine gaaaanz lange Caption: Teilabbildung A}
%     {Subfigure A}[0.4\textwidth]{IMAGE}%
%   \qquad
%   \bisubcaptionbox[B]
%     {Teilabbildung B}
%     {Subfigure B}[0.4\textwidth]{IMAGE}%
%   \bicaption[Abbildungsverzeichnistitel]
%     {Und eine noch viel viel viel
%      längere deutsche Beschriftung: Deutscher Titel}
%     {Short English heading}
% \end{minipage}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \StopEventually{%^^A
% \begin{thebibliography}{99}
%
%   \bibitem{caption}
%   Axel Sommerfeldt:\\
%   \href{http://www.ctan.org/pkg/caption}%
%        {\emph{Customizing captions of floating environments}},\\
%   2022/01/07
%
%   \bibitem{listings}
%   Carsten Heinz \& Brooks Moses:\\
%   \href{http://www.ctan.org/pkg/listings}%
%        {\emph{The Listings Package}},\\
%   2007/02/22
%
%   \bibitem{longtable}
%   David Carlisle:\\
%   \href{http://www.ctan.org/pkg/longtable}%
%        {\emph{The longtable package}},\\
%   2004/02/01
%
%   \bibitem{subcaption}
%   Axel Sommerfeldt:\\
%   \href{http://www.ctan.org/pkg/subcaption}%
%        {\emph{The subcaption package}},\\
%   2022/01/07
%
% \end{thebibliography}
% }
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \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{\if@minipage,\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse}
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
% \DoNotIndex{\@testopt}
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
% \DoNotIndex{\p@,\z@}
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
% \DoNotIndex{\fi,\footnotesize,\global}
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
% \DoNotIndex{\ifx,\ignorespaces,\itshape}
% \DoNotIndex{\kernel@ifnextchar}
% \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,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
% \DoNotIndex{\providecommand,\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{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
% \DoNotIndex{\value,\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{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \setlength{\parskip}{0pt plus 1pt}
% \changes{v0.1}{2010/07/13}{Initial version}
% \changes{v0.2}{2010/07/13}{Check for caption package added}
% \changes{v0.3}{2010/07/13}{Usage of \cs{caption@applyfont} added}
% \changes{v0.4}{2010/07/13}{``Singlelinecheck'' fixed}
% \changes{v0.5}{2010/07/13}{Options \opt{bi-first} and \opt{bi-second} added}
% \changes{v0.6}{2010/07/13}{Option \opt{bi-slc} added}
% \changes{v0.7}{2010/07/13}{Option \opt{bi-lang} added}
% \changes{v0.8}{2010/09/04}{Adapted to current version of the caption kernel}
% \changes{v0.9}{2010/09/17}{Option \opt{bi-swap} added}
% \changes{v0.9a}{2011/07/13}{Warning regarding \package{babel} package added}
%
% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{The implementation}
%
% \iffalse
%<*package>
% \fi
%
% \subsection{Identification}
%
% We need at least \LaTeX2e\ version 1994/12/01.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
%    \end{macrocode}
%
% Bypass the release declarations in case the \LaTeX\ kernel doesn’t know how to deal with them
% (as suggested by \url{https://www.latex-project.org/publications/2018-FMi-TUB-tb122mitt-version-rollback.pdf}).
%    \begin{macrocode}
\providecommand\DeclareRelease[3]{}
\providecommand\DeclareCurrentRelease[2]{}
%    \end{macrocode}
%
% Declare all supported releases.
%    \begin{macrocode}
\DeclareCurrentRelease{v1}{2011/07/13}
%    \end{macrocode}
%
% Identify the current version of the package.
%    \begin{macrocode}
\ProvidesPackage{bicaption}[2021/05/02 v1.5b Bilingual Captions (AR)]
%    \end{macrocode}
%
% Since we base on the \package{caption} package we load it here.
%    \begin{macrocode}
\RequirePackage{caption}[2011/11/10] % we need at least v3.2e
%    \end{macrocode}
%
% \bigskip
%
% \pagebreak[3]
% \subsection{Initial code}
%
% \begin{macro}{\bicaption@Info}
%  |\bicaption@Info|\marg{message}
%    \begin{macrocode}
\newcommand*\bicaption@Info[1]{%
  \PackageInfo{bicaption}{#1}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\bicaption@InfoNoLine}
%  |\bicaption@InfoNoLine|\marg{message}\par
%  \Note{The \cs{@gobble} at the end of the 2nd argument of
%   \cs{PackageInfo} suppresses the line number info.
%   See TLC2\cite{TLC2}, A.4.7, p885 for details.}
%    \begin{macrocode}
\newcommand*\bicaption@InfoNoLine[1]{%
  \PackageInfo{bicaption}{#1\@gobble}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bicaption@Warning}
%  |\bicaption@Warning|\marg{message}
%    \begin{macrocode}
\newcommand*\bicaption@Warning[1]{%
  \bicaption@WarningNoLine{#1\on@line}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\bicaption@WarningNoLine}
%  |\bicaption@WarningNoLine|\marg{message}
%    \begin{macrocode}
\newcommand*\bicaption@WarningNoLine[1]{%
  \PackageWarning{bicaption}{#1.^^J\bicaption@wh\@gobbletwo}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\bicaption@wh{%
  See the `bicaption' package documentation for explanation.}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bicaption@Error}
%  |\bicaption@Error|\marg{message}
%    \begin{macrocode}
\newcommand*\bicaption@Error[1]{%
  \PackageError{bicaption}{#1}{\caption@@eh{bicaption}}}
%    \end{macrocode}
%    \begin{macrocode}
\providecommand*\caption@@eh[1]{%
  If you do not understand this error, please take a closer look\MessageBreak
  at the documentation of the `#1' package, especially the\MessageBreak
  section about errors.\MessageBreak\@ehc}
%    \end{macrocode}
% \end{macro}
%
% \pagebreak[3]
% \subsection{Declaration of options}
%
% The option |bi-lang| will setup which language(s) will actually be typeset,
% the first one, the second one, or both of them.
%    \begin{macrocode}
\newcount\bicaption@lang
\DeclareCaptionOption{bi-lang}{%
  \caption@ifinlist{#1}{0,all,both}{%
    \bicaption@lang=0\relax
  }{\caption@ifinlist{#1}{1,1st,first}{%
    \bicaption@lang=1\relax
  }{\caption@ifinlist{#1}{2,2nd,second}{%
    \bicaption@lang=2\relax
  }{%
    \bicaption@Error{Undefined bi-lang value `#1'}%
  }}}}
%    \end{macrocode}
%
% The option |bi-singlelinecheck| will setup if a single check will be used
% for both languages (|=on|),
% or if both languages will be checked individually (|=off|).
%    \begin{macrocode}
\DeclareCaptionOption{bi-singlelinecheck}[1]{%
  \caption@set@bool\bicaption@ifslc{#1}}
\DeclareCaptionOption{bi-slc}[1]{%
  \caption@set@bool\bicaption@ifslc{#1}}
%    \end{macrocode}
%
% The option |bi-swap| will swap the primary and secondary language,
% making the first language the second one and vice versa.
%    \begin{macrocode}
\DeclareCaptionOption{bi-swap}[1]{%
  \caption@set@bool\bicaption@ifswap{#1}}
%    \end{macrocode}
%
% The option |bi-separator| will setup the separator between
% the two bi-lingual captions.
%    \begin{macrocode}
\DeclareCaptionOption{bi-separator}[1]{%
  \caption@set{biseparator}{#1}}
%    \end{macrocode}
%    \begin{macrocode}
\providecommand*\caption@set[2]{%
  \@ifundefined{caption@#1@#2}%
    {\caption@Error{Undefined #1 `#2'}}%
    {\expandafter\let\csname caption@#1\expandafter\endcsname\csname caption@#1@#2\endcsname}}
%    \end{macrocode}
%
% \begin{macro}{\DeclareBiCaptionSeparator}
% \changes{v1.3}{2020/10/25}{This macro added}
%   |\DeclareBiCaptionSeparator|\marg{name}\marg{code}
%    \begin{macrocode}
\newcommand\DeclareBiCaptionSeparator[2]{%
  \caption@decl{biseparator}{#1}{#2}}
\@onlypreamble\DeclareBiCaptionSeparator
%    \end{macrocode}
%    \begin{macrocode}
\providecommand*\caption@decl[2]{%
  \global\long\expandafter\def\csname caption@#1@#2\endcsname}
%    \end{macrocode}
% \end{macro}
%
% There are four pre-defined separators, called `none',
% `smallskip', `medskip', and `bigskip'.
%    \begin{macrocode}
\DeclareBiCaptionSeparator{none}{}
\DeclareBiCaptionSeparator{smallskip}{\smallskip}
\DeclareBiCaptionSeparator{medskip}{\medskip}
\DeclareBiCaptionSeparator{bigskip}{\bigskip}
%    \end{macrocode}
%
% The default separator usually maps to `none'.
%    \begin{macrocode}
\caption@ifundefined\SetCaptionDefault
  {\def\caption@biseparator@default{\caption@biseparator@none}}
  {\SetCaptionDefault{biseparator}{none}}
%    \end{macrocode}
%
% The option |lang=|\meta{language} will setup the language of the caption.
% We can't set the language immediately because otherwise we will get in trouble, e.g. when
% using the \package{microtype} package via |\usepackage[babel]{microtype}|.
% So we store the selected language to |\bicaption@language| instead and will set it later on.
% But this has a drawback, option settings which will be overwritten by the selection of
% the language do not work correctly anymore. Therefore we will save specific options
% and set them (again) after setting the language.
%    \begin{macrocode}
\DeclareCaptionOption{lang}{%
  \caption@ifundefined\bicaption@language
    \bicaption@language@setupkeys
    \relax
  \edef\bicaption@language{#1}%
  \let\bicaption@language@setoptions\@empty
  \global\let\bicaption@language@value\bicaption@language}
%    \end{macrocode}
% Map |language=| to |lang=|.
%    \begin{macrocode}
\let\KV@caption@language\KV@caption@lang
%    \end{macrocode}
%
% \begin{macro}{\DeclareCaptionLangOption}
% \changes{v1.2}{2016/03/27}{This macro added}
% |\DeclareCaptionLangOption|\marg{option key}\par
% Saves the gives \meta{option key} to the list |\bicaption@language@keylist|.
% These options will be stored and set (again) after setting the language.
%    \begin{macrocode}
\newcommand*\bicaption@language@keylist{}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\DeclareCaptionLangOption[1]{%
  \@ifundefined{KV@caption@#1}%
    {\bicaption@Error{Undefined caption option `#1'}}%
    {\@cons\bicaption@language@keylist{{#1}}}}
%    \end{macrocode}
%    \begin{macrocode}
\let\DeclareCaptionLanguageOption\DeclareCaptionLangOption
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\bicaption@language@setupkeys{%
  \def\@elt##1{%
    \expandafter\let\csname KV@bicaption@##1\expandafter\endcsname
                    \csname KV@caption@##1\endcsname
    \@namedef{KV@caption@##1}{\bicaption@KV{##1}}}%
  \bicaption@language@keylist
  \let\@elt\relax}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand\bicaption@KV[2]{%
  \@bicaption@KV{#1}{#2}%
  \l@addto@macro\bicaption@language@setoptions{%
    \@bicaption@KV{#1}{#2}}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand\@bicaption@KV[1]{%
  \@nameuse{KV@bicaption@#1}}
%    \end{macrocode}
% \end{macro}
%
% The only option affected I'm aware off is the |name=| option, so this will be saved
% and set later on.
%    \begin{macrocode}
\DeclareCaptionLangOption{name}
%    \end{macrocode}
%
% \begin{macro}{\bicaption@selectlanguage}
% \changes{v1.0}{2011/08/31}{Starred variant added}
% \changes{v1.1}{2012/04/09}{Support of \cs{selectcaptionlanguage} added}
% \changes{v1.1}{2016/03/25}{Patching of \cs{caption@applyfont} replaced by \cs{caption@beginhook}}
% \changes{v1.1}{2016/03/27}{Usage of \cs{bicaption@language@setoptions} added}
% |\bicaption@selectlanguage|\marg{font-or-list-entry}\par
% Set the language (stored in |\bi|\-|caption@lan|\-|guage|)
% via |\select|\-|bi|\-|caption|\-|lan|\-|guage|.
%    \begin{macrocode}
\newcommand*\bicaption@selectlanguage[1]{%
  \caption@ifundefined\bicaption@language{}{%
    \expandafter\selectcaptionlanguage\expandafter#1\expandafter
      {\bicaption@language}%
    \bicaption@language@setoptions}}
%    \end{macrocode}
% |\caption@beginhook| (of the \package{caption} package kernel) will be extended here
% so the language setting will actually take effect.
%    \begin{macrocode}
\g@addto@macro\caption@beginhook{%
  \bicaption@selectlanguage\@firstoftwo}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\selectcaptionlanguage}
% |\selectcaptionlanguage|\marg{font-or-list-entry}\marg{language}
% will finally be used to set up the language.
%    \begin{macrocode}
\providecommand*\selectcaptionlanguage[1]{%
  #1\select@language\selectlanguage}
%    \end{macrocode}
% \end{macro}
%
% \pagebreak[3]
% \subsection{Execution of options}
%
% Setup default values for |bi-lang|, |bi-single|\-|line|\-|check|,
% |bi-swap|, and |bi-separator|.
%    \begin{macrocode}
\caption@ExecuteOptions{caption}{bi-lang=0,bi-slc=1,bi-swap=0,bi-separator=default}
%    \end{macrocode}
%
% Set the language for the first caption.
% (Since \version{1.5a} we do this |\At|\-|Begin|\-|Document| so
% |\caption|\-|main|\-|language| could be defined \emph{after} loading the
% \package{bicaption} package resp.~\package{babel} or \package{polyglossia}
% could be loaded \emph{after} the \package{bicaption} package.)
%    \begin{macrocode}
\AtBeginDocument{%
  \ifcsname captionmainlanguage\endcsname
    \bicaption@InfoNoLine{%
      Main language is set to \captionmainlanguage}%
  \else
    \bicaption@setmainlanguage
  \fi
%    \end{macrocode}
%    \begin{macrocode}
  \ifcsname captionmainlanguage\endcsname
    \captionsetup[bi-first]{lang=\captionmainlanguage}%
  \else
    \ifcsname bicaption@language@value\endcsname % option "lang=" was used
      \expandafter\bicaption@Warning
    \else
      \expandafter\bicaption@Info
    \fi
      {Main language is not set}%
  \fi}
%    \end{macrocode}
%
% \begin{macro}{\bicaption@setmainlanguage}
% \changes{v1.5a}{2011/08/31}{This macro added as encapsulation of setting \cs{captionmainlanguage}}
% |\bicaption@setmainlanguage| is used to define
% |\caption|\-|main|\-|language| if not already done.
%    \begin{macrocode}
\newcommand*\bicaption@setmainlanguage{%
  \ifcsname bbl@main@language\endcsname
    \bicaption@InfoNoLine{%
      babel found, main language is \bbl@main@language}%
    \let\captionmainlanguage\bbl@main@language
  \else\ifcsname xpg@main@language\endcsname
    \bicaption@InfoNoLine{%
      polyglossia found, main language is \xpg@main@language}%
    \let\captionmainlanguage\xpg@main@language
  \fi\fi}
\@onlypreamble\bicaption@setmainlanguage
%    \end{macrocode}
% \end{macro}
%
% We use |\caption@Process|\-|Options| here to add the options to the `|bi-second|' option
% list instead of executing them immediately.
%    \begin{macrocode}
\caption@SetupOptions{bicaption}{\captionsetup[bi-second]{#2}}%
\caption@ProcessOptions*{bicaption}
%    \end{macrocode}
%
% \pagebreak[3]
% \subsection{Main code}
%
% \begin{macro}{\caption@addcontentsline}
% \changes{v1.0}{2011/08/31}{Redefinition of \cs{caption@kernel@addcontentsline} added}
% \changes{v1.0b}{2012/01/15}{\cs{caption@kernel@addcontentsline} changed to \cs{caption@addcontentsline}}
% \changes{v1.1}{2016/02/01}{Adaption to \package{longtable} package added}
% We patch |\caption@add|\-|contents|\-|line| (of the \package{caption} package kernel)
% so |bi|\-|caption@add|\-|contents|\-|line| will be used for bilingual captions instead.
%    \begin{macrocode}
\let\bicaption@addcontentsline@ORI\caption@addcontentsline
\renewcommand*\caption@addcontentsline[2]{%
%    \end{macrocode}
%    \begin{macrocode}
  \bicaption@LT@setup
  \global\let\bicaption@LT@setup\relax
%    \end{macrocode}
%    \begin{macrocode}
  \caption@ifundefined\bicaption@lentry
    {\bicaption@addcontentsline@ORI{#1}{#2}}%
    {\expandafter\bicaption@addcontentsline\expandafter
       {\bicaption@lentry}{#1}{#2}%
     \global\let\bicaption@lentry\@undefined}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bicaption@addcontentsline}
% \changes{v1.0}{2011/08/31}{This macro added}
% \changes{v1.1}{2013/03/10}{Bugfix: Delayed usage of \cs{caption@addsubcontentslines} added}
% |\bicaption@addcontentsline|\marg{list entry \#2}\marg{type}\marg{list entry \#1}\par
% Typeset both captions using the original version of |\caption@add|\-|contents|\-|line|.
%    \begin{macrocode}
\newcommand\bicaption@addcontentsline[3]{%
  \begingroup
    \let\caption@addsubcontentslines\@gobble
%    \end{macrocode}
% Execute the options setup with |\captionsetup[bi]{|\ldots|}|.
%    \begin{macrocode}
    \caption@setoptions{bi}%
%    \end{macrocode}
% Do the first list entry, if requested.
%    \begin{macrocode}
    \ifnum\bicaption@lang=2\relax \else
      \begingroup
        \caption@setoptions{bi-first}%
        \bicaption@@addcontentsline{#2}{#3}%
      \endgroup
    \fi
%    \end{macrocode}
% Do the second list entry, if requested.
%    \begin{macrocode}
    \ifnum\bicaption@lang=1\relax \else
      \begingroup
        \caption@setoptions{bi-second}%
        \bicaption@@addcontentsline{#2}{#1}%
      \endgroup
    \fi
%    \end{macrocode}
%    \begin{macrocode}
  \endgroup
  \caption@addsubcontentslines{#2}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\bicaption@@addcontentsline[2]{%
  \caption@ifcontentsline{#2}{%
    \bicaption@selectlanguage\@secondoftwo
    \bicaption@addcontentsline@ORI{#1}{#2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@make}
% \changes{v1.4}{2020/12/25}{Fallback code of \cs{caption@@make@} added}
% We redefine |\caption@@make| (of the \package{caption} package kernel)
% so |\bi|\-|caption@@make| will be used for bilingual captions instead.
%    \begin{macrocode}
\caption@ifundefined\caption@@make@
  {\let\caption@@make@\caption@@make}
  {}
%    \end{macrocode}
%    \begin{macrocode}
\renewcommand\caption@@make[2]{%
  \caption@ifundefined\bicaption@text
    {\begingroup
       \caption@@make@{#1}{#2}%
     \endgroup}%
    {\expandafter\bicaption@@make\expandafter
       {\bicaption@text}{#1}{#2}%
     \global\let\bicaption@text\@undefined}%
%    \end{macrocode}
%    \begin{macrocode}
  \@nameuse{caption@@make@epilogue}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bicaption@@make}
% \changes{v1.1}{2015/09/16}{\cs{bicaption@label} replaced by \cs{caption@thelabel}}
% \changes{v1.3}{2020/10/25}{Usage of \cs{caption@biseparator} added}
% \changes{v1.4}{2020/12/25}{Definitions of \cs{bicaption@slc} and \cs{caption@setsinglelinecheck} added (fallback)}
% \changes{v1.4a}{2020/12/26}{Clearance of \cs{caption@thelabel} replaced by \cs{bicaption@clrlabel}}
% |\bicaption@@make|\marg{text \#2}\marg{label}\marg{text \#1}\par
% Typeset both captions using the original version of \cs{caption@@make}.
%    \begin{macrocode}
\newcommand\bicaption@@make[3]{%
%    \end{macrocode}
% Execute the options setup with |\captionsetup[bi]{|\ldots|}|.
%    \begin{macrocode}
  \caption@setoptions{bi}%
%    \end{macrocode}
% Perform the common single-line-check for both captions, if requested.
%    \begin{macrocode}
  \ifnum\bicaption@lang=0\relax
    \bicaption@ifslc
      {\bicaption@slc{#2}{#3}{}{\caption@setsinglelinecheck0}%
       \bicaption@slc{#2}{#1}{}{\caption@setsinglelinecheck0}}%
      {}%
  \fi
%    \end{macrocode}
% Typeset the first caption, if requested.
% (Otherwise we only apply the label of it.)
%    \begin{macrocode}
  \ifnum\bicaption@lang=2\relax
    \caption@thelabel
    \let\bicaption@tempa\relax
  \else
    \begingroup
      \caption@setoptions{bi-first}%
      \caption@@make@{#2}{#3}%
    \endgroup
    \def\bicaption@tempa{\bicaption@separator\caption@biseparator}%
  \fi
%    \end{macrocode}
% Typeset the second caption, if requested.
%    \begin{macrocode}
  \ifnum\bicaption@lang=1\relax
  \else
    \bicaption@tempa
    \begingroup
      \caption@setoptions{bi-second}%
      \caption@@make@{#2}{#1}%
    \endgroup
  \fi
%    \end{macrocode}
%    \begin{macrocode}
  \global\bicaption@clrlabel}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\bicaption@separator{\par}
%    \end{macrocode}
%    \begin{macrocode}
\caption@ifundefined\caption@@slc
  {\newcommand\bicaption@slc{\caption@slc}}
  {\newcommand\bicaption@slc[2]{\caption@@slc{#1}{#2}{\captionwidth}}}
%    \end{macrocode}
%    \begin{macrocode}
\providecommand*\caption@setsinglelinecheck{%
  \caption@set@bool\caption@ifslc}
%    \end{macrocode}
% \end{macro}
%
% \pagebreak[3]
% \subsubsection{The \cs{bicaption} commands}
%
% \begin{macro}{\bicaption}
% |\bicaption*|\oarg{list entry \#1}\marg{text \#1}\oarg{list entry \#2}\marg{text \#2}
%    \begin{macrocode}
\newcommand\bicaption{\@bicaption\caption}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bicaptionbox}
% \changes{v1.0}{2011/08/31}{This macro added}
% |\bicaptionbox*|\oarg{entry \#1}\marg{text \#1}\oarg{entry \#2}\marg{text \#2}%
%                    \oarg{\ldots}\marg{\ldots}
%    \begin{macrocode}
\newcommand\bicaptionbox{\@bicaption\captionbox}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bisubcaption}
% |\bisubcaption*|\oarg{list entry \#1}\marg{text \#1}\oarg{list entry \#2}\marg{text \#2}
%    \begin{macrocode}
\newcommand\bisubcaption{\@bicaption\subcaption}
\let\subbicaption\bisubcaption
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bisubcaptionbox}
% |\bisubcaptionbox*|\oarg{entry \#1}\marg{text \#1}\oarg{entry \#2}\marg{text \#2}%
%                    \oarg{\ldots}\marg{\ldots}
%    \begin{macrocode}
\newcommand\bisubcaptionbox{\@bicaption\subcaptionbox}
\let\subbicaptionbox\bisubcaptionbox
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@bicaption}
% \changes{v1.0}{2011/08/31}{Optional parameter \meta{list entry \#2} added}
% \changes{v1.1}{2015/09/16}{\cs{bicaption@getlabel} replaced by \cs{caption@getlabel}}
% \changes{v1.4}{2020/12/25}{Usage of \cs{caption@getlabel} replaced by \cs{bicaption@getlabel}}
% |\@bicaption|\marg{cmd}*\oarg{entry \#1}\marg{text \#1}\oarg{entry \#2}\marg{text \#2}\ldots
%    \begin{macrocode}
\newcommand*\@bicaption[1]{%
  \@ifstar
    {\def\bicaption@cmd{\bicaption@star{#1}}%
     \@@bicaption}%
    {\def\bicaption@cmd{#1}%
     \caption@dblarg\@@@bicaption}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand\@@bicaption[1]{%
  \@@@@bicaption{}{#1}[]}
%    \end{macrocode}
%    \begin{macrocode}
\long\def\@@@bicaption[#1]#2{%
  \caption@dblarg{\@@@@bicaption{#1}{#2}}}
%    \end{macrocode}
%    \begin{macrocode}
\long\def\@@@@bicaption#1#2[#3]#4{%
  \bicaption@getlabel{#2}%
  \bicaption@ifswap
    {\bicaption@setup{#1}{#2}%
     \bicaption@cmd[{#3}]{#4}}%
    {\bicaption@setup{#3}{#4}%
     \bicaption@cmd[{#1}]{#2}}}
%    \end{macrocode}
%    \begin{macrocode}
\long\def\bicaption@star#1[#2]{#1*}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bicaption@getlabel}
% \changes{v1.0}{2011/09/03}{\cs{label} can have optional arguments now}
% \changes{v1.4}{2020/12/25}{This macro re-added}
%   |\bicaption@getlabel|\marg{text}\\
%   gets the label command out of the given caption text and stores it to |\caption@the|\-|label|.
%   It uses |\caption@get|\-|label| for this purpose which interface unfortunately has changed over time.
%   (Changing the interface was a bad idea in the first place but now it is as it is).
%    \begin{macrocode}
\@ifundefined{caption@getlabel}{%
%    \end{macrocode}
%    \begin{macrocode}
  \newcommand\bicaption@getlabel[1]{%  caption3 < v1.7
    \bicaption@@getlabel#1\label{}\@nil}
%    \end{macrocode}
%    \begin{macrocode}
  \long\def\bicaption@@getlabel#1\label#2#3\@nil{%
    \def\@tempa{#2}%
    \ifx\@tempa\@empty
      \let\caption@thelabel\relax
    \else
      \def\@tempb{*}%
      \ifx\@tempa\@tempb
        \def\caption@thelabel{\label*}%
        \bicaption@@@getlabel#3\@nil
      \else
        \def\caption@thelabel{\label}%
        \bicaption@@@getlabel{#2}#3\@nil
      \fi
    \fi}
%    \end{macrocode}
%    \begin{macrocode}
  \long\def\bicaption@@@getlabel#1#2\@nil{%
    \def\@tempa{#1}%
    \def\@tempb{[}%
    \ifx\@tempa\@tempb
      \bicaption@@@@getlabel#1#2\@nil
    \else
      \l@addto@macro\caption@thelabel{{#1}}%
    \fi}
%    \end{macrocode}
%    \begin{macrocode}
  \long\def\bicaption@@@@getlabel[#1]#2\@nil{%
    \l@addto@macro\caption@thelabel{[{#1}]}%
    \bicaption@@@getlabel#2\@nil}
%    \end{macrocode}
%    \begin{macrocode}
}{\@ifundefined{caption@@@@getlabel}{%
%    \end{macrocode}
%    \begin{macrocode}
  \newcommand\bicaption@getlabel[1]{%  caption3 >= v1.7
    \caption@getlabel#1\label{}\@nil}
%    \end{macrocode}
%    \begin{macrocode}
}{%
%    \end{macrocode}
%    \begin{macrocode}
  \newcommand*\bicaption@getlabel{%    caption3 >= v2.0
    \caption@getlabel}
%    \end{macrocode}
%    \begin{macrocode}
}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bicaption@clrlabel}
% \changes{v1.4a}{2020/12/26}{This macro added}
%   |\bicaption@clrlabel|\\
%   resets |\caption@the|\-|label| to |\relax|.
%    \begin{macrocode}
\@ifundefined{caption@clrlabel}{%
%    \end{macrocode}
%    \begin{macrocode}
  \newcommand*\bicaption@clrlabel{\let\caption@thelabel\relax} %  caption3 < v2.3
%    \end{macrocode}
%    \begin{macrocode}
}{%
%    \end{macrocode}
%    \begin{macrocode}
  \newcommand*\bicaption@clrlabel{\caption@clrlabel}           %  caption3 >= v2.3
%    \end{macrocode}
%    \begin{macrocode}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bicaption@setup}
% |\bicaption@setup|\marg{list-entry}\marg{text}\\
% initiates the bilingual caption typesetting by storing the extra texts into
% |\bi|\-|caption@l|\-|entry| and |\bi|\-|caption@text|.
%    \begin{macrocode}
\newcommand\bicaption@setup[2]{%
  \def\bicaption@lentry{#1}%
  \def\bicaption@text{\ignorespaces #2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bicaption@clear}
% |\bicaption@clear|\\
% clears the stuff stored by |\bicaption@setup|.
%    \begin{macrocode}
\newcommand*\bicaption@clear{%
  \let\bicaption@lentry\@undefined
  \let\bicaption@text\@undefined}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@freeze}
% \changes{v1.0}{2011/08/31}{Redefinition of \cs{caption@freeze} added}
% To make |\bicaption| work inside |SCfigure| and |FPfigure| environments we need to add
% |\bi|\-|caption| to |\caption@freeze|.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifx\caption@freeze\@undefined \else
    \g@addto@macro\caption@freeze{%
      \let\caption@frozen@bicaption\bicaption
      \def\bicaption{%
        \caption@withoptargs\caption@SC@bicaption}%
      \long\def\caption@SC@bicaption#1#2{%
        \@ifnextchar[%]
          {\caption@SC@bi@caption{#1}{#2}}%
          {\caption@SC@bi@caption@{#1}{#2}}}%
      \long\def\caption@SC@bi@caption#1#2[#3]#4{%
        \caption@@freeze{\bicaption#1{#2}[{#3}]{#4}}%
        \ignorespaces}%
      \long\def\caption@SC@bi@caption@#1#2#3{%
        \caption@@freeze{\bicaption#1{#2}{#3}}%
        \ignorespaces}%
      \l@addto@macro\caption@warmup{%
        \let\bicaption\caption@frozen@bicaption}}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \changes{v1.1}{2013/05/02}{Definition of \cs{bicaption@listof} removed}
%
% \subsection{Support of the listings package}
% \changes{v1.5}{2021/01/04}{Support of the \package{listings} package added}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{listings}[2004/02/13 v1.2]{%
%    \end{macrocode}
%
% If the \package{listings} package is loaded, we define the new options `caption1' and `caption2'.
%    \begin{macrocode}
  \lst@Key{caption1}\relax{%
    \lstKV@OptArg[{#1}]{#1}{%
      \bicaption@ifswap
        {\bicaption@setup{##1}{##2}}%
        {\def\lst@@caption{##1}\def\lst@caption{##2}}}%
    \let\lst@title\@empty}%
%    \end{macrocode}
%    \begin{macrocode}
  \lst@Key{caption2}\relax{%
    \lstKV@OptArg[{#1}]{#1}{%
      \bicaption@ifswap
        {\def\lst@@caption{##1}\def\lst@caption{##2}}%
        {\bicaption@setup{##1}{##2}}}%
    \let\lst@title\@empty}%
%    \end{macrocode}
%    \begin{macrocode}
  \lst@AddToHookExe{TextStyle}{%
    \bicaption@clear}%
%    \end{macrocode}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsection{Support of the longtable package}
%
% \begin{macro}{\LT@bicaption}
% \changes{v1.1}{2016/01/31}{Adaption to \package{longtable} package added}
% Same as |\@bicaption| but for |longtable| (offered by the \package{longtable} package).
% |\bi|\-|caption@LT|\-|setup| will be executed later on, inside |\LT@make|\-|caption|
% offered by the \package{caption} package.
%    \begin{macrocode}
\newcommand\LT@bicaption{%
  \noalign\bgroup
    \@ifstar
      {\gdef\bicaption@cmd{\LT@c@ption\@gobble}%
       \LT@@bicaption}%
      {\gdef\bicaption@cmd{\LT@c@ption\@firstofone}%
       \caption@dblarg\LT@@@bicaption}}
\newcommand\LT@@bicaption[1]{%
  \LT@@@@bicaption{}{#1}[]}
%    \end{macrocode}
%    \begin{macrocode}
\long\def\LT@@@bicaption[#1]#2{%
  \caption@dblarg{\LT@@@@bicaption{#1}{#2}}}
%    \end{macrocode}
%    \begin{macrocode}
\long\def\LT@@@@bicaption#1#2[#3]#4{%
  \gdef\bicaption@LTsetup{%
    \bicaption@getlabel{#2}%
    \bicaption@LT@setup}%
  \gdef\bicaption@LT@setup{%
    \bicaption@ifswap
      {\bicaption@setup{#1}{#2}}%
      {\bicaption@setup{#3}{#4}}}%
  \bicaption@ifswap
    {\egroup\bicaption@cmd[{#3}]{#4}}%
    {\egroup\bicaption@cmd[{#1}]{#2}}}
%    \end{macrocode}
%    \begin{macrocode}
\let\bicaption@LTsetup\relax
\let\bicaption@LT@setup\relax
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@LT@setup}
% \changes{v1.1}{2016/01/31}{Adaption to \package{longtable} package added}
% \changes{v1.4}{2020/12/25}{Fallback code for \package{caption} package \version{3.2} added}
% Execute the stuff defined by \cs{LT@bicaption} to prepare the typesetting
% of the \package{longtable} bilingual caption.
%    \begin{macrocode}
\caption@ifundefined\caption@LT@setup{%
  % Fallback code for caption v3.2
  \captionsetup*[longtable]{bicaption-lt-setup}
  \DeclareCaptionOptionNoValue{bicaption-lt-setup}{%
    \bicaption@LTsetup
    \global\let\bicaption@LTsetup\relax}
}{%
  \g@addto@macro\caption@LT@setup{%
    \bicaption@LTsetup
    \global\let\bicaption@LTsetup\relax}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{thebibliography}{9}
%   \bibitem{TLC2}
%   Frank Mittelbach and Michel Goossens:\\
%   \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\
%   \newblock Addison-Wesley, 2004.
%
%   \bibitem{listings}
%   Carsten Heinz \& Brooks Moses:\\
%   \href{http://www.ctan.org/pkg/listings}%
%        {\emph{The Listings Package}},\\
%   2007/02/22
%
%   \bibitem{longtable}
%   David Carlisle:\\
%   \href{http://www.ctan.org/pkg/longtable}%
%        {\emph{The longtable package}},\\
%   2004/02/01
% \end{thebibliography}
%
% \iffalse
%</package>
% \fi
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \Finale
%
\endinput