summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/caption/subcaption.sty
blob: 0f03f498edd7cfab7a48fca060e51028650a5a5b (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
%%
%% This is file `subcaption.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% subcaption.dtx  (with options: `package')
%% 
%% Copyright (C) 1994-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%% 
%% https://gitlab.com/axelsommerfeldt/caption
%% 
%% --------------------------------------------------------------------------
%% 
%% 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
%%   CHANGELOG, README, SUMMARY, caption.ins,
%%   caption.dtx, caption2.dtx, caption3.dtx,
%%   bicaption.dtx, ltcaption.dtx, subcaption.dtx,
%%   newfloat.dtx, and totalcount.dtx
%% the derived files
%%   caption.sty, caption2.sty, caption3.sty,
%%   bicaption.sty, ltcaption.sty, subcaption.sty,
%%   newfloat.sty, and totalcount.sty
%% and the user manuals
%%   caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%% 
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{subcaption}[2019/09/01 v1.3a Sub-captions (AR)]
\RequirePackage{caption}[2019/09/01] % needs v3.3c or newer
\newcommand\subcaption@CheckCompatibility{%
  \@ifundefined{caption@ifcompatibility}{}{%
    \caption@ifcompatibility{%
      \caption@Error{%
        The `subcaption' package does not work correctly\MessageBreak
        in compatibility mode}}{}}%
  \@ifpackageloaded{subfigure}{%
    \PackageError{subcaption}%
      {This package can't be used in cooperation\MessageBreak
       with the subfigure package}%
      {\subcaption@EH}%
    \endinput}{}%
  \@ifpackageloaded{subfig}{%
    \PackageError{subcaption}%
      {This package can't be used in cooperation\MessageBreak
       with the subfig package}%
      {\subcaption@EH}%
    \endinput}{}%
}
\newcommand*\subcaption@EH{%
  If you do not understand this error, please take a closer look\MessageBreak
  at the documentation of the `subcaption' package, especially the\MessageBreak
  section about errors.\MessageBreak\@ehc}
\subcaption@CheckCompatibility
\caption@AtBeginDocument{%
  \subcaption@CheckCompatibility
  \let\subcaption@CheckCompatibility\@undefined
  \let\subcaption@EH\@undefined
}
\caption@SetupOptions{subcaption}{\captionsetup[sub]{#2}}%
\caption@ExecuteOptions{subcaption}{%
  size=smaller,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0}
\caption@ProcessOptions*{subcaption}
\caption@ForEachType{\DeclareCaptionSubType{#1}}
\caption@ifundefined\newsubfloat{}{%
  \renewcommand*\newsubfloat{\DeclareCaptionSubType}}
\def\subcaption{%
  \caption@iftype
    {\setcaptionsubtype*\caption}%
    {\caption@Error{\noexpand\subcaption outside float}%
     \caption@gobble}}%
\g@addto@macro\caption@subtypehook{%
  \let\subcaption\caption}
\newcommand*\phantomsubcaption{%
  \caption@iftype
    {\setcaptionsubtype*\phantomcaption}%
    {\caption@Error{\noexpand\phantomsubcaption outside float}}}%
\g@addto@macro\caption@subtypehook{%
  \let\phantomsubcaption\phantomcaption}
\caption@For{subtypelist}{%
  \newenvironment{sub#1}%
    {\@ifnextchar[%]
       \subcaption@iminipage
       {\subcaption@iminipage[c]}}%
    {\subcaption@endminipage
     \endminipage}}%
\def\subcaption@iminipage[#1]{%
  \caption@withoptargs{\subcaption@iiminipage{#1}}}
\newcommand*\subcaption@iiminipage[3]{%
  \let\subcaption@endminipage\@empty
  \if#1B%
    \minipage[b]#2{#3}%
    \def\subcaption@endminipage{\vspace{0pt}}%
  \else\if#1T%
    \minipage[t]#2{#3}%
    \vspace{0pt}%
  \else
    \minipage[#1]#2{#3}%
  \fi\fi
  \setcaptionsubtype\relax}
\newcommand*\subcaptionbox{%
  \caption@withoptargs{\caption@ibox\setcaptionsubtype}}
\g@addto@macro\caption@subtypehook{%
  \ifx\label\subcaption@label \else
    \let\subcaption@ORI@label\label
    \let\label\subcaption@label
  \fi}
\newcommand*\subcaption@label{%
  \caption@withoptargs\subcaption@@label}
\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}
\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}}}}
\newcommand*\subcaption@ref[2]{%
  \begingroup
    \caption@setoptions{sub}%
    \subcaption@reffmt\p@subref{\ref#1{sub@#2}}%
  \endgroup}
\newcommand*\p@subref{}
\DeclareCaptionOption{subrefformat}{\subcaption@setrefformat{#1}}
\newcommand*\subcaption@setrefformat[1]{%
  \@ifundefined{caption@lfmt@#1}%
    {\caption@Error{Undefined label format `#1'}}%
    {\expandafter\let\expandafter\subcaption@reffmt\csname caption@lfmt@#1\endcsname}}
\subcaption@setrefformat{simple}
\caption@ifundefined\subfloat{%
  \newcommand*\subfloat{%
    \@ifnextchar[\@subfloat\subfloat@}
  \long\def\@subfloat[#1]{%
    \@ifnextchar[{\@@subfloat{#1}}{\@@@subfloat\subcaptionbox{#1}}}
  \long\def\@@subfloat#1[#2]{\@@@subfloat{\subcaptionbox[{#1}]}{#2}}
  \newcommand\@@@subfloat[3]{%
    \caption@getlabel#3\label{}\@nil
    #1{#2\caption@thelabel}{\let\label\caption@gobble#3}%
    \global\let\caption@thelabel\relax
    \ignorespaces}
  \newcommand*\subfloat@[1]{%
    \setbox\@tempboxa\hbox{#1}%
    \caption@iiiibox\setcaptionsubtype
      {\phantomcaption\@gobble}{\phantomcaption\@gobble}% no box with \caption
      {}% no optional arguments for \caption
      {}% no sub-caption
      [\wd\@tempboxa][\caption@hj@default]%
      {\unhbox\@tempboxa}%
    \ignorespaces}
}{%
  \PackageInfo{subcaption}{\protect\subfloat\space is already defined\@gobble}
}
\endinput
%%
%% End of file `subcaption.sty'.