%%
%% This is file `ccaption.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ccaption.dtx  (with options: `usc')
%% 
%%   Author: Peter Wilson (CUA) now at peter.r.wilson@boeing.com
%%                              (or pandgwilson@earthlink.net)
%%   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Peter R. Wilson
%% 
%%   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 the 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/06/01 or later.
%% 
%%   This work has the LPPL maintenance status "author-maintained".
%% 
%%   This work consists of the files listed in the README file.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ccaption}[2002/10/18 v3.1b Extended captioning and new floats]

\newif\if@contsubfigxx
  \@contsubfigxxfalse
\newif\if@contsubfigxxi
  \@contsubfigxxifalse
\newif\if@contsubfig
  \@contsubfigfalse
\DeclareOption{subfigure20}{\@contsubfigxxtrue\@contsubfigxxifalse\@contsubfigtrue}
\DeclareOption{subfigure21}{\@contsubfigxxfalse\@contsubfigxxitrue\@contsubfigtrue
  \PackageWarningNoLine{ccaption}{%
      The subfigure21 option is deprecated.\MessageBreak
      Try and use the subfigure option instead}}
\DeclareOption{subfigure}{\@contsubfigxxfalse\@contsubfigxxitrue\@contsubfigtrue}
\newif\if@contcapoption
  \@contcapoptionfalse
\DeclareOption{caption2}{\@contcapoptiontrue}
\newif\if@conttitleopt
  \@conttitleoptfalse
\DeclareOption{titles}{\@conttitleopttrue}

\ProcessOptions\relax

\newif\if@contcw
\newif\if@conthang
\newif\if@contindent

\if@contcapoption
  \PackageWarningNoLine{ccaption)}%
    {You have used the caption2 option.\MessageBreak
     The ccaption styling commands\MessageBreak
     are unavailable to you}
\else

