%%
%% 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]
%%^^A|\newcommand\CenterFloatBoxes{\CADJfalse\OADJfalse|
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
%%^^A
\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'.
