summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/floatrow/fr-subfig.sty
blob: 3ec9313ff1cdb675a64872635094362ac4ce12ac (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
%%
%% This is file `fr-subfig.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% floatrow.dtx  (with options: `frforsubfig')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from fr-subfig.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file floatrow.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{fr-subfig}
       [2007/12/24 v0.1g (beta) floatrow: additions for subfig]
\def\@tempb{2005/06/28 ver: 1.3 subfig package}
\expandafter\let\csname @tempa\expandafter\endcsname
    \csname ver@subfig.\@pkgextension\endcsname
\ifx\@tempa\@tempb\else
    \PackageWarning{fr-subfig}{The additions cooperated with \MessageBreak
        version `2005/06/28 ver: 1.3' of package subfig,\MessageBreak
        but only version\MessageBreak
        \csname ver@subfig.\@pkgextension\endcsname'\MessageBreak
        is available}\relax
    \fi
\newlength\FBsc@max
\newlength\FBso@max
\@ifdefinable\FBsubcheight{\let\FBsubcheight\relax}
\@ifdefinable\FBsuboheight{\let\FBsuboheight\relax}
\newcommand\adjustsubfloats{\@tempswafalse
  \ifCADJ\@tempswatrue\fi\ifOADJ\@tempswatrue\fi
  \if@tempswa\FB@writeaux{%
    \string\global\string\c@FBcnt\thepage
    \ifCADJ\string\edef\string\FBsubcheight{\the\FBsc@max}\fi
    \ifOADJ\string\edef\string\FBsuboheight{\the\FBso@max}\fi
   }\fi
  \global\let\FBsubcheight\relax\global\let\FBsuboheight\relax
  \global\FBso@max\z@\global\FBsc@max\z@}
\long\def\sf@@@subfloat#1[#2][#3]#4{%
    \@ifundefined{FBsc@max}{}%
        {\FB@readaux{\let\FBsuboheight\relax}}%
    \@tempcnta=\@ne
    \if@minipage
      \@tempcnta=\z@
    \else\ifdim \lastskip=\z@ \else
      \@tempcnta=\tw@
    \fi\fi
    \ifmaincaptiontop
      \sf@top=\sf@nearskip
      \sf@bottom=\sf@farskip
    \else
      \sf@top=\sf@farskip
      \sf@bottom=\sf@nearskip
    \fi
    \leavevmode
    \setbox\@tempboxa \hbox{#4}%
    \ifdim\wd\@tempboxa=\z@\ht\@tempboxa\z@\dp\@tempboxa\z@
      \setbox\z@\hbox{{\caption@@@make
           {\caption@lfmt{\@nameuse{sub\@captype name}}%
           {\@nameuse{thesub\@captype}}\relax}{}}}\@tempdima=\wd\z@
      \sf@top=\z@
      \sf@bottom=\z@
      \sf@capskip\z@
      \sf@captopadj\z@
      \let\sf@ifpositiontop\@firstoftwo
    \else
      \@tempdima=\wd\@tempboxa
      \@ifundefined{FBsc@max}{}%
          {\global\advance\Xhsize-\wd\@tempboxa
           \dimen@=\ht\@tempboxa
           \advance\dimen@\dp\@tempboxa
           \ifdim\dimen@>\FBso@max
             \global\FBso@max\dimen@
           \fi}%
    \fi
    \vtop\bgroup
      \vbox\bgroup
        \ifcase\@tempcnta
          \@minipagefalse
        \or
          \vskip\sf@top
        \or
          \ifdim \lastskip=\z@ \else
            \@tempskipb\sf@top\relax\@xaddvskip
          \fi
        \fi
        \sf@ifpositiontop{%
          \ifx \@empty#3\relax \else
            \sf@subcaption{#1}{#2}{#3}%
            \vskip\sf@capskip
            \vskip\sf@captopadj
          \fi\egroup
          \hrule width0pt height0pt depth0pt
          \box\@tempboxa
        }{%
        \@ifundefined{FBsc@max}%
            {\box\@tempboxa}%
            {\ifx\FBsuboheight\relax
               \box\@tempboxa
             \else
               \vbox to \FBsuboheight{\FBafil\box\@tempboxa\FBbfil}%
             \fi}%
          \egroup
          \ifx \@empty#3\relax \else
            \vskip\sf@capskip
            \hrule width0pt height0pt depth0pt
            \sf@subcaption{#1}{#2}{#3}%
         \fi
        }%
      \vskip\sf@bottom
    \egroup
    \@ifundefined{FBsc@max}{}%
        {\addtocounter{FRobj}{-1}%
         \ifnum\c@FRobj>0%  bugfix
           \subfloatrowsep
         \fi}%
    \ifmaincaptiontop\else
      \global\advance\@nameuse{c@\@captype}\m@ne
    \fi
  \endgroup\ignorespaces}
\DeclareFROpt{subcapbesideposition}{\flrow@SFbesidealign{#1}}
\newcommand*\flrow@SFbesidealign[1]{%
  \caption@ifinlist{#1}{t,top}{%
     \let\flrow@SFBalign\TopFloatBoxes
  }{\caption@ifinlist{#1}{b,bottom,default}{%
     \let\flrow@SFBalign\BottomFloatBoxes
  }{\caption@ifinlist{#1}{c,center}{%
     \let\flrow@SFBalign\CenterFloatBoxes
  }{\PackageError{floatrow}%
     {Undefined sublabel position `#1'}{\flrow@eh}%
  }}}}