\newcommand{\captiondelim}[1]{\def\@contdelim{#1}}
\captiondelim{: }

\newcommand{\captionnamefont}[1]{\def\@contnfont{#1}}
\captionnamefont{}

\newcommand{\captiontitlefont}[1]{\def\@conttfont{#1}}
\captiontitlefont{}

\newcommand{\flushleftright}{%
  \leftskip\z@ \rightskip\z@
  \parfillskip=\z@ plus 1fil}
\newcommand{\centerlastline}{%
  \leftskip=\z@ plus 1fil
  \rightskip=\z@ plus -1fil
  \parfillskip=\z@ plus 2fil}

\newcommand{\captionstyle}[1]{\def\@contcstyle{#1}}
\captionstyle{}

\newlength{\@contcwidth}
\newcommand{\captionwidth}[1]{\setlength{\@contcwidth}{#1}}
\captionwidth{\linewidth}
\newcommand{\changecaptionwidth}{\@contcwtrue}
\newcommand{\normalcaptionwidth}{\@contcwfalse}
\normalcaptionwidth

\newlength{\@contindw}
\newcommand{\hangcaption}{\@conthangtrue\@contindentfalse}
\newcommand{\indentcaption}[1]{\setlength{\@contindw}{#1}%
  \@conthangfalse\@contindenttrue}
\newcommand{\normalcaption}{\@conthangfalse\@contindentfalse}
\normalcaption

\newcommand{\precaption}[1]{\def\@contpre{#1}}
\precaption{}
\newcommand{\postcaption}[1]{\def\@contpost{#1}}
\postcaption{}
\newcommand{\midbicaption}[1]{\def\@contmidbi{#1}}
\midbicaption{}

\long\def\@makecaption#1#2{\let\@conttempa\relax
  \ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip
  \else \def\@conttempa{\vbox to\topskip{}}\fi
  \let\@contfnote\footnote \renewcommand{\footnote}[2][]{}
  \let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{}
  \let\@contlabel\label \renewcommand{\label}[1]{}
  \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2}
  \let\footnote\@contfnote
  \let\footnotemark\@contfmark
  \let\label\@contlabel
  \ifdim\wd\@tempboxa<\linewidth \centering \fi
  \if@contcw
    \centering
    \parbox{\@contcwidth}{%
  \fi
  \if@conthang
    \sbox\@tempboxa{\@contnfont #1\@contdelim}
    \@contpre%
    {\@contnfont #1\@contdelim}\@conttempa
    {\@contcstyle\hangindent=\wd\@tempboxa\hangafter=\@ne\@conttfont #2\par}
  \else
    \if@contindent
      \@contpre%
      {\@contnfont #1\@contdelim}\@conttempa
      {\@contcstyle\hangindent=\@contindw\hangafter=\@ne\@conttfont #2\par}
    \else
      \@contpre%
      {\@contnfont #1\@contdelim}\@conttempa
      {\@contcstyle\@conttfont #2\par}
    \fi
  \fi
  \@contpost
  \if@contcw
    \par
    }  % end of parbox
  \fi
  \vskip\belowcaptionskip}

\fi  % end of test (\if@contcapoption) on caption2 option

\newcommand{\contcaption}{%
  \addtocounter{\@captype}{\m@ne}%
  \refstepcounter{\@captype}%
  \@contcaption\@captype}

\long\def\@contcaption#1#2{%
  \par
  \begingroup
     \@parboxrestore
     \if@minipage
       \@setminipage
     \fi
     \normalsize
     \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #2}\par
  \endgroup}

\newlength{\abovelegendskip}
\setlength{\abovelegendskip}{0.5\baselineskip}
\newlength{\belowlegendskip}
\setlength{\belowlegendskip}{\abovelegendskip}

\newcommand{\legend}[1]{%
  \par
  \begingroup
     \@parboxrestore
     \if@minipage
       \@setminipage
     \fi
     \normalsize
     \captiondelim{\mbox{}}
     \@makecaption{}{\ignorespaces #1}\par
  \endgroup}

\newcommand{\namedlegend}{\@dblarg{\@legend\@captype}}

\long\def\@legend#1[#2]#3{%
  \par
  \csname flegtoc@#1\endcsname{#2}%
  \begingroup
    \@parboxrestore
    \if@minipage
      \@setminipage
    \fi
    \normalsize
    \@makecaption{\csname fleg@#1\endcsname}{\ignorespaces #3}\par
  \endgroup}

\newcommand{\flegtoc@table}[1]{}
\newcommand{\flegtoc@figure}[1]{}

\newcommand{\fleg@table}{\tablename}
\newcommand{\fleg@figure}{\figurename}

\newcommand{\newfixedcaption}[3][\caption]{%
  \newcommand{#2}{\def\@captype{#3}#1}}
\newcommand{\renewfixedcaption}[3][\caption]{%
  \renewcommand{#2}{\def\@captype{#3}#1}}
\newcommand{\providefixedcaption}[3][\caption]{%
  \providecommand{#2}{\def\@captype{#3}#1}}

\begingroup
\catcode`\Q=3
\long\gdef\@if@contemptyarg#1{\@xif@contmt#1QQ\@secondoftwo\@firstoftwo\@nil}
\long\gdef\@xif@contmt#1#2Q#3#4#5\@nil{#4}
\endgroup

\newcommand{\bitwonumcaption}[6][\@empty]{%
  \begingroup
  \@if@contemptyarg{#2}{\caption{#3}}{\caption[#2]{#3}}
  \ifx #1\@empty\else
    \label{#1}
  \fi
  \setlength{\abovecaptionskip}{0pt}
  \setlength{\belowcaptionskip}{0pt}
  \edef\@conttempc{#4}
  \expandafter \renewcommand \csname \@captype name\endcsname{\@conttempc}
  \addtocounter{\@captype}{-1}
  \@contmidbi
  \@if@contemptyarg{#5}{\caption{#6}}{\caption[#5]{#6}}
  \endgroup
}

\newcommand{\bionenumcaption}[6][\@empty]{%
  \begingroup
  \@if@contemptyarg{#2}{\caption{#3}}{\caption[#2]{#3}}
  \ifx #1\@empty\else
    \label{#1}
  \fi
  \setlength{\abovecaptionskip}{0pt}
  \setlength{\belowcaptionskip}{0pt}
  \edef\@conttempc{#4}
  \expandafter \renewcommand \csname \@captype name\endcsname{\@conttempc}
  \@contmidbi
  \contcaption{#6}
  \@if@contemptyarg{#5}{%
    \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
      {\protect\numberline{}{\ignorespaces #6}}}{%
    \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
      {\protect\numberline{}{\ignorespaces #5}}}
  \endgroup
}

\newcommand{\bicaption}[5][\@empty]{%
  \begingroup
  \@if@contemptyarg{#2}{\caption{#3}}{\caption[#2]{#3}}
  \ifx #1\@empty\else
    \label{#1}
  \fi
  \setlength{\abovecaptionskip}{0pt}
  \setlength{\belowcaptionskip}{0pt}
  \edef\@conttempc{#4}
  \expandafter \renewcommand \csname \@captype name\endcsname{\@conttempc}
  \@contmidbi
  \contcaption{#5}
  \endgroup
}

\newcommand{\bicontcaption}[3]{%
  \begingroup
  \contcaption{#1}
  \setlength{\abovecaptionskip}{0pt}
  \setlength{\belowcaptionskip}{0pt}
  \edef\@conttempc{#2}
  \expandafter \renewcommand \csname \@captype name\endcsname{\@conttempc}
  \@contmidbi
  \contcaption{#3}
  \endgroup
}

\if@contsubfig
  \newcounter{@contsubnum}
  \newcommand{\@contkeep}{\setcounter{@contsubnum}{\value{sub\@captype}}}
  \newcommand{\@contset}{\setcounter{sub\@captype}{\value{@contsubnum}}}
  \newcommand{\subconcluded}{\setcounter{sub\@captype}{0}}
  \let\subfigold@contcaption\@contcaption
  \providecommand{\toclevel@subtable}{1}
  \providecommand{\toclevel@subfigure}{1}
\fi
\newif\if@contmaincaption
  \@contmaincaptionfalse
\newif\if@contbotsub
  \@contbotsubtrue

\AtBeginDocument{%
\if@contsubfigxx
  \let\@contoldc\caption
  \renewcommand{\caption}{\@contmaincaptiontrue\@contoldc}
  \let\@contoldcont\contcaption
  \renewcommand{\contcaption}{\@contmaincaptiontrue\@contoldcont}
  \let\@contoldf\@float
  \renewcommand{\@float}[1]{\@contmaincaptionfalse
                \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}
                \@contoldf{#1}}
  \let\@contoldff\@dbflt
  \renewcommand{\@dbflt}[1]{\@contmaincaptionfalse
                \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}
                \@contoldff{#1}}

  \def\@subfloat#1[#2]#3{%
    \setbox\@tempboxa \hbox{#3}%
    \@tempdima=\wd\@tempboxa
    \if@contbotsub
      \vtop{%
        \vbox{\vskip\subfigtopskip
              \box\@tempboxa}%
        \ifx \@empty#2\relax \else
          \vskip\subfigcapskip
          \@subcaption{#1}{#2}%
        \fi
        \vskip\subfigbottomskip}%
    \else
      \vtop{%
        \ifx \@empty#2\relax \else
          \vskip\subfigcapskip
          \begingroup\@subcaption{#1}{#2}\endgroup%
        \fi
        \vbox{\vskip\subfigtopskip
              \box\@tempboxa}%
        \vskip\subfigbottomskip}%
    \fi
    \egroup}

  \renewcommand{\@subcaption}[2]{%
    \begingroup
      \let\label\@gobble
      \let\protect\string      % SDC mod
      \if@contmaincaption
        \addcontentsline{\csname ext@#1\endcsname}{#1}%
          {\protect\numberline{\csname p@#1\endcsname\csname the#1\endcsname}%
          {\ignorespaces #2}}%
        \gdef\@subfigcaptionlist{}
      \else
        \xdef\@subfigcaptionlist{%
        \@subfigcaptionlist,%
%%        {\string\numberline {\@currentlabel}%   % SDC mod
        {\protect\numberline {\@currentlabel}%   % SDC mod
         \noexpand{\ignorespaces #2}}}%
      \fi
    \endgroup
    \@nameuse{@make#1caption}{\@nameuse{@the#1}}{#2}}

  \let\subfigure\subbottom
  \let\subtable\subtop
\fi
}
\if@contsubfigxx
  \newcommand{\subbottom}{%
    \@contbotsubtrue
    \@contsubbody}

  \newcommand{\@contsubbody}{%
    \bgroup
    \if@contmaincaption\else
      \advance\csname c@\@captype\endcsname\@ne
    \fi
    \refstepcounter{sub\@captype}\@contkeep%
    \leavevmode
    \@ifnextchar [%
      {\@subfloat{sub\@captype}}
      {\@subfloat{sub\@captype}[\@empty]}}

  \newcommand{\contsubbottom}{%
    \@contbotsubtrue
    \subbody@cont}

  \newcommand{\subbody@cont}{%
    \bgroup
    \@contset
    \refstepcounter{sub\@captype}\@contkeep%
    \leavevmode
    \@ifnextchar [%
      {\@subfloat{sub\@captype}}
      {\@subfloat{sub\@captype}[\@empty]}}

  \newcommand{\subtop}{%
    \@contbotsubfalse
    \@contsubbody}

  \newcommand{\contsubtop}{%
    \@contbotsubfalse
    \subbody@cont}

  \long\def\@contcaption#1#2{%
    \subfigold@contcaption{#1}{#2}%
    \@for \@conttempa:=\@subfigcaptionlist \do {%
      \ifx\@empty\@conttempa\relax \else
        \addcontentsline
          {\@nameuse{ext@sub#1}}%
          {sub#1}%
          {\@conttempa}%
       \fi}%
    \gdef\@subfigcaptionlist{}}

  \let\contsubtable\contsubtop
  \let\contsubfigure\contsubbottom

\fi

\if@contsubfigxxi
  \let\@contoldc\caption
  \renewcommand{\caption}{\@contmaincaptiontrue\@contoldc}
  \let\@contoldcont\contcaption
  \renewcommand{\contcaption}{\@contmaincaptiontrue\@contoldcont}
  \let\@contoldf\@float
  \renewcommand{\@float}[1]{\@contmaincaptionfalse
                \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}
                \@contoldf{#1}}
  \let\@contoldff\@dbflt
  \renewcommand{\@dbflt}[1]{\@contmaincaptionfalse
                \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}
                \@contoldff{#1}}
\fi

\newcommand{\@contsubfloat}{%
  \bgroup
  \let\subfig@oldlabel=\label
  \let\label=\sub@label
  \refstepcounter{sub\@captype}\@contkeep%   % <- change here
  \@ifnextchar [%
    {\@@cont@subfloat}%
    {\@@cont@subfloat[\@empty]}}

\def\@@contsubfloat[#1]{%
  \@ifnextchar [%
    {\@@@contsubfloat{sub\@captype}[#1]}%
    {\@@@contsubfloat{sub\@captype}[\@empty #1][#1]}}

\long\def\@@@contsubfloat#1[#2][#3]#4{%
  \@tempcnta=\@ne
  \ifsf@tight
    \if@minipage
      \@tempcnta=\z@
    \else
      \ifdim\lastskip=\z@
        \@tempcnta=\@ne
      \else
        \@tempcnta=\tw@
      \fi
    \fi
  \fi
  \if@contbotsub
    \def\subfig@top{\subfigtopskip}%
    \def\subfig@bottom{\subfigbottomskip}%
  \else
    \def\subfig@top{\subfigbottomskip}%
    \def\subfig@bottom{\subfigtopskip}%
  \fi
  \setbox\@tempboxa \hbox{#4}%
  \@tempdima=\wd\@tempboxa
  \vtop\bgroup
    \vbox\bgroup
    \ifcase\@tempcnta
      \@minipagefalse
    \or
      \vspace{\subfig@top}
    \or
      \ifdim \lastskip=\z@ \else
        \@tempskipb\subfig@top\relax\@xaddvskip
      \fi
    \fi
    \if@contbotsub
      \box\@tempboxa\egroup
      \ifx \@empty#3\relax \else
        \vskip\subfigcapskip
        \@subcaption{#1}{#2}{#3}%
      \fi
    \else
      \ifx\@empty#3\relax \else
        \@subcaption{#1}{#2}{#3}%
        \vskip\subfigcapskip
        \vskip\subfigcaptopadj
      \fi\egroup
      \box\@tempboxa
    \fi
    \vspace{\subfig@bottom}
  \egroup
\egroup}

\let\cont@subfig@oldcaption\@caption

\newcommand{\doxxi@contcaption}{%
  \long\def\@contcaption##1##2{%
    \if@contbotsub
      \@listsubcaptions{##1}%
      \subfigold@contcaption{##1}{##2}
    \else
      \subfigold@contcaption{##1}{##2}
      \@listsubcaptions{##1}%
    \fi}
}

%%%\if@contsubfigxxi

  \newcommand{\subbottom}{%
    \@contbotsubtrue
    \@contsubbody}

  \newcommand{\@contsubbody}{%
    \bgroup
    \let\subfig@oldlabel=\label
    \let\label=\sub@label
    \if@contmaincaption\else
      \advance\csname c@\@captype\endcsname\@ne
    \fi
    \refstepcounter{sub\@captype}\@contkeep%
    \leavevmode
    \@ifnextchar [%
      {\@@contsubfloat}%
      {\@@contsubfloat[\@empty]}}

  \newcommand{\contsubbottom}{%
    \@contbotsubtrue
    \subbody@cont}

  \newcommand{\subbody@cont}{%
    \bgroup
    \let\subfig@oldlabel=\label
    \let\label=\sub@label
    \@contset
    \refstepcounter{sub\@captype}\@contkeep%
    \leavevmode
    \@ifnextchar [%
      {\@@contsubfloat}%
      {\@@contsubfloat[\@empty]}}

  \newcommand{\subtop}{%
    \@contbotsubfalse
    \@contsubbody}

  \newcommand{\contsubtop}{%
    \@contbotsubfalse
    \subbody@cont}


  \newcommand{\contsubfigure}{%
    \bgroup
    \let\subfig@oldlabel=\label
    \let\label=\sub@label
    \@contset
    \refstepcounter{sub\@captype}\@contkeep%
    \@ifnextchar [%
      {\@@contsubfloat}%
      {\@@contsubfloat[\@empty]}}

\newcommand{\@contsf}{\@contbotsubtrue%
  \ifsubfiguretopcap\@contbotsubfalse\fi%
  \@contsubbody}
\newcommand{\@contst}{\@contbotsubtrue%
  \ifsubtabletopcap\@contbotsubfalse\fi%
  \@contsubbody}

\if@contsubfigxxi

  \doxxi@contcaption

  \AtBeginDocument{%
    \let\@subfloat\@@@contsubfloat
    \let\@subfigure\@@contsubfloat
    \let\subfigure\@contsf
    \let\subtable\@contst
    \let\contsubfigure\contsubbottom
    \let\contsubtable\contsubtop
    \long\def\@caption#1[#2]#3{%
      \cont@subfig@oldcaption{#1}[{#2}]{#3}}
}

\fi

\newcounter{newflo@tctr}
\@ifundefined{c@figure}{\setcounter{newflo@tctr}{1}}{
  \@ifundefined{c@table}{\setcounter{newflo@tctr}{2}}{
    \setcounter{newflo@tctr}{4}}}

\providecommand{\cftdot}{.}
\providecommand{\cftdotsep}{4.5}
\providecommand{\cftdotfill}[1]{%
  \leaders\hbox{$\m@th\mkern #1 mu \hbox{\cftdot}\mkern #1 mu$}\hfill}
\providecommand{\@cfttocstart}{%
  \@ifundefined{chapter}{}{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi}}
\providecommand{\@cfttocfinish}{%
  \@ifundefined{chapter}{}{\if@restonecol\twocolumn\fi}}

\newcommand{\newfloatentry}[4][\@empty]{%
  \@ifundefined{c@#2}{%
    \ifx \@empty#1\relax
      \newcounter{#2}
    \else
      \@ifundefined{c@#1}{\PackageWarning{ccaption}%
                          {#1 has no counter for use as a `within'}
        \newcounter{#2}}%
      {\newcounter{#2}[#1]%
       \expandafter\edef\csname the#2\endcsname{%
         \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}}
    \fi
    \setcounter{#2}{0}
  }
  {\PackageError{ccaption}{#2 has been previously defined}{\@eha}}

  \@namedef{l@#2}##1##2{%
    \ifnum \@nameuse{c@#3depth} > #4\relax
    \vskip \@nameuse{cftbefore#2skip}
    {\leftskip \@nameuse{cft#2indent}\relax
     \rightskip \@tocrmarg
     \parfillskip -\rightskip
     \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima \@nameuse{cft#2numwidth}\relax
     \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname
     \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname
     \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname
     \advance\leftskip\@tempdima \null\nobreak\hskip -\leftskip
     {\@nameuse{cft#2font}##1}\nobreak
     \@nameuse{cft#2fillnum}{##2}}
  \fi
    }  % end of \l@#2

  \expandafter\newlength\csname cftbefore#2skip\endcsname
    \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@}
  \expandafter\newlength\csname cft#2indent\endcsname
  \expandafter\newlength\csname cft#2numwidth\endcsname
  \ifcase #4\relax  % 0
    \setlength{\@nameuse{cft#2indent}}{1.5em}
    \setlength{\@nameuse{cft#2numwidth}}{2.3em}
  \or               % 1
    \setlength{\@nameuse{cft#2indent}}{3.8em}
    \setlength{\@nameuse{cft#2numwidth}}{3.2em}
  \or               % 2
    \setlength{\@nameuse{cft#2indent}}{7.0em}
    \setlength{\@nameuse{cft#2numwidth}}{4.1em}
  \or               % 3
    \setlength{\@nameuse{cft#2indent}}{10.0em}
    \setlength{\@nameuse{cft#2numwidth}}{5.0em}
  \else             % anything else
    \setlength{\@nameuse{cft#2indent}}{1.5em}
    \setlength{\@nameuse{cft#2numwidth}}{2.3em}
  \fi
  \@namedef{cft#2font}{\normalfont}
  \@namedef{cft#2presnum}{}
  \@namedef{cft#2aftersnum}{}
  \@namedef{cft#2aftersnumb}{}
  \@namedef{cft#2dotsep}{\cftdotsep}
  \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}}
  \@namedef{cft#2pagefont}{\normalfont}
  \@namedef{cft#2afterpnum}{}
  \@namedef{cft#2fillnum}##1{%
    {\@nameuse{cft#2leader}}\nobreak
    \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#2pagefont}##1}%
    \@nameuse{cft#2afterpnum}\par}
  \@namedef{toclevel@#2}{#4}
} % end \newfloatentry

\newcommand{\newfloatlist}[5][\@empty]{%
  \ifx \@empty#1\relax
    \newfloatentry{#2}{#3}{0}
  \else
    \newfloatentry[#1]{#2}{#3}{0}
  \fi
  \@namedef{ftype@#2}{\value{newflo@tctr}}
  \addtocounter{newflo@tctr}{\value{newflo@tctr}}
  \@namedef{ext@#2}{#3}  % file extension
  \newcounter{#3depth}
  \setcounter{#3depth}{1}

  \@namedef{cftmark#3}{%
    \@mkboth{\MakeUppercase{#4}}{\MakeUppercase{#4}}}

 \if@conttitleopt
  \@namedef{listof#2}{%
    \@cfttocstart
    \@ifundefined{chapter}{\section*{#4}}{\chapter*{#4}}
    \@nameuse{cftmark#3}
    \@starttoc{#3}%
    \@cfttocfinish}
 \else
  \@namedef{listof#2}{%
    \@cfttocstart
    \par
    \begingroup
      \parindent\z@ \parskip\z@
      \@nameuse{@cftmake#3title}
      \@starttoc{#3}%
    \endgroup
    \@cfttocfinish}
 \fi

  \@namedef{@cftmake#3title}{%
    \@ifundefined{chapter}{%
      \vspace{\@nameuse{cftbefore#3titleskip}}}{%
      \vspace*{\@nameuse{cftbefore#3titleskip}}}
    \interlinepenalty\@M
    {\@nameuse{cft#3titlefont}#4}{\@nameuse{cftafter#3title}}
    \@nameuse{cftmark#3}
    \par\nobreak
    \vskip \@nameuse{cftafter#3titleskip}
    \@afterheading}

   \expandafter\newlength\csname cftbefore#3titleskip\endcsname
   \expandafter\newlength\csname cftafter#3titleskip\endcsname
   \@ifundefined{chapter}{%
      \setlength{\@nameuse{cftbefore#3titleskip}}{3.5ex \@plus 1ex \@minus .2ex}
      \setlength{\@nameuse{cftafter#3titleskip}}{2.3ex \@plus .2ex}
      \@namedef{cft#3titlefont}{\normalfont\Large\bfseries}
    }{%
      \setlength{\@nameuse{cftbefore#3titleskip}}{50pt}
      \setlength{\@nameuse{cftafter#3titleskip}}{40pt}
      \@namedef{cft#3titlefont}{\normalfont\Huge\bfseries}
    }
    \@namedef{cftafter#3title}{}

  \@namedef{fps@#2}{tbp}                     % position
  \@namedef{fnum@#2}{#5~\@nameuse{the#2}}    % caption naming
  \@namedef{flegtoc@#2}##1{}                 % named legend

  \newenvironment{#2}{\@float{#2}}{\end@float}
  \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}
} % end \newlistof

\newcommand{\newfloatenv}[4][\@empty]{%
  \PackageError{ccaption}{\protect\newfloatenv\space has been replaced
                          by\MessageBreak
                         \protect\newfloatlist}{\@eha}
}

\newcommand{\listfloats}[2]{%
  \PackageError{ccaption}{\protect\listfloats{#1}{...} has been
                          replaced by\MessageBreak
                          \protect\listof #1}{\@eha}
}

\newcommand{\newsubfloat}[1]{%
  \newfloatentry[#1]{sub#1}{\@nameuse{ext@#1}}{1}
  \@namedef{ext@sub#1}{\csname ext@#1\endcsname}
  \@namedef{thesub#1}{(\alph{sub#1})}
  \@namedef{@thesub#1}{{\subcaplabelfont\@nameuse{thesub#1}}\space}
  \@namedef{@@thesub#1}{\@nameuse{thesub#1}}
  \@namedef{p@sub#1}{\csname the#1\endcsname}
  \@namedef{@makesub#1caption}{\@makesubfigurecaption}
}

\DeclareRobustCommand{\newfloatpagesoff}[1]{
  \@namedef{cft#1fillnum}##1{%
    \parfillskip=\z@ plus1fil\@nameuse{cft#1afterpnum}\par}}

\DeclareRobustCommand{\newfloatpageson}[1]{
  \@namedef{cft#1fillnum}##1{%
    {\@nameuse{cft#1leader}}\nobreak
    \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#1pagefont}##1}%
    \@nameuse{cft#1afterpnum}\par}}

\newcommand{\setnewfloatindents}[3]{%
  \setlength{\@nameuse{cft#1indent}}{#2}
  \setlength{\@nameuse{cft#1numwidth}}{#3}
}

\endinput
%%
%% End of file `ccaption.sty'.
