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
|
% \iffalse meta-comment
%
% This is file `subcaption.dtx'.
%
% $Id: subcaption.dtx 142 2016-02-20 19:59:43Z sommerfeldt $
% $HeadURL: svn+ssh://sommerfeldt@svn.code.sf.net/p/latex-caption/code/branches/3.3/source/subcaption.dtx $
%
% Copyright (C) 2007-2016 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{147}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesFile{subcaption.drv}[2013/04/16 v1.1 Adds a sub-caption feature to the caption package]
\hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up.
%\errorcontextlines=3
%
\documentclass{ltxdoc}
\setlength\parindent{0pt}
\setlength\parskip{\smallskipamount}
%
\newcommand\LineBreak{\linebreak[3]}
\newcommand\PageBreak{\pagebreak[3]}
\usepackage{ifpdf}
\ifpdf
\usepackage{mathptmx,courier}
\usepackage[scaled=0.90]{helvet}
\addtolength\marginparwidth{15pt}
\ifdim\paperheight=297mm % a4paper
\renewcommand\LineBreak{\\}
\renewcommand\PageBreak{\clearpage}
\fi
\fi
%
\usepackage[bottom]{footmisc}
\usepackage{array,graphicx,overpic,pict2e,diagbox}
%
\PassOptionsToPackage{breaklinks=true}{hyperref}
\usepackage{hypdoc}
\ifpdf\usepackage{hypdestopt}\fi
\hypersetup{pdfkeywords={LaTeX, package, subcaption},pdfstartpage={},pdfstartview={}}
%
\usepackage{subcaption}[2011/08/01] % needs v1.1 or newer
\DeclareCaptionSubType*[arabic]{table}
\captionsetup[subtable]{labelformat=simple,labelsep=colon}
%
\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}
%
\newcommand*\MARGINSYM[1]{\hskip 1sp \marginpar{\raggedleft\textcolor{blue}{{#1}}}}
%\newcommand*\NEW[2]{}%\hskip 1sp \marginpar{\footnotesize\sffamily\raggedleft#1\\#2}}
%
\begin{document}
\DocInput{subcaption.dtx}
\end{document}
%</driver>
% \fi
%
% \let\subsectionautorefname\sectionautorefname
% \let\subsubsectionautorefname\sectionautorefname
%
% \def\thispackage{the \package{subcaption} package}
% \def\Thispackage{The \package{subcaption} package}
%
% \newcommand\NEWfeature{\NEW{New feature}}
% \newcommand\NEWdescription{\NEW{New description}}
%
% \makeatletter
% \newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
% \newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
% \makeatother
% \newcommand*\See[1]{\nopagebreak{\small (See #1)}}
%
% \GetFileInfo{subcaption.drv}
% \let\docdate\filedate
% \GetFileInfo{subcaption.sty}
%
% \title{\texorpdfstring{\Thispackage\thanks{%^^A
% This package has version number \fileversion, last revised \filedate.}}%^^A
% {The subcaption package}}
% \author{Axel Sommerfeldt\\
% \url{http://sourceforge.net/projects/latex-caption/}}
% \date{\docdate}
% \maketitle
%
% \begin{abstract}
% This package supports typesetting of sub-captions
% (by using the the sub-caption feature of the \package{caption} package).
% \end{abstract}
%
% \begin{background}
% At the end of each section, text marked with the mountain symbol
% will contain background knowledge on how the particular command or
% environment is actually implemented.
% If you just want to use this package as it is, you don't have to read or
% understand them.
% \end{background}
%
% \begin{background*}
% This package demonstrates the usage of |\Declare|\-|Caption|\-|Sub|\-|Type|,
% |\caption|\-|setup{sub|\-|type}|, and the internal hook
% |\caption@sub|\-|type|\-|hook| (offered by the \package{caption} package).
% \end{background*}
%
% \bigskip
% \INFO*
% \emph{Please note:}
% This package is incompatible with the \package{subfigure} and \package{subfig}
% packages.
%
% \clearpage
% \setcounter{tocdepth}{2}
% \tableofcontents
%
% \clearpage
% \section{Loading the package}
%
% Load this package using
% \begin{quote}
% |\usepackage|\oarg{options}|{subcaption}|\quad.
% \end{quote}
% The options for \thispackage\ are the same ones as for the \package{caption}
% package, but specify settings which are used for sub-captions
% \emph{additionally}.
% In fact
% \begin{quote}
% |\usepackage|\oarg{options}|{subcaption}|
% \end{quote}
% is identical to
% \begin{quote}
% |\usepackage{subcaption}|\\
% |\captionsetup[sub]|\marg{options}\quad.
% \end{quote}
%
% \bigskip
%
% The default settings for |sub|captions are:
% \begin{quote}
% |margin=0pt,font+=small,labelformat=parens,labelsep=space,|\\
% |skip=6pt,list=false,hypcap=false|~\footnote{%^^A
% This means that sub-captions are not listed in the List of Figures
% or Tables by default, but you can enable that by
% specifying the option \texttt{list=true}.}
% \end{quote}
%
% Options specified with |\usepackage[|\ldots|]{sub|\-|caption}| and
% |\caption|\-|setup[sub]{|\ldots|}| will override the ones specified by
% |\caption|\-|setup{|\ldots|}| and |\caption|\-|setup[fig|\-|ure]{|\ldots|}|,
% but are again overwritten by |\caption|\-|setup[sub|\-|figure]{|\ldots|}|
% (same for `table'). So finally we have the following order how
% settings for sub-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 Default `sub' settings
% {\small(|margin=0pt,font+=small,|\ldots, see above)}
% \item Custom `sub' settings
% {\small(|\usepackage[|\ldots|]{subcaption}| and |\captionsetup[sub]{|\ldots|}|)}
% \item Environmental `sub' settings
% {\small(|\captionsetup[subfigure|\emph{ -or- }|subtable]{|\ldots|}|)}
% \item Local `sub' settings
% {\small(|\captionsetup{|\ldots|}| inside |sub|\-|figure| or |sub|\-|table|)}
% \end{enumerate}
% An example:
% \begin{quote}
% |\usepackage[labelsep=quad,indention=10pt]{caption}|\\
% |\usepackage[labelfont=bf,list=true]{subcaption}|\\
% |\captionsetup[table]{textfont=it,position=top}|\\
% |\captionsetup[subtable]{textfont=sf}|
% \end{quote}
% causes the captions inside |sub|\-|table| environments to be typeset with
% the settings
% \begin{quote}
% |indention=10pt,position=top,margin=0pt,font=small,|\\
% |labelformat=parens,labelsep=space,skip=6pt,hypcap=false,|\\
% |labelfont=bf,list=true,textfont=sf|\quad.
% \end{quote}
%
% \PageBreak
% \section{The \cs{subcaption} command}
%
% \DescribeMacro\subcaption
% The easiest and most flexible method to apply a sub-caption is by using the
% |\subcaption| command. Its syntax is analogous to the one of the |\caption|
% command and shares its features:
% \begin{quote}
% |\subcaption|\oarg{list entry}\marg{heading}\\
% |\subcaption*|\marg{heading}
% \end{quote}
% Please note that the |\subcaption| command \emph{must} be applied inside
% its own box or environment.
%
% An example:
% \begin{quote}
% |\begin{figure}|\\
% | \begin{minipage}[b]{.5\linewidth}|\\
% | \centering\large A|\\
% | \subcaption{A subfigure}\label{fig:1a}|\\
% | \end{minipage}%|\\
% | \begin{minipage}[b]{.5\linewidth}|\\
% | \centering\large B|\\
% | \subcaption{Another subfigure}\label{fig:1b}|\\
% | \end{minipage}|\\
% | \caption{A figure}\label{fig:1}|\\
% |\end{figure}|
% \end{quote}
% gives the result:
% \par\bigskip
% \noindent\begin{minipage}{\linewidth}
% \setcaptiontype{figure}
% \begin{minipage}[b]{.5\linewidth}
% \centering\large A
% \subcaption{A subfigure}\label{fig:1a}
% \end{minipage}%^^A
% \begin{minipage}[b]{.5\linewidth}
% \centering\large B
% \subcaption{Another subfigure}\label{fig:1b}
% \end{minipage}
% \caption{A figure}\label{fig:1}
% \end{minipage}
%
% \bigskip
%
% \begin{background}
% Prepared with |\Declare|\-|Caption|\-|Sub|\-|Type| (offered by the
% \package{caption} package), the caption package command |\set|\-|caption|\-|sub|\-|type|
% becames available.
% Analogous to the |\set|\-|caption|\-|type| command of the \package{caption} package,
% the |\set|\-|caption|\-|sub|\-|type| command sets the sub-type of the box or environment
% (so |\caption| will typeset a sub-caption instead of an ordinary one),
% places a proper hyperlink anchor (non-starred variant only),
% executes options associated with the sub-type etc.\par
% The |\subcaption| command is just a simple combination of
% |\set|\-|caption|\-|sub|\-|type*| and |\caption|.
% \end{background}
%
% \PageBreak
% \section{The subfigure \& subtable environments}
%
% \DescribeEnv{subfigure}
% \DescribeEnv{subtable}
% After loading \thispackage\ the new environments |sub|\-|figure| and
% |sub|\-|table| are available, which have the same (optional \& mandatory)
% arguments as the |mini|\-|page| environment:
% \begin{quote}
% |\begin{subfigure}|\oarg{pos}\marg{width}\\
% \ldots\\
% |\end{subfigure}|
% \end{quote}
% and
% \begin{quote}
% |\begin{subtable}|\oarg{pos}\marg{width}\\
% \ldots\\
% |\end{subtable}|
% \end{quote}
% Inside these environments you use the ordinary |\caption| command
% for typesetting captions. So this example is the same as the last one,
% but uses the |sub|\-|figure| environment:
% \begin{quote}
% |\begin{figure}|\\
% | \begin{|\textcolor{blue}{\texttt{subfigure}}|}[b]{.5\linewidth}|\\
% | \centering\large A|\\
% | |\textcolor{blue}{\cs{caption}}|{A subfigure}\label{fig:1a}|\\
% | \end{|\textcolor{blue}{\texttt{subfigure}}|}%|\\
% | \begin{|\textcolor{blue}{\texttt{subfigure}}|}[b]{.5\linewidth}|\\
% | \centering\large B|\\
% | |\textcolor{blue}{\cs{caption}}|{Another subfigure}\label{fig:1b}|\\
% | \end{|\textcolor{blue}{\texttt{subfigure}}|}|\\
% | \caption{A figure}\label{fig:1}|\\
% |\end{figure}|
% \end{quote}
% Using the |sub|\-|figure| or |sub|\-|table| environment instead of |\subcaption|
% has two advantages:
% \begin{itemize}
% \item You can override the setttings for a specific subcaption
% with a |\caption|\-|setup| inside the |sub|\-|figure| or |sub|\-|table| environment, e.g.:
% \begin{quote}
% |\begin{subfigure}[b]{.5\linewidth}|\\
% | \centering\large A|\\
% | |\textcolor{blue}{\cs{captionsetup}\csmarg{skip=3pt}}\\
% | \caption{A subfigure}\label{fig:1a}|\\
% |\end{subfigure}|\\
% \end{quote}
% \item Hyperlinks targeted to this subfigure will jump to the beginning
% of the subfigure, and not to the caption of the subfigure
% (if |hypcap=true| is set for sub-captions).
% \See{\Ref{hypcap}}
% \end{itemize}
%
% \bigskip
%
% \begin{background}
% The |subfigure| \& |subtable| environments are just simple minipage
% environments with |\set|\-|caption|\-|sub|\-|type| as first contents line.
% These environments are defined with the help of
% |\caption@For{subtypelist}|, which executes code for every sub-type
% declared with |\Declare|\-|Caption|\-|Sub|\-|Type|.
% \end{background}
%
% \PageBreak
% \section{The \cs{subcaptionbox} command}
%
% \DescribeMacro\subcaptionbox
% A different way of setting sub-figures is
% offered by the |\sub|\-|caption|\-|box| command, which automatically
% aligns the sub-figures resp.~sub-tables by their very first caption line.
%
% Its syntax is:
% \begingroup
% \leftmargini=12pt
% \begin{quote}
% |\subcaptionbox|\oarg{list entry}\marg{heading}\oarg{width}\oarg{inner-pos}\marg{contents}\\
% |\subcaptionbox*|\marg{heading}\oarg{width}\oarg{inner-pos}\marg{contents}
% \end{quote}
% \endgroup
% \begin{small}
% The arguments \meta{list entry} \& \meta{heading} will be used for
% typesetting the |\caption|.\par
% \meta{width} is the width of the resulting |\par|\-|box|; the default value is
% the width of the contents.\par
% \meta{inner-pos} specifies how the contents will be justified inside the
% resulting |\parbox|;
% it can be either `c' (for |\centering|), `l' (for |\ragged|\-|right|),
% `r' (for |\ragged|\-|left|), or `s' (for no special justification).
% The default is `c'.
% (But you can use any justification defined with
% |\Declare|\-|Caption|\-|Jus|\-|ti|\-|fi|\-|ca|\-|tion| as well,
% e.g.~`|center|\-|last|'.)
% \end{small}
%
% \bigskip
%
% Using |\sub|\-|caption|\-|box|, the baseline of the resulting box will be placed
% right between contents and heading, so usually you don't have to care about the
% vertical alignment of the sub-figures for yourself.
% Also the hyperlink anchor is placed properly with respect to the |hyp|\-|cap=|
% setting.
%
% One example:
% \begin{quote}
% |\begin{figure}|\\
% | \centering|\\
% | \subcaptionbox{A cat\label{cat}}|\\
% | {\includegraphics{cat}}|\\
% | \subcaptionbox{An elephant\label{elephant}}|\\
% | {\includegraphics{elephant}}|\\
% | \caption{Two animals}\label{animals}|\\
% |\end{figure}|
% \end{quote}
% gives the result:\par
% \noindent\begin{minipage}{\linewidth}
% \setcaptiontype{figure}
% \centering
% \subcaptionbox{A cat\label{cat}}
% {\includegraphics[width=30pt]{cat}}
% \subcaptionbox{An elephant\label{elephant}}
% {\includegraphics[width=.4\textwidth]{elephant}}
% \caption[Two animals]{Two animals~\footnotemark}\label{animals}
% \end{minipage}
% \footnotetext{The pictures were taken with permission from the
% \LaTeX\ Companion\cite{TLC2} examples.}
%
% \bigskip
%
% As you see the result is not satisfying;
% the caption below the cat looks ugly because of the small width of the
% graphic. This can be solved by using the optional arguments of
% |\sub|\-|caption|\-|box|, increasing the width of the resulting box:
% \begin{quote}
% | |\ldots\\
% | \subcaptionbox{A cat\label{cat}}|\\
% | |\textcolor{blue}{\csoarg{2.5cm}}|{\includegraphics{cat}}|\\
% | |\ldots
% \end{quote}
% \noindent\begin{minipage}{\linewidth}
% \setcaptiontype{figure}
% \centering
% \subcaptionbox{A cat\label{cat2}}
% [2.5cm]{\includegraphics[width=30pt]{cat}}
% \subcaptionbox{An elephant\label{elephant2}}
% {\includegraphics[width=.4\textwidth]{elephant}}
% \caption{Two animals}\label{animals2}
% \end{minipage}
%
% \bigskip
%
% Furthermore the main caption, which is centered with respect to the
% |\text|\-|width|, looks mis-aligned with respect to the sub-captions.
% This can (again) be solved by using the optional arguments of
% |\sub|\-|caption|\-|box|, giving both boxes the same width, for example:
% \begin{quote}
% | |\ldots\\
% | \subcaptionbox{A cat\label{cat}}|\\
% | |\textcolor{blue}{\csoarg{.4\cs{linewidth}}}|{\includegraphics{cat}}%|\\
% | \subcaptionbox{An elephant\label{elephant}}|\\
% | |\textcolor{blue}{\csoarg{.4\cs{linewidth}}}|{\includegraphics{elephant}}|\\
% | |\ldots
% \end{quote}
% \noindent\begin{minipage}{\linewidth}
% \setcaptiontype{figure}
% \centering
% \subcaptionbox{A cat\label{cat3}}
% [.4\linewidth]{\includegraphics[width=39.34724pt]{cat}}%^^A
% \subcaptionbox{An elephant\label{elephant3}}
% [.4\linewidth]{\includegraphics[width=.4\textwidth]{elephant}}
% \caption{Two animals}\label{animals3}
% \end{minipage}
%
% \bigskip
%
% \iffalse
% \noindent\begin{minipage}{\linewidth}
% \setcaptiontype{figure}
% \centering
% \hbox{\subcaptionbox{An elephant\label{elephant4}}
% {\includegraphics[width=.4\textwidth]{elephant}}%^^A
% \vbox{\subcaptionbox{Cat 1\label{cat4.1}}
% {\includegraphics[width=30pt]{cat}}\par
% \subcaptionbox{Cat 2\label{cat4.2}}
% {\includegraphics[width=30pt]{cat}}}}%^^A
% \caption{Two animals}\label{animals4}
% \end{minipage}
% \bigskip
% \fi
%
% \begin{background}
% The |\sub|\-|caption|\-|box| is a |\par|\-|box| with
% |\set|\-|caption|\-|sub|\-|type| as first contents line.
% \iffalse See implementation for details.\fi
% \end{background}
%
% \PageBreak
% \section{The \cs{DeclareCaptionSubType} command}
%
% \DescribeMacro\DeclareCaptionSubType
% For using the sub-caption feature of the \package{caption} package some
% commands and counters must be prepared. This is done with
% \iffalse\footnote{%^^A
% \cs{newsubfloat} offered by the \package{subfig} package\cite{subfig}
% could be used for this purpose as well.}\fi
% \begin{quote}
% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\
% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}
% \end{quote}
% For the environments |figure| \& |table|, and all the ones
% defined with |\Declare|\-|Floating|\-|Environment| offered by the
% \package{newfloat} package, this will be done automatically,
% but for other environments (e.g.~the ones defined with |\newfloat| offered by the
% \package{float} package or |\Declare|\-|New|\-|Float|\-|Type| offered by the
% \package{floatrow} package) this has to be done manually.
%
% \medskip
%
% The starred variant provides the sub-caption numbering format
% \meta{type}|.|\meta{subtype} (e.g.~`|1.2|') while the non-starred variant
% simply uses \meta{subtype} (e.g.~`|a|').
%
% \begin{small}
% Own numbering formats can be created by redefining |\thesub|\meta{type}, e.g.
% \begin{quote}|\DeclareCaptionSubType*{figure}|\\
% |\renewcommand\thesubfigure{\thefigure\alph{subfigure}}|\end{quote}
% would give you sub-caption numbers like `|1b|'.
% \end{small}
%
% The default numbering scheme is |alph|, but you can use any \LaTeX\ (or self-defined)
% command name here which converts a counter to a text value, e.g. |arabic|, |roman|,
% |Roman|, |alph|, |Alph|, |fnsymbol|, \ldots
%
% But |\DeclareCaptionSubType| is not only for defining new sub-caption types,
% you can use this command for re-definitions as well, e.g.
% \begingroup
% \leftmargini=12pt
% \begin{quote}
% |\DeclareCaptionSubType*[arabic]{table}|\\
% |\captionsetup[subtable]{labelformat=simple,labelsep=colon}|
% \end{quote}
% \endgroup
% \pagebreak[2]
% will give you sub-captions in |table|s like these ones:
% \par\bigskip
% \noindent\begin{minipage}{\linewidth}
% \setcaptiontype{table}
% \centering
% \caption{Two tables}
% \subcaptionbox{Table one}[3cm][c]{\begin{tabular}{cc}A & B\\ C & D\\ \end{tabular}}
% \subcaptionbox{Table two}[3cm][c]{\begin{tabular}{cc}E & F\\ G & H\\ \end{tabular}}
% \end{minipage}
%
% \begin{background}
% |\Declare|\-|Caption|\-|Sub|\-|Type| is an integral part of the \package{caption}
% package kernel.
% \end{background}
%
% \PageBreak
% \section{References}
%
% The macro |\the|\-\meta{counter} is not only responsible for the look of the \meta{counter},
% but for the look of the references typeset with |\ref|, too. References will be prefixed by
% \LaTeX{} with the internal macro |\p@|\-\meta{counter}.
%
% |\Declare|\-|Caption|\-|Sub|\-|Type| will define both of them for sub-captions
% (e.g. |sub|\-|figure| and |sub|\-|table|), and as you have seen in the last section
% |\Declare|\-|Caption|\-|Sub|\-|Type| will give you some options to control the
% internal (re-)definition of |\the|\-\meta{counter} and |\p@|\-\meta{counter}.
%
% \DescribeMacro\thesubfigure
% \DescribeMacro\p@subfigure
% For example |\thesubfigure| and |\p@subfigure| are (as default) internally defined as
% \begin{quote}
% |\newcommand\thesubfigure{\alph{subfigure}}|\\
% |\newcommand\p@subfigure{\thefigure}|
% \end{quote}
% so the label of sub-captions will look like `|a|' (decorated by the selected label format),
% while references will look like `|1a|' since they are prefixed by |\p@sub|\-|figure| $=$
% |\the|\-|figure|.
%
% After |\Declare|\-|Caption|\-|Sub|\-|Type*[arabic]{figure}|, |\the|\-|sub|\-|figure| and
% |\p@sub|\-|figure| will look like
% \begin{quote}
% |\renewcommand\thesubfigure{\thefigure.\arabic{subfigure}}|\\
% |\renewcommand\p@subfigure{}|
% \end{quote}
%
% But if you want detailed control on how the references will look like,
% the options of |\Declare|\-|Caption|\-|Sub|\-|Type| are potentially not sufficient.
% In this case one need to redefine these two macros on his/her own.
% Some examples:
%
% If you want parentheses around the sub-figure part of the reference,
% so they will look like `|1(a)|', you may get them this way:
% \begin{quote}
% |\usepackage[labelformat=simple]{subcaption}|\\
% |\renewcommand\thesubfigure{(\alph{subfigure})}|
% \end{quote}
% {\small (\emph{Note:} Since |parens| is the default label format you will get double
% parentheses in sub-captions when not specifiying a different label format, e.g. |simple|.)}
%
% But if you want only a closing parenthesis, so references will look like `|1a)|',
% but the sub-captions itself should still look like `|(a)|',
% this would be a possible solution:
% \begin{quote}
% |\usepackage{subcaption}|\\
% |\renewcommand\thesubfigure{\alph{subfigure})}|\\
% |\DeclareCaptionLabelFormat{opening}{(#2}|\\
% |\captionsetup[subfigure]{labelformat=opening}|
% \end{quote}
%
% {\small(Please note that you need to surround redefinitions of |\p@|\-\meta{counter}
% with |\makeatletter| and |\makeatother|. See
% \url{http://tex.stackexchange.com/questions/8351/}
% for details.)}
%
% \pagebreak[3]
% \subsection{The \cs{subref} command}
%
% While |\ref|\marg{key} (and |\ref*|\marg{key}, if the \package{hyperref}
% package is used) usually gives a combined result representing the main
% caption counter and the sub-caption one, it is sometimes useful to have
% a reference to the sub-caption only. For this purpose you can use
% \begin{quote}
% |\subref|\marg{key}\\
% |\subref*|\marg{key}~\footnote{%^^A
% Like \cs{ref*}, \cs{subref*} is only available if the \package{hyperref}
% package\cite{hyperref} is used.}%^^A
% \qquad.
% \end{quote}
% So for example |\ref{cat}| gives the result `\ref{cat}' but |\subref{cat}|
% gives `\subref{cat}'.
%
% \begin{small}
% \emph{Note:} If the sub-caption was (re-)defined with the starred variant
% |\Declare|\-|Caption|\-|Sub|\-|Type*|, both |\ref| and |\sub|\-|ref| usually gives
% the same result.
% \end{small}
%
% \begin{background}
% The |\sub|\-|ref| command demonstrates the usage of |\caption@sub|\-|type|\-|hook|
% which will be called during |\caption|\-|setup{sub|\-|type}|.
% \end{background}
%
% \pagebreak[3]
% \subsection{The \opt{subrefformat=} option}
%
% \DescribeMacro{subrefformat=}
% By applying |\Declare|\-|Caption|\-|Sub|\-|Type|, or by redefining |\the|\-\meta{counter}
% and |\p@|\-\meta{counter}, you will change the look of references typeset with |\ref|
% \emph{and} |\sub|\-|ref|.
% But maybe you only want to change the output of |\sub|\-|ref| without
% affecting the references typeset with |\ref|?
% This is possible, too, by using the option \opt{subrefformat}:
% \begin{quote}
% |\captionsetup{subrefformat=|\meta{label format}|}|
% \end{quote}
% This one will choose a label format (either a pre-defined one, or a one defined with
% |\Declare|\-|Caption|\-|Label|\-|Format|) as decorative element to sub-references.
% The default one is |simple| which has no decorative elements but simply typeset
% the reference as it is.
%
% For example
% \begin{quote}
% |\captionsetup{subrefformat=parens}|
% \end{quote}
% will result in references (typeset with |\ref|) like `|1a|' but sub-references
% (typeset with |\subref|) like `|(a)|'.
%
% \subsection{Referencing sub-figures without sub-captions}
%
% \DescribeMacro\phantomsubcaption
% \DescribeMacro\phantomcaption
% If you don't want to give a sub-figure a caption, because the picture itself
% already contains the caption, or for some other reason, you can use the command
% \begin{quote}
% |\phantomsubcaption|
% \end{quote}
% instead of |\sub|\-|caption|, or
% -- when inside a |sub|\-|figure| or |sub|\-|table| environment --
% |\phantom|\-|caption| instead of |\caption|.
% |\phantom|\-|sub|\-|caption| and |\phantom|\-|caption| do not have any arguments, and
% they do not generate any output, but give you an anchor for a |\label| command
% which can be placed afterwards.
% Furthermore it increases the sub-figure resp. sub-table counter.
%
% Please note that -- just like |\sub|\-|caption| -- the |\phantom|\-|sub|\-|caption|
% command \emph{must} be applied inside its own group, box, or environment.
%
% \pagebreak[3]
% An example:
% \begin{quote}
% |\begin{figure}|\\
% | \centering|\\
% | {\includegraphics{cat_with_a}|\\
% | \phantomsubcaption\label{cat}}|\\
% | {\includegraphics{elephant_with_b}|\\
% | \phantomsubcaption\label{elephant}}|\\
% | \caption{Two animals: \subref{cat} a huge cat,|\\
% | and \subref{elephant} an elephant}|\\
% |\end{figure}|
% \end{quote}
%
% \noindent\begin{minipage}{\linewidth}
% \setcaptiontype{figure}
% \centering
% {\begin{overpic}[width=60pt]{cat}
% \put(40,34){(a)}
% \end{overpic}
% \phantomsubcaption\label{cat6.3}}
% {\begin{overpic}[width=.4\textwidth]{elephant}
% \put(60,50){(b)}
% \end{overpic}
% \phantomsubcaption\label{elephant6.3}}
% \captionsetup{subrefformat=parens}
% \caption{Two animals: \subref{cat6.3} a huge cat, and \subref{elephant6.3} an elephant}
% \end{minipage}
%
% \pagebreak[3]
% \subsection{Where to place the \cs{label} command?}
% \label{label}
%
% When using |\sub|\-|caption| or |\phantom|\-|sub|\-|caption|,
% or |\caption| or |\phantom|\-|caption| inside a |sub|\-|figure| or |sub|\-|table| environment,
% the |\label| can be either placed inside the caption text or right after the |\sub|\-|caption| or
% |\caption| command, e.g:
% \begin{quote}
% |\subcaption{Some text here\label{label1}}|\\
% \ldots\\
% |\subcaption{Some other text}\label{label2}}|\\
% \ldots\\
% |\subcaption{Something different}|\\
% |\label{label3}|
% \end{quote}
%
% When using the |\sub|\-|caption|\-|box| command, the |\label| should be placed inside
% the caption text, e.g.:
% \begin{quote}
% |\subcaptionbox{A description here\label{label4}}|\\
% | {Some content here}|\\
% \ldots\\
% |\subcaptionbox[List-of-Figures entry]|\\
% | {A description here\label{label5}}|\\
% | {Some content here}|
% \end{quote}
%
% \pagebreak[3]
% \subsection{Where do hyperlinks jump?}
% \label{hypcap}
%
% For the |subfigure| \& |subtable| environments and |\subcaptionbox| boxes
% (and own constructs which use |\set|\-|caption|\-|sub|\-|type|) the
% hyperlink anchors will be placed in respect to the |hypcap=| setting.
% While usage of this option is straight-forward for ordinary captions,
% the usage for sub-captions depends on the setting regarding the main captions.
% This table gives you an overview where the hyperlinks will jump:\par
%
% \bigskip
% \begin{small}
% \centering
% \DeleteShortVerb{\|}
% \renewcommand\arraystretch{1.5}
% \begin{tabular}{|l|p{3cm}p{3cm}|}
% \hline
% \backslashbox{subcaption}{caption} &
% \multicolumn{1}{c}{\texttt{hypcap=false}} &
% \multicolumn{1}{c|}{\texttt{hypcap=true}} \\
% \hline
% \raisebox{-1.5ex}[1.5ex]{\texttt{hypcap=false}} &
% sub-caption & figure or table\par\hfill\textit{(default setting)}\\
% \raisebox{-1.5ex}[1.5ex]{\texttt{hypcap=true}} &
% sub-figure or\par sub-table & sub-figure or\par sub-table \\
% \hline
% \end{tabular}\par
% \MakeShortVerb{\|}
% \end{small}
% \bigskip
%
% But if |\subcaption| is used and |hypcap=true| is set for sub-captions,
% \thispackage\ does not know where the sub-figure or sub-table actually
% begins, so it will jump to the sub-caption instead.
%
% \medskip
% \emph{Remember:} If you use the \package{hypcap} package\cite{hypcap},
% it controls the placement of the hyperlink anchors, making the rules
% above invalid.
%
% \bigskip
% {\small(See also the documentation of the \package{caption} package,
% sections about \package{hyperref} \& \package{hypcap}.)}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \pagebreak[3]
% \section{Beyond this package}
% \label{floatrow}
%
% For a more advanced usage of the sub-caption feature of the
% \package{caption} package, please take a look at the \package{floatrow}
% package\cite{floatrow} which provides the powerful \texttt{subfloatrow}
% environment for typesetting sub-figures.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \pagebreak[3]
% \section{Thanks}
%
% I would like to thank
% Stephen Dalton
% who helped to make this package a better one.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \StopEventually{%^^A
% \begin{thebibliography}{9}
% \bibitem{TLC2}
% Frank Mittelbach and Michel Goossens:\\
% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},
% \newblock Addison-Wesley, 2004.
% \bibitem{floatrow}
% Olga Lapko:\\
% \href{http://www.ctan.org/pkg/floatrow}%
% {\emph{The floatrow package documentation}},
% 2007/12/24
% \bibitem{hyperref}
% Sebastian Rahtz \& Heiko Oberdiek:\\
% \href{http://www.ctan.org/pkg/hyperref}%
% {\emph{Hypertext marks in \LaTeX}},
% November 12, 2007
% \bibitem{hypcap}
% Heiko Oberdiek:\\
% \href{http://www.ctan.org/pkg/hypcap}%
% {\emph{The hypcap package -- Adjusting anchors of captions}},
% 2007/04/09
% \iffalse
% \bibitem{subfig}
% Steven D. Cochran:\\
% \href{http://www.ctan.org/pkg/subfig}%
% {\emph{The subfig package}},
% 2005/07/05
% \fi
% \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{\@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{\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}{2007/09/01}{First demo}
% \changes{v0.2}{2007/11/11}{\cs{subcaptionbox} added}
% \changes{v0.3}{2007/12/06}{Adapted to \package{caption} package \version{3.1f}}
% \changes{v1.0}{2008/03/16}{\cs{subfloat} added}
% \changes{v1.0}{2010/10/27}{An error message will be issued when the subfigure or subfig package is loaded}
% \changes{v1.0}{2011/01/22}{Undocumented command \cs{subfloat} removed}
%
% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{The implementation}
% \iffalse
%<*package>
% \fi
%
% \subsection{Identification}
%
% \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: subcaption.dtx 142 2016-02-20 19:59:43Z sommerfeldt $
\ProvidesPackage{subcaption}[\caption@tempa v1.1-\caption@tempb Sub-captions (AR)]
% \end{macrocode}
%
% \subsection{Initial code}
%
% Since we base on the \package{caption} package we load it here.
% \begin{macrocode}
\RequirePackage{caption}[2012/03/25] % needs v3.3 or newer
% \end{macrocode}
% \changes{v1.1}{2011/09/01}{Compatibility error added}
% \begin{macrocode}
\caption@AtBeginDocument{\caption@ifcompatibility{%
\caption@Error{%
The `subcaption' package does not work correctly\MessageBreak
in compatibility mode}}{}}
% \end{macrocode}
%
% Since we are incompatible to them an error message will be issued when
% the \package{subfigure} or \package{subfig} package is loaded.
% \begin{macrocode}
\@ifpackageloaded{subfigure}{%
\PackageError{subcaption}%
{This package can't be used in cooperation\MessageBreak
with the subfigure package}%
{RTFM}%
\endinput}{}%
% \end{macrocode}
% \begin{macrocode}
\@ifpackageloaded{subfig}{%
\PackageError{subcaption}%
{This package can't be used in cooperation\MessageBreak
with the subfig package}%
{RTFM}%
\endinput}{}%
% \end{macrocode}
%
% \iffalse
% \subsection{Declaration of options}
% We do not have own options.
% \fi
%
% \subsection{Execution of options}
%
% We use |\caption@ExecuteOptions| and |\caption@ProcessOptions| here to add
% the options to the `|sub|' option list instead of executing them immediately.
% \begin{macrocode}
\caption@SetupOptions{subcaption}{\captionsetup[sub]{#2}}%
\caption@ExecuteOptions{subcaption}{%
font+=small,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0}
\caption@ProcessOptions*{subcaption}
% \end{macrocode}
%
% \subsection{Main code}
%
% \changes{v1.1}{2011/10/30}{Adapted to the newfloat package}
% We call |\Declare|\-|Caption|\-|Sub|\-|Type| for |figure|, |table|,
% and each caption type declared with |\Declare|\-|Floating|\-|Environment| here.
% \begin{macrocode}
\caption@ForEachType{\DeclareCaptionSubType{#1}}
% \end{macrocode}
%
% \begin{macro}{\newsubfloat}
% \changes{v1.1}{2016/01/31}{Adapted to the memoir document class}
% We re-define |\new|\-|sub|\-|float| (offered by the \package{memoir} document class),
% so our stuff will be used instead.
% \begin{macrocode}
\caption@ifundefined\newsubfloat{}{%
\renewcommand*\newsubfloat{\DeclareCaptionSubType}}
% \end{macrocode}
% \end{macro}
%
% \pagebreak[3]
% \subsubsection{The \cs{subcaption} command}
%
% \begin{macro}{\subcaption}
% \changes{v1.1}{2012/04/06}{\cs{newcommand} changed to \cs{def}
% so it works with the \package{memoir} document class, too}
% Without a prefacing |\set|\-|caption|\-|sub|\-|type|, |\sub|\-|caption| is some kind
% of |\caption|\-|of{sub|\-|\@cap|\-|type}|.
% \Note{Like \cs{captionof}, this command is designed to be used inside an
% own group!}
% \begin{macrocode}
\def\subcaption{%
\caption@iftype
{\setcaptionsubtype*\caption}%
{\caption@Error{\noexpand\subcaption outside float}%
\caption@gobble}}%
% \end{macrocode}
% But with a prefacing |\set|\-|caption|\-|sub|\-|type|, |\sub|\-|caption| is simply
% |\caption|.
% \begin{macrocode}
\g@addto@macro\caption@subtypehook{%
\let\subcaption\caption}
% \end{macrocode}
% \end{macro}
%
% \pagebreak[3]
% \subsubsection{The \cs{phantomsubcaption} command}
%
% \begin{macro}{\phantomsubcaption}
% \changes{v1.1}{2011/08/17}{This macro added}
% Same as |\phantom|\-|caption|, but for subfigures.
% \begin{macrocode}
\newcommand*\phantomsubcaption{%
\caption@iftype
{\setcaptionsubtype*\phantomcaption}%
{\caption@Error{\noexpand\phantomsubcaption outside float}}}%
% \end{macrocode}
% \begin{macrocode}
\g@addto@macro\caption@subtypehook{%
\let\phantomsubcaption\phantomcaption}
% \end{macrocode}
% \end{macro}
%
% \pagebreak[3]
% \subsubsection{The subfigure \& subtable environments}
%
% \begin{macro}{subfigure}
% \begin{macro}{subtable}
% This is just an ordinary \env{minipage} environment with
% |\setcaptionsubtype| as first contents line.
% It will be defined using the helper macro |\caption@For{sub|\-|type|\-|list}|
% offered by the \package{caption} kernel, so for every caption type
% declared with |\Declare|\-|Floating|\-|Environment| a corresponding `sub' environment
% will be defined automatically.
% \begin{macrocode}
\caption@For{subtypelist}{%
\newenvironment{sub#1}%
{\caption@withoptargs\subcaption@minipage}%
{\endminipage}}%
% \end{macrocode}
% \begin{macrocode}
\newcommand*\subcaption@minipage[2]{%
\minipage#1{#2}%
\setcaptionsubtype\relax}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \pagebreak[3]
% \subsubsection{The \cs{subcaptionbox} command}
%
% \begin{macro}{\subcaptionbox}
% \changes{v1.0}{2008/05/06}{Adapted to the \opt{rule} option of the \package{caption} package}
% \changes{v1.0}{2008/08/31}{Definition and usage of \cs{subcaption@hrule} added}
% \changes{v1.0}{2010/12/17}{Uses \cs{caption@box} now}
% \changes{v1.1}{2011/08/16}{Adapted to actual version of \cs{caption@box}}
% \changes{v1.1}{2012/04/09}{Adapted to actual version of \cs{caption@ibox}}
% A |\parbox| with contents and sub-caption, separated by an invisible |\hrule|.
% \begin{macrocode}
\newcommand*\subcaptionbox{%
\caption@withoptargs{\caption@ibox\setcaptionsubtype}}
% \end{macrocode}
% \end{macro}
%
% \pagebreak[3]
% \subsubsection{The \cs{subref} command}
%
% At |\captionsetup{subtype}|, we redefine |\label|.
% \begin{macrocode}
\g@addto@macro\caption@subtypehook{%
\ifx\label\subcaption@label \else
\let\subcaption@ORI@label\label
\let\label\subcaption@label
\fi}
% \end{macrocode}
%
% \begin{macro}{\subcaption@label}
% \changes{v1.1}{2011/09/12}{Redefinition of \cs{SK@} added}
% \changes{v1.1}{2011/09/12}{Uses \cs{caption@withoptargs} now}
% \changes{v1.1}{2016/02/20}{Unwanted space removed}
% When a label will be placed for a sub-caption, we automatically place
% a second one for |\subref|, too. This second label will contain
% the sub-type counter only.
% \begin{macrocode}
\newcommand*\subcaption@label{%
\caption@withoptargs\subcaption@@label}
% \end{macrocode}
% \begin{macrocode}
\newcommand*\subcaption@@label[2]{%
\@bsphack\begingroup
\subcaption@ORI@label#1{#2}%
\let\SK@\@gobbletwo
\protected@edef\@currentlabel{\csname thesub\@captype\endcsname}%
\subcaption@ORI@label#1{sub@#2}%
\endgroup\@esphack}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subref}
% \changes{v1.1}{2011/08/14}{Caption option \opt{subrefformat=} added}
% \changes{v1.1}{2011/08/18}{Uses \cs{caption@setoptions*} now}
% \changes{v1.1}{2012/01/12}{Usage of \cs{caption@setoptions*} replaced by \cs{caption@setoptions}}
% \changes{v1.1}{2012/04/09}{Revised}
% This one calls |\ref| with the second label. (see |\subcaption@label|)
% \begin{macrocode}
\DeclareRobustCommand*\subref{%
\@ifstar
{\caption@withoptargs\subcaption@ref*}%
{\caption@withoptargs\@subref}}
\newcommand*\@subref[2]{%
\caption@ifundefined\hyperref
{\subcaption@ref{#1}{#2}}%
{\hyperref[#2]{\subcaption@ref{*#1}{#2}}}}
% \end{macrocode}
% \begin{macrocode}
\newcommand*\subcaption@ref[2]{%
\begingroup
\caption@setoptions{sub}%
\subcaption@reffmt\p@subref{\ref#1{sub@#2}}%
\endgroup}
% \end{macrocode}
% \begin{macrocode}
\newcommand*\p@subref{}
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
\DeclareCaptionOption{subrefformat}{\subcaption@setrefformat{#1}}
% \end{macrocode}
%
% \begin{macro}{\subcaption@setrefformat}
% |\subcaption@setrefformat|\marg{name}\par
% Selecting a subref format simply means saving the code (in |\subcaption@reffmt|).
% \begin{macrocode}
\newcommand*\subcaption@setrefformat[1]{%
\@ifundefined{caption@lfmt@#1}%
{\caption@Error{Undefined label format `#1'}}%
{\expandafter\let\expandafter\subcaption@reffmt\csname caption@lfmt@#1\endcsname}}
% \end{macrocode}
% \begin{macrocode}
\subcaption@setrefformat{simple}
% \end{macrocode}
% \end{macro}
%
% \iffalse
%</package>
% \fi
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \Finale
%
\endinput
|