\newcommand\flrow@SFBalign{\BottomFloatBoxes}
\newcommand\sidesubfloat{%
  \ifx\@captype\@undefined
    \@latex@error{\noexpand\subfloat outside float}\@ehd
     \expandafter\@gobble
  \else
    \expandafter\@firstofone
  \fi
  {\flrow@sidesubfloat}}
\def\flrow@sidesubfloat{\flrow@SFBalign
  \begingroup
    \@ifundefined{caption@setfloattype}%
      \caption@settype
      \caption@setfloattype
          \@captype
    \sf@ifpositiontop{%
      \maincaptiontoptrue
    }{%
      \maincaptiontopfalse
    }%
    \caption@setoptions{subfloat}%
    \caption@setoptions{sub\@captype}%
    \let\sf@oldlabel=\label
    \let\label=\subfloat@label
    \ifmaincaptiontop\else
      \advance\@nameuse{c@\@captype}\@ne
    \fi
    \refstepcounter{sub\@captype}%
    \setcounter{sub\@captype @save}{\value{sub\@captype}}%
    \@ifnextchar [%  %] match left bracket
      {\flrow@@sidesubfloat}%
      {\flrow@@sidesubfloat[\@empty]}}
\long\def\flrow@@sidesubfloat[#1]{%
    \@ifnextchar [%  %] match left bracket
      {\flrow@@@sidesubfloat{sub\@captype}[{#1}]}%
      {\flrow@@@sidesubfloat{sub\@captype}[\@empty{#1}][{#1}]}}
\long\def\flrow@@@sidesubfloat#1[#2][#3]#4{%
    \@ifundefined{FBsc@max}{}%
        {\FB@readaux{\let\FBsuboheight\relax}}%
    \@tempcnta=\@ne
    \if@minipage
      \@tempcnta=\z@
    \else\ifdim \lastskip=\z@ \else
      \@tempcnta=\tw@
    \fi\fi
    \sf@bottom=\z@
    \sf@top=\z@
    \leavevmode
    \setbox\@tempboxa \hbox{#2}%
    \@tempdima\wd\@tempboxa
    \setbox\@tempboxa \hbox{#4}%
    \advance\@tempdima\wd\@tempboxa
    \advance\@tempdima\labelsep
    \@ifundefined{FBsc@max}{}%
        {\global\advance\Xhsize-\wd\@tempboxa
         \dimen@=\ht\@tempboxa
         \advance\dimen@\dp\@tempboxa
         \ifdim\dimen@>\FBso@max
           \global\FBso@max\dimen@
         \fi}%
    \begin@FBBOX
        \ifcase\@tempcnta
          \@minipagefalse
        \or
          \vskip\sf@top
        \or
          \ifdim \lastskip=\z@ \else
            \@tempskipb\sf@top\relax\@xaddvskip
          \fi
        \fi
        \hbox{%
        \begin@FBBOX
           \ifx \@empty#3\relax \else
               \hbox{\caption@@@make
                  {\caption@lfmt{\@nameuse{sub\@captype name}}%
                  {\@nameuse{thesub\@captype}}\relax}{}}%
        \fi
        \end@FBBOX\hskip\labelsep\ignorespaces
        \begin@FBBOX
           \box\@tempboxa
        \end@FBBOX
        }%
        \vskip\sf@bottom
    \end@FBBOX
    \@ifundefined{FBsc@max}{}%
        {\addtocounter{FRobj}{-1}%
         \ifnum\c@FRobj>0
           \subfloatrowsep
         \fi}%
    \ifmaincaptiontop\else
      \global\advance\@nameuse{c@\@captype}\m@ne
    \fi
  \endgroup\ignorespaces}
\newcommand\subfloatlabel{\@ifnextchar[%]
    {\flrow@subfloatlabel}{\subfloat[]{}}}
\@ifdefinable\flrow@subfloatlabel{}
\def\flrow@subfloatlabel[#1]{%
  \ifx\@captype\@undefined
    \@latex@error{\noexpand\subfloat outside float}\@ehd
  \fi
  \begingroup
    \count@#1\advance\count@\m@ne
    \csname c@sub\@captype\endcsname\count@\relax
    \@ifnextchar[%]
      {\flrow@@subfloatlabel[#1]}%
      {\subfloat[]{}\endgroup}}
\@ifdefinable\flrow@@subfloatlabel{}
\@ifundefined{newseparatedlabel}\@tempswatrue\@tempswafalse
\if@tempswa
    \def\FRsf@Flabel{\label}
\else
    \newseparatedlabel\FRsf@Flabel{\@captype}{sub\@captype}
\fi
\def\flrow@@subfloatlabel[#1][#2]{%
    \subfloat[]{\FRsf@Flabel{#2}}\endgroup}
\endinput
%%
%% End of file `fr-subfig.sty'.