%%
%% This is file `caption3.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% caption3.dtx  (with options: `package')
%% 
%% Copyright (C) 1994-2020 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
%%   caption.ins, caption.dtx, caption2.dtx, caption3.dtx,
%%   bicaption.dtx, ltcaption.dtx, subcaption.dtx, totalcount.dtx,
%% the derived files
%%   caption.sty, caption2.sty, caption3.sty,
%%   bicaption.sty, ltcaption.sty, subcaption.sty, totalcount.sty,
%% and the user manuals
%%   caption-deu.tex, caption-eng.tex, caption-rus.tex.
%% 
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{caption3}[2020/05/10 v1.11 caption3 kernel (AR)]
\providecommand\caption@FixArabTeX{%
  \def\caption@tempa##1{}%
  \ifx\caption@tempa\@gobble
    \PackageInfo{caption3}{Fixing ArabTeX}%
    \long\def\@gobble##1{}%
  \fi}
\caption@FixArabTeX
\AtBeginDocument{%
  \caption@FixArabTeX
  \let\caption@FixArabTeX\@undefined}
\providecommand*\@nameundef[1]{%
  \expandafter\let\csname #1\endcsname\@undefined}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname currentgrouplevel\endcsname\relax
  \PackageInfo{caption3}{TeX engine: TeX}
  \let\caption@ifeTeX\@secondoftwo
  \providecommand\l@addto@macro[2]{%
    \begingroup
      \toks@\expandafter{#1#2}%
      \xdef\caption@addto@temp{\the\toks@}%
    \endgroup
    \let#1\caption@addto@temp}
\else
  \PackageInfo{caption3}{TeX engine: e-TeX}
  \let\caption@ifeTeX\@firstoftwo
  \providecommand\l@addto@macro[2]{%
    \edef#1{\unexpanded\expandafter{#1#2}}}
\fi
\def\bothIfFirst#1#2{%
  \protected@edef\caption@tempa{#1}%
  \ifx\caption@tempa\@empty \else
    #1#2%
  \fi}
\def\bothIfSecond#1#2{%
  \protected@edef\caption@tempa{#2}%
  \ifx\caption@tempa\@empty \else
    #1#2%
  \fi}
\newcommand*\caption@ifundefined[1]{%
  \ifx#1\@undefined
    \expandafter\@firstoftwo
  \else\ifx#1\relax
    \expandafter\expandafter\expandafter\@firstoftwo
  \else
    \expandafter\expandafter\expandafter\@secondoftwo
  \fi\fi}
\newcommand*\caption@ifdefined[1]{%
  \ifx#1\@undefined
    \expandafter\@secondoftwo
  \else\ifx#1\relax
    \expandafter\expandafter\expandafter\@secondoftwo
  \else
    \expandafter\expandafter\expandafter\@firstoftwo
  \fi\fi}
\newcommand*\caption@ifinlist{%
  \@expandtwoargs\caption@@ifinlist}
\newcommand*\caption@@ifinlist[2]{%
  \begingroup
  \def\@tempa##1,#1,##2\@nil{%
    \endgroup
    \ifx\relax##2\relax
      \expandafter\@secondoftwo
    \else
      \expandafter\@firstoftwo
    \fi}%
  \@tempa,#2,#1,\@nil}%
\newcommand*\caption@ifin@list[2]{%
  \caption@ifempty@list#1%
    {\@secondoftwo}%
    {\@expandtwoargs\caption@@ifinlist{#2}{#1}}}
\newcommand*\caption@g@addto@list[2]{%
  \caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}}
\newcommand*\caption@l@addto@list[2]{%
  \caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}}
\newcommand*\caption@g@removefrom@list[2]{%
  \caption@l@removefrom@list#1{#2}%
  \global\let#1#1}
\newcommand*\caption@l@removefrom@list[2]{%
  \caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}}
\newcommand*\caption@for@list[2]{%
  \caption@ifempty@list#1{}{%
    \def\caption@tempb##1{#2}%
    \@for\caption@tempa:=#1\do{%
      \expandafter\caption@tempb\expandafter{\caption@tempa}}}}
\newcommand*\caption@ifempty@list[1]{%
  \ifx#1\@undefined
    \expandafter\@firstoftwo
  \else\ifx#1\relax
    \expandafter\expandafter\expandafter\@firstoftwo
  \else\ifx#1\@empty
    \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\@firstoftwo
  \else
    \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\@secondoftwo
  \fi\fi\fi}
\newcommand*\caption@setbool[1]{%
  \expandafter\caption@set@bool\csname caption@if#1\endcsname}
\newcommand*\caption@set@bool[2]{%
  \caption@ifinlist{#2}{1,true,yes,on}{%
    \let#1\@firstoftwo
  }{\caption@ifinlist{#2}{0,false,no,off}{%
    \let#1\@secondoftwo
  }{%
    \caption@Error{Undefined boolean value `#2'}%
  }}}
\newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}}
\newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}}
\newcommand*\caption@teststar[3]{\@ifstar{#1{#2}}{#1{#3}}}
\newcommand*\caption@teststar@[3]{%
  \@ifstar{#1{#2}}{\caption@ifatletter{#1{#2}}{#1{#3}}}}
\AtBeginDocument{\let\caption@teststar@\caption@teststar}
\newcommand*\caption@ifatletter{%
  \ifnum\the\catcode`\@=11
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}
\AtBeginDocument{\let\caption@ifatletter\@secondoftwo}
\newcommand*\caption@withoptargs[1]{%
  \@ifstar
    {\def\caption@tempa{*}\caption@@withoptargs{#1}}%
    {\def\caption@tempa{}\caption@@withoptargs{#1}}}
\def\caption@@withoptargs#1{%
  \@ifnextchar[%]
    {\caption@@@withoptargs{#1}}%
    {\caption@@@@withoptargs{#1}}}
\def\caption@@@withoptargs#1[#2]{%
  \l@addto@macro\caption@tempa{[{#2}]}%
  \caption@@withoptargs{#1}}
\def\caption@@@@withoptargs#1{%
  \def\caption@tempb{#1}%
  \expandafter\caption@tempb\expandafter{\caption@tempa}}
\DeclareRobustCommand*\caption@gobble{%
  \caption@withoptargs\@gobbletwo}
\let\caption@begindocumenthook\@empty
\let\caption@@begindocumenthook\@empty
\def\caption@AtBeginDocument{%
  \caption@teststar\g@addto@macro
    \caption@@begindocumenthook\caption@begindocumenthook}
\AtBeginDocument{%
   \caption@InfoNoLine{Begin \noexpand\AtBeginDocument code}%
   \def\caption@AtBeginDocument{%
     \@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}%
   \caption@begindocumenthook
   \let\caption@begindocumenthook\relax
   \def\caption@AtBeginDocument{%
     \@ifstar\@firstofone\@firstofone}%
   \caption@@begindocumenthook
   \let\caption@@begindocumenthook\relax
   \caption@InfoNoLine{End \noexpand\AtBeginDocument code}}
\newcommand*\caption@Info[1]{%
  \PackageInfo{caption}{#1}}
\newcommand*\caption@InfoNoLine[1]{%
  \caption@Info{#1\@gobble}}
\newcommand*\caption@Warning[1]{%
  \caption@WarningNoLine{#1\on@line}}
\newcommand*\caption@WarningNoLine[1]{%
  \PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}}
\newcommand*\caption@wh{%
  See the caption package documentation for explanation.}
\newcommand*\caption@Error[1]{%
  \PackageError{caption}{#1}\caption@eh}
\newcommand*\caption@eh{%
  If you do not understand this error, please take a closer look\MessageBreak
  at the documentation of the `caption' package, especially the\MessageBreak
  section about errors.\MessageBreak\@ehc}
\let\caption@KV@err\caption@Error
\RequirePackage{keyval}[1997/11/10]
\providecommand*\undefine@key[2]{%
  \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
\providecommand*\@preamble@keys{}
\providecommand*\@onlypreamble@key[2]{\@cons\@preamble@keys{{#1}{#2}}}
\@onlypreamble\@onlypreamble@key
\@onlypreamble\@preamble@keys
\providecommand*\@notprerr@key[1]{\KV@err{Can be used only in preamble}}
\caption@AtBeginDocument*{%
  \def\@elt#1#2{\expandafter\let\csname KV@#1@#2\endcsname\@notprerr@key}%
  \@preamble@keys
  \let\@elt\relax}
\newcommand*\DeclareCaptionOption{%
  \caption@teststar\caption@declareoption\AtEndOfPackage\@gobble}
\@onlypreamble\DeclareCaptionOption
\newcommand*\caption@declareoption[2]{%
  #1{\undefine@key{caption}{#2}}\caption@declare@option{#2}}
\@onlypreamble\caption@declareoption
\newcommand*\caption@declare@option{%
  \define@key{caption}}
%% no \@onlypreamble\caption@declare@option, will be used by \captionsetup
\newcommand*\DeclareCaptionOptionNoValue{%
  \caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble}
\@onlypreamble\DeclareCaptionOptionNoValue
\newcommand\caption@declareoption@novalue[3]{%
  \caption@declareoption{#1}{#2}[\KV@err]{%
    \caption@option@novalue{#2}{##1}{#3}}}
\@onlypreamble\caption@declareoption@novalue
\newcommand*\caption@option@novalue[2]{%
  \ifx\KV@err#2%
    \expandafter\@firstofone
  \else
    \KV@err{No value allowed for #1}%
    \expandafter\@gobble
  \fi}
\newif\ifcaptionsetup@star
\newcommand*\captionsetup{%
  \caption@teststar@\@captionsetup\@gobble\@firstofone}
\newcommand*\@captionsetup[1]{%
  \captionsetup@startrue#1\captionsetup@starfalse
  \@ifnextchar[\caption@setup@options\caption@setup}
\newcommand*\caption@setup{\caption@setkeys{caption}}
\def\caption@setup@options[#1]{%
  \@ifnextchar[%
    {\caption@stepthecounter
     \caption@withoptargs{\@expandtwoargs
       \caption@setup@options@i{#1}{@\caption@thecounter}}}%
    {\caption@setup@options@{#1}}}
\newcommand*\caption@setup@options@i[4]{%
  \caption@declare@option{#2}[]{\captionsetup#3{#4}}%
  \caption@setup@options@{#1}{#2}}
\newcommand*\caption@setup@options@[2]{%
  \@bsphack
    \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi
    \caption@checkoptions{#2}%
    \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}%
  \@esphack}
\newcommand*\caption@checkoptions[1]{%
  \begingroup
    \caption@prepare@optioncheck
    \caption@setup{#1}%
  \endgroup}
\providecommand*\caption@prepare@optioncheck{}
\let\IfCaptionOptionCheck\@secondoftwo
\g@addto@macro\caption@prepare@optioncheck{%
  \let\IfCaptionOptionCheck\@firstoftwo}
\newcommand*\clearcaptionsetup{%
  \caption@teststar@\@clearcaptionsetup\@gobble\@firstofone}
\newcommand*\@clearcaptionsetup[1]{%
  \let\caption@tempa#1%
  \@testopt\@@clearcaptionsetup{}}
\def\@@clearcaptionsetup[#1]#2{%
  \@bsphack
    \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
      {\caption@tempa{\caption@Warning{Option list `#2' undefined}}}%
      {\ifx,#1,%
         \caption@clearsetup{#2}%
       \else
         \caption@@removefromsetup{#1}{#2}%
       \fi}%
  \@esphack}
\newcommand*\caption@clearsetup[1]{%
  \caption@removefromoptlist{#1}%
  \@nameundef{caption@opt@#1}}
\newcommand*\caption@removefromsetup{%
  \let\caption@tempa\@gobble
  \caption@@removefromsetup}
\newcommand*\caption@@removefromsetup[2]{%
  \expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname
  \expandafter\let\csname caption@opt@#2\endcsname\@undefined
  \def\@tempb##1=##2\@nil{##1}%
  \edef\@tempc{#1}%
  \@for\@tempa:=\@tempa\do{%
    \edef\@tempd{\expandafter\@tempb\@tempa=\@nil}%
    \ifx\@tempd\@tempc
      \let\caption@tempa\@gobble
    \else
      \expandafter\expandafter\expandafter\caption@l@addto@list
        \expandafter\csname caption@opt@#2\expandafter\endcsname
        \expandafter{\@tempa}%
    \fi}%
  \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
    {\caption@removefromoptlist{#2}}{}%
  \caption@tempa{\caption@Warning{%
    Option `#1' was not in list `#2'}}}
\newcommand*\showcaptionsetup[2][\@firstofone]{%
  \@bsphack
    \GenericWarning{}{%
      #1 Caption Info: Option list on `#2'\MessageBreak
      #1 Caption Data: \@ifundefined{caption@opt@#2}{%
        -none-%
      }{%
        {\expandafter\expandafter\expandafter\strip@prefix
           \expandafter\meaning\csname caption@opt@#2\endcsname}%
      }}%
  \@esphack}
\DeclareCaptionOption{options}{\caption@setoptions{#1}}
\newcommand*\caption@setoptions[1]{%
  \caption@Debug{options=#1}%
  \expandafter\let\expandafter\caption@opt\csname caption@opt@#1\endcsname
  \ifx\caption@opt\relax \else
    \caption@xsetup\caption@opt
    \caption@clearsetup{#1}%
  \fi}
\newcommand*\caption@xsetup[1]{\expandafter\caption@setup\expandafter{#1}}
\newcommand*\caption@addtooptlist[1]{%
  \@ifundefined{caption@opt@#1@lineno}{%
    \caption@dooptlist\caption@g@addto@list{#1}%
    \expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}%
  }{}}
\newcommand*\caption@removefromoptlist[1]{%
  \caption@dooptlist\caption@g@removefrom@list{#1}%
  \global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined}
\newcommand*\caption@dooptlist[2]{%
  \begingroup
    \edef\@tempa{#2}\@onelevel@sanitize\@tempa
    \expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}%
  \endgroup}
\AtEndDocument{%
  \caption@for@list\caption@optlist{%
    \caption@WarningNoLine{%
      Unused \string\captionsetup[#1]
      on input line \csname caption@opt@#1@lineno\endcsname}}}
\newcommand*\caption@setkeys{\@dblarg\caption@@setkeys}
\long\def\caption@@setkeys[#1]#2#3{%
  \@bsphack
  \expandafter\let\csname ORI@KV@err\caption@keydepth\endcsname\KV@err
  \expandafter\let\csname ORI@KV@errx\caption@keydepth\endcsname\KV@errx
  \expandafter\let\csname ORI@XKV@err\caption@keydepth\endcsname\XKV@err
  \edef\caption@keydepth{\caption@keydepth i}%
  \expandafter\let\expandafter\KV@err\csname #1@KV@err\endcsname
  \ifx\KV@err\relax
    \def\KV@err##1{\PackageError{#1}{##1}{%
      See the #1 package documentation for explanation.}}%
  \fi
  \def\KV@errx{\KV@err}%
  \def\XKV@err{\let\@tempa\XKV@tkey\KV@err}%
  \caption@Debug{\protect\setkeys{#2}{#3}}%
  \setkeys{#2}{#3}%
  \edef\caption@keydepth{\expandafter\@gobble\caption@keydepth}%
  \expandafter\let\expandafter\KV@err\csname ORI@KV@err\caption@keydepth\endcsname
  \expandafter\let\expandafter\KV@errx\csname ORI@KV@errx\caption@keydepth\endcsname
  \expandafter\let\expandafter\XKV@err\csname ORI@XKV@err\caption@keydepth\endcsname
  \ifx\caption@keydepth\@empty \captionsetup@starfalse \fi
  \@esphack}
\let\caption@keydepth\@empty
\newcommand*\caption@ExecuteOptions[2]{%
  \expandafter\@expandtwoargs\csname caption@setkeys@#1\endcsname{#1}{#2}}%
\@onlypreamble\caption@ExecuteOptions
\newcommand*\caption@ProcessOptions{%
  \caption@teststar\caption@@ProcessOptions\@gobble\@firstofone}
\@onlypreamble\caption@ProcessOptions
\newcommand\caption@@ProcessOptions[2]{%
  \let\@tempc\relax
  \let\caption@tempa\@empty
  #1{% \@firstofone -or- \@gobble
    \@for\CurrentOption:=\@classoptionslist\do{%
      \@ifundefined{KV@#2@\CurrentOption}{}{%
        \@ifundefined{KV@#2@\CurrentOption @default}{%
          \PackageInfo{#2}{Global option `\CurrentOption' ignored}%
        }{%
          \PackageInfo{#2}{Global option `\CurrentOption' processed}%
          \edef\caption@tempa{\caption@tempa\CurrentOption,}%
          \@expandtwoargs\@removeelement\CurrentOption
            \@unusedoptionlist\@unusedoptionlist
        }%
      }%
    }%
    \let\CurrentOption\@empty
  }%
  \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}%
  \AtEndOfPackage{\let\@unprocessedoptions\relax}}
\@onlypreamble\caption@@ProcessOptions
\newcommand\caption@SetupOptions[2]{%
  \@namedef{caption@setkeys@#1}##1##2{#2}%
  \expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname
  \@cons\caption@SetupOptions@list{{#1}}}
\@onlypreamble\caption@SetupOptions
\newcommand*\caption@SetupOptions@list{}
\@onlypreamble\caption@SetupOptions@list
\let\caption@onefilewithoptions\@onefilewithoptions
\def\@onefilewithoptions#1[#2]{%
  \begingroup
  \def\@tempa{%
    \endgroup
    \caption@onefilewithoptions{#1}[{#2}]}%
  \def\@tempb{#1}%
  \def\@elt##1{%
    \def\@tempc{##1}%
    \ifx\@tempb\@tempc
      \def\@tempa{%
        \endgroup
        \caption@ExecuteOptions{#1}{#2}%
        \caption@onefilewithoptions{#1}[]}%
    \fi}
  \caption@SetupOptions@list
  \@tempa}
\@onlypreamble\caption@onefilewithoptions
\newdimen\captionmargin
\newdimen\captionmargin@
\newdimen\captionwidth
\newdimen\caption@tempdima
\DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}}
\DeclareCaptionOption{width}{\setcaptionwidth{#1}}
\DeclareCaptionOption{width*}{\setcaptionwidth*{#1}}
\DeclareCaptionOption{calcmargin}{\caption@setcalcmargin{#1}}
\DeclareCaptionOption{calcmargin*}{\caption@setcalcmargin*{#1}}
\DeclareCaptionOption{calcwidth}{\caption@setcalcwidth{#1}}
\DeclareCaptionOption{calcwidth*}{\caption@setcalcwidth*{#1}}
\DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}}
\DeclareCaptionOptionNoValue{oneside}{\caption@set@bool\caption@iftwoside0}
\DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}}
\DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}}
\newcommand*\setcaptionmargin{%
  \caption@resetcalcmargin
  \caption@setmargin}
\newcommand*\caption@setmargin{%
  \caption@teststar\caption@@setmargin\@gobble\@firstofone}
\newcommand*\caption@@setmargin[2]{%
  #1{\captionwidth\z@}%
  \caption@@@setmargin#2,#2,\@nil}
\def\caption@@@setmargin#1,#2,#3\@nil{%
  \setlength\captionmargin@{#2}%
  \setlength\captionmargin{#1}%
  \addtolength\captionmargin@{-\captionmargin}}
\newcommand*\setcaptionwidth{%
  \caption@resetcalcmargin
  \caption@setwidth}
\newcommand*\caption@setwidth{%
  \caption@teststar\caption@@setwidth\@gobble\@firstofone}
\newcommand*\caption@@setwidth[2]{%
  #1{\captionmargin\z@\captionmargin@\z@}%
  \setlength\captionwidth{#2}}%
\newcommand*\caption@resetcalcmargin{%
  \let\caption@calcmargin@hook\@empty}
\newcommand*\caption@setcalcmargin{%
  \caption@teststar{\caption@@setcalcmargin\caption@setmargin}%
    \@secondoftwo\@firstoftwo}
\newcommand*\caption@@setcalcmargin[3]{%
  #2{\caption@resetcalcmargin
     \l@addto@macro\caption@calcmargin@hook{#1{#3}}}%
    {\l@addto@macro\caption@calcmargin@hook{#1*{#3}}}}
\newcommand*\caption@setcalcwidth{%
  \caption@teststar{\caption@@setcalcmargin\caption@setwidth}%
    \@secondoftwo\@firstoftwo}
\newcommand*\caption@thecounter{0}
\newcommand*\caption@stepthecounter{%
  \@tempcnta\caption@thecounter
  \advance\@tempcnta\@ne
  \xdef\caption@thecounter{\the\@tempcnta}}
\newcommand*\caption@newlabel{\@newl@bel{caption@r}}
\newcommand*\caption@thepage{\the\c@page}
\newcommand*\caption@label[1]{%
  \caption@@label
  \protected@write\@auxout{\let\caption@thepage\relax}%
         {\string\caption@newlabel{#1}{\caption@thepage}}}
\newcommand*\caption@@label{%
  \global\let\caption@@label\relax
  \protected@write\@auxout{}%
    {\string\providecommand*\string\caption@newlabel[2]{}}}
\newcommand*\caption@pageref[1]{%
  \expandafter\ifx\csname caption@r@#1\endcsname\relax
    \G@refundefinedtrue % => 'There are undefined references.'
    \@latex@warning{Reference `#1' on page \thepage \space undefined}%
  \else
    \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname
  \fi}
\newcommand*\caption@ifoddpage{%
  \caption@iftwoside{%
    \caption@label\caption@thecounter
    \caption@pageref\caption@thecounter
    \ifodd\caption@thepage
      \let\caption@ifoddpage\@firstoftwo
    \else
      \let\caption@ifoddpage\@secondoftwo
    \fi
  }{\let\caption@ifoddpage\@firstoftwo}%
  \caption@ifoddpage}
\newcommand*\caption@setoptcmd[2]{%
  \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}}
\newdimen\caption@indent
\newdimen\caption@parindent
\newdimen\caption@hangindent
\DeclareCaptionOption{indent}[\leftmargini]{% obsolete!
       \setlength\caption@indent{#1}}
\DeclareCaptionOption{indention}[\leftmargini]{%
       \setlength\caption@indent{#1}}
\DeclareCaptionOption{parindent}{%
       \setlength\caption@parindent{#1}}
\DeclareCaptionOption{hangindent}{%
       \setlength\caption@hangindent{#1}}
\DeclareCaptionOption{parskip}{%
       \l@addto@macro\caption@@par{\setlength\parskip{#1}}}
\newcommand*\DeclareCaptionStyle[1]{%
  \@testopt{\caption@declarestyle{#1}}{}}
\@onlypreamble\DeclareCaptionStyle
\def\caption@declarestyle#1[#2]#3{%
  \global\@namedef{caption@sls@#1}{#2}%
  \global\@namedef{caption@sty@#1}{#3}}
\@onlypreamble\caption@declarestyle
\DeclareCaptionOption{style}{\caption@setstyle{#1}}
\DeclareCaptionOption{style*}{\caption@setstyle*{#1}}
\newcommand*\caption@setstyle{%
  \caption@teststar\caption@@setstyle\@gobble\@firstofone}
\newcommand*\caption@@setstyle[2]{%
  \@ifundefined{caption@sty@#2}%
    {#1{\caption@Error{Undefined style `#2'}}}%
    {\expandafter\let\expandafter\caption@sty\csname caption@sty@#2\endcsname
     \ifx\caption@setstyle@flag\@undefined
       \let\caption@setstyle@flag\relax
       \caption@resetstyle
       \caption@xsetup\caption@sty
       \let\caption@setstyle@flag\@undefined
     \else
       \caption@xsetup\caption@sty
     \fi
     \expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
     \expandafter\caption@l@addto@list\expandafter\caption@opt@singleline
       \expandafter{\caption@sls}}}
\newcommand*\caption@resetstyle{%
  \caption@setup{%
    box=none,boxcolor=white,parbox=parbox,%
    format=plain,labelformat=default,labelsep=colon,textformat=simple,%
    justification=justified,font=,size=,labelfont=,textfont=,%
    margin=0pt,minmargin=0,maxmargin=0,%
    indent=0pt,parindent=0pt,hangindent=0pt,%
    slc,rule,strut}%
  \caption@clearsetup{singleline}}
\DeclareCaptionStyle{base}[indent=0pt,justification=centering]{}
\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{%
  box=default,format=default,labelsep=default,textformat=default,%
  justification=default,font=default,labelfont=default,textfont=default}
\DeclareCaptionOption{singlelinecheck}[1]{\caption@set@bool\caption@ifslc{#1}}
\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}}
\newcommand*\DeclareCaptionBox[2]{%
  \global\long\@namedef{caption@box@#1}##1##2{#2}}
\@onlypreamble\DeclareCaptionBox
\DeclareCaptionOption{box}{\caption@setbox{#1}}
\DeclareCaptionOption{parbox}{\caption@set@box\caption@parbox{#1}}
\newcommand*\caption@setbox{%
  \caption@set@box\caption@box}
\newcommand*\caption@set@box[2]{%
  \@ifundefined{caption@box@#2}%
    {\caption@Error{Undefined box `#2'}}%
    {\expandafter\let\expandafter#1\csname caption@box@#2\endcsname}}
\DeclareCaptionBox{empty}{}
\DeclareCaptionBox{none}{#2}
\DeclareCaptionBox{parbox}{\parbox[b]{#1}{#2}}
\DeclareCaptionBox{colorbox}{\colorbox{\caption@boxcolor}{%
  \setlength\caption@tempdima{#1}%
  \addtolength\caption@tempdima{-2\fboxsep}%
  \linewidth\caption@tempdima
  \hsize\caption@tempdima
  #2}}
\DeclareCaptionOption{boxcolor}{\def\caption@boxcolor{#1}}
\DeclareCaptionOption{boxsep}{\setlength\fboxsep{#1}}
\def\caption@box@default{\caption@box@none}
\newcommand*\DeclareCaptionFormat{%
  \caption@teststar\caption@declareformat\@gobble\@firstofone}
\@onlypreamble\DeclareCaptionFormat
\newcommand*\caption@declareformat[2]{%
  \@dblarg{\caption@@declareformat#1{#2}}}
\@onlypreamble\caption@declareformat
\long\def\caption@@declareformat#1#2[#3]#4{%
  \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
  \global\long\@namedef{caption@slfmt@#2}##1##2##3{#3}%
  \global\long\@namedef{caption@fmt@#2}##1##2##3{#4}}
\@onlypreamble\caption@@declareformat
\DeclareCaptionOption{format}{\caption@setformat{#1}}
\newcommand*\caption@setformat[1]{%
  \@ifundefined{caption@fmt@#1}%
    {\caption@Error{Undefined format `#1'}}%
    {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
     \expandafter\let\expandafter\caption@slfmt\csname caption@slfmt@#1\endcsname
     \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
\newcommand*\DeclareCaptionDefaultFormat[1]{%
  \expandafter\def\expandafter\caption@fmt@default\expandafter
    {\csname caption@fmt@#1\endcsname}%
  \expandafter\def\expandafter\caption@slfmt@default\expandafter
    {\csname caption@slfmt@#1\endcsname}%
  \expandafter\def\expandafter\caption@ifh@default\expandafter
    {\csname caption@ifh@#1\endcsname}}
\@onlypreamble\DeclareCaptionDefaultFormat
\DeclareCaptionFormat{plain}{#1#2#3\par}
\DeclareCaptionFormat{hang}[#1#2#3\par]{%
  \caption@ifin@list\caption@lsepcrlist\caption@lsepname
    {\caption@Error{%
       The option `labelsep=\caption@lsepname' does not work\MessageBreak
       with `format=hang'}}%
    {\@hangfrom{#1#2}%
     \advance\caption@parindent\hangindent
     \advance\caption@hangindent\hangindent
     \caption@@par#3\par}}
\DeclareCaptionDefaultFormat{plain}
\newcommand*\DeclareCaptionLabelFormat[2]{%
  \global\@namedef{caption@lfmt@#1}##1##2{#2}}
\@onlypreamble\DeclareCaptionLabelFormat
\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
\newcommand*\caption@setlabelformat[1]{%
  \@ifundefined{caption@lfmt@#1}%
    {\caption@Error{Undefined label format `#1'}}%
    {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
\DeclareCaptionLabelFormat{empty}{}
\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
\DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)}
\DeclareCaptionLabelFormat{autodot}{\bothIfFirst{#1}{\nobreakspace}#2\autodot}
\DeclareCaptionLabelFormat{unnumbered}{#1}
\def\caption@lfmt@default{\caption@lfmt@simple}
\newcommand\DeclareCaptionLabelSeparator{%
  \caption@teststar\caption@declarelabelseparator\@gobble\@firstofone}
\@onlypreamble\DeclareCaptionLabelSeparator
\newcommand\caption@declarelabelseparator[3]{%
  \global\@namedef{caption@iflf@#2}{#1}%
  \global\long\@namedef{caption@lsep@#2}{#3}%
  \caption@@declarelabelseparator{#2}#3\\\@nil}
\@onlypreamble\caption@declarelabelseparator
\long\def\caption@@declarelabelseparator#1#2\\#3\@nil{%
  \def\@tempa{#3}\ifx\@tempa\@empty \else
    \caption@g@addto@list\caption@lsepcrlist{#1}%
  \fi}
\@onlypreamble\caption@@declarelabelseparator
\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
\newcommand*\caption@setlabelseparator[1]{%
  \@ifundefined{caption@lsep@#1}%
    {\caption@Error{Undefined label separator `#1'}}%
    {\edef\caption@lsepname{#1}%
     \expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname
     \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
\DeclareCaptionLabelSeparator{none}{}
\DeclareCaptionLabelSeparator{colon}{: }
\DeclareCaptionLabelSeparator{period}{. }
\DeclareCaptionLabelSeparator{space}{ }
\DeclareCaptionLabelSeparator*{quad}{\quad}
\DeclareCaptionLabelSeparator*{newline}{\\}
\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
\newcommand*\caption@setdefaultlabelsep[1]{%
  \ifx\caption@lsep\caption@lsep@default
    \caption@set@default@labelsep{#1}%
    \caption@setlabelseparator{default}%
  \else
    \caption@set@default@labelsep{#1}%
  \fi}
\newcommand*\caption@set@default@labelsep[1]{%
  \def\caption@lsep@default{\@nameuse{caption@lsep@#1}}%
  \def\caption@iflf@default{\@nameuse{caption@iflf@#1}}}
\caption@set@default@labelsep{colon}
\newcommand*\DeclareCaptionTextFormat[2]{%
  \global\long\@namedef{caption@tfmt@#1}##1{#2}}
\@onlypreamble\DeclareCaptionTextFormat
\DeclareCaptionOption{textformat}{\caption@settextformat{#1}}
\DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}}
\newcommand*\caption@settextformat[1]{%
  \@ifundefined{caption@tfmt@#1}%
    {\caption@Error{Undefined text format `#1'}}%
    {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}}
\DeclareCaptionTextFormat{empty}{%
  \caption@get@label#1\caption@makeanchor{}\@nil
  \caption@thelabel
  \global\let\caption@thelabel\relax}
\long\def\caption@get@label#1\caption@makeanchor#2#3\@nil{%
  \def\caption@tempa{#2}%
  \ifx\caption@tempa\@empty
    \caption@getlabel#1\label{}\@nil
  \else
    \caption@getlabel#2\label{}\@nil
  \fi}
\DeclareCaptionTextFormat{simple}{#1}
\DeclareCaptionTextFormat{period}{#1.}
\def\caption@tfmt@default{\caption@tfmt@simple}
\long\def\caption@getlabel#1\label#2#3\@nil{%
  \def\@tempa{#2}%
  \ifx\@tempa\@empty
    \let\caption@thelabel\relax
  \else
    \def\@tempb{*}%
    \ifx\@tempa\@tempb
      \def\caption@thelabel{\label*}%
      \caption@@getlabel#3\@nil
    \else
      \def\caption@thelabel{\label}%
      \caption@@getlabel{#2}#3\@nil
    \fi
  \fi}
\long\def\caption@@getlabel#1#2\@nil{%
  \def\@tempa{#1}%
  \def\@tempb{[}%
  \ifx\@tempa\@tempb
    \caption@@@getlabel#1#2\@nil
  \else
    \l@addto@macro\caption@thelabel{{#1}}%
  \fi}
\long\def\caption@@@getlabel[#1]#2\@nil{%
  \l@addto@macro\caption@thelabel{[{#1}]}%
  \caption@@getlabel#2\@nil}
\let\caption@thelabel\relax
\newcommand*\DeclareCaptionFont{%
  \@ifnextchar[%]
    \caption@declare@font
    \caption@declarefont}
\@onlypreamble\DeclareCaptionFont
\def\caption@declare@font[#1]#2{%
  \global\@namedef{caption@fnt@#2@package}{#1}%
  \caption@@declarefont{#2}}
\@onlypreamble\caption@declare@font
\newcommand*\caption@declarefont[1]{%
  \global\@nameundef{caption@fnt@#1@package}%
  \caption@@declarefont{#1}}
\@onlypreamble\caption@declarefont
\newcommand*\caption@@declarefont[2]{%
  \define@key{caption@fnt}{#1}[]{\caption@addto@fnt{#1}{#2}}%
  \caption@@@declarefont{#1}{#2}}
\@onlypreamble\caption@@declarefont
\newcommand*\caption@@@declarefont[2]{}% will be used by \DeclareCaptionJustification
\@onlypreamble\caption@@@declarefont
\newcommand*\caption@addto@fnt[2]{%
  \expandafter\let\expandafter\caption@package\csname caption@fnt@#1@package\endcsname
  \caption@ifdefined\caption@package
    {\caption@requirepackage\caption@package{#1}}% load package, if necessary
    {}%
  \l@addto@macro\caption@fnt{#2}}
\newcommand*\DeclareCaptionDefaultFont[2]{%
  \global\@namedef{caption#1@default}{#2}}
\@onlypreamble\DeclareCaptionDefaultFont
\DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
\DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}}
\DeclareCaptionDefaultFont{font}{}
\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
\DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}}
\DeclareCaptionDefaultFont{labelfont}{}
\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
\DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}}
\DeclareCaptionDefaultFont{textfont}{}
\newcommand*\caption@setfont[1]{%
  \expandafter\let\csname caption#1\endcsname\@empty
  \caption@addtofont{#1}}
\newcommand*\caption@addtofont[2]{%
  \begingroup
    \expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname
    \define@key{caption@fnt}{default}[]{%
      \l@addto@macro\caption@fnt{\csname caption#1@default\endcsname}}%
    \caption@setkeys[caption]{caption@fnt}{#2}%
    \global\let\caption@tempa\caption@fnt
  \endgroup
  \expandafter\let\csname caption#1\endcsname\caption@tempa}
\newcommand*\caption@font{%
  \caption@teststar\caption@@font\@firstofone
          {\caption@setkeys[caption]{caption@fnt}}}
\newcommand*\caption@@font[2]{%
  \begingroup
  \def\caption@fnt{\endgroup}%
  #1{#2}%
  \caption@fnt}
\DeclareCaptionFont{normalcolor}{\normalcolor}
\DeclareCaptionFont{color}{\color{#1}}
\DeclareCaptionFont{normalfont}{\normalfont}
\DeclareCaptionFont{up}{\upshape}
\DeclareCaptionFont{it}{\itshape}
\DeclareCaptionFont{sl}{\slshape}
\DeclareCaptionFont{sc}{\scshape}
\DeclareCaptionFont{md}{\mdseries}
\DeclareCaptionFont{bf}{\bfseries}
\DeclareCaptionFont{rm}{\rmfamily}
\DeclareCaptionFont{sf}{\sffamily}
\DeclareCaptionFont{tt}{\ttfamily}
\DeclareCaptionFont{tiny}{\tiny}
\DeclareCaptionFont{scriptsize}{\scriptsize}
\DeclareCaptionFont{footnotesize}{\footnotesize}
\DeclareCaptionFont{small}{\small}
\DeclareCaptionFont{normalsize}{\normalsize}
\DeclareCaptionFont{large}{\large}
\DeclareCaptionFont{Large}{\Large}
\DeclareCaptionFont{LARGE}{\LARGE}
\DeclareCaptionFont{huge}{\huge}
\DeclareCaptionFont{Huge}{\Huge}
\newcommand\caption@smaller{%
  \ifx\@currsize\tiny
    \relax
  \else\ifx\@currsize\scriptsize
    \tiny
  \else\ifx\@currsize\footnotesize
    \scriptsize
  \else\ifx\@currsize\small
    \footnotesize
  \else\ifx\@currsize\normalsize
    \small
  \else\ifx\@currsize\large
    \normalsize
  \else\ifx\@currsize\Large
    \large
  \else\ifx\@currsize\LARGE
    \Large
  \else\ifx\@currsize\huge
    \LARGE
  \else\ifx\@currsize\Huge
    \huge
  \else
    \caption@Warning{%
      Cannot determine current font size.\MessageBreak
      Try setting it with `size=' explicitly}%
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
\DeclareCaptionFont{smaller}{\caption@smaller}
\newcommand\caption@larger{%
  \ifx\@currsize\tiny
    \scriptsize
  \else\ifx\@currsize\scriptsize
    \footnotesize
  \else\ifx\@currsize\footnotesize
    \small
  \else\ifx\@currsize\small
    \normalsize
  \else\ifx\@currsize\normalsize
    \large
  \else\ifx\@currsize\large
    \Large
  \else\ifx\@currsize\Large
    \LARGE
  \else\ifx\@currsize\LARGE
    \huge
  \else\ifx\@currsize\huge
    \Huge
  \else\ifx\@currsize\Huge
    \relax
  \else
    \caption@Warning{%
      Cannot determine current font size.\MessageBreak
      Try setting it with `size=' explicitly}%
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
\DeclareCaptionFont{larger}{\caption@larger}
\DeclareCaptionFont{singlespacing}{}
\DeclareCaptionFont{normal}{%
  \caption@font*{%
    \KV@caption@fnt@normalcolor\@unused
    \KV@caption@fnt@normalfont\@unused
    \KV@caption@fnt@normalsize\@unused
    \KV@caption@fnt@singlespacing\@unused}}
\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
\DeclareCaptionDefaultFont{size}{}
\newcommand*\DeclareCaptionJustification{%
  \def\caption@@@declarefont##1##2{%
    \global\@namedef{caption@hj@##1}{##2}% for compatibility to v1.0, needed by floatrow package
    \let\caption@@@declarefont\@gobbletwo}%
  \DeclareCaptionFont}
\@onlypreamble\DeclareCaptionJustification
\newcommand*\DeclareCaptionDefaultJustification[1]{%
  \global\@namedef{caption@hj@default}{#1}% for compatibility to v1.0
  \DeclareCaptionDefaultFont{@hj}{#1}}
\@onlypreamble\DeclareCaptionDefaultJustification
\DeclareCaptionOption{justification}{\caption@setjustification{#1}}
\DeclareCaptionDefaultJustification{}
\newcommand*\caption@setjustification{\caption@setfont{@hj}}
\DeclareCaptionJustification{justified}{}
\DeclareCaptionJustification{centering}{\centering}
\DeclareCaptionJustification{centerfirst}{\centerfirst}
\DeclareCaptionJustification{centerlast}{\centerlast}
\DeclareCaptionJustification{raggedleft}{\raggedleft}
\DeclareCaptionJustification{raggedright}{\raggedright}
\providecommand\centerfirst{%
  \let\\\@centercr
  \edef\caption@normaladjust{%
    \leftskip\the\leftskip
    \rightskip\the\rightskip
    \parfillskip\the\parfillskip\relax}%
  \leftskip\z@\@plus -1fil%
  \rightskip\z@\@plus 1fil%
  \parfillskip\z@skip
  \noindent\hskip\z@\@plus 2fil%
  \@setpar{\@@par\@restorepar\caption@normaladjust}}
\providecommand\centerlast{%
  \let\\\@centercr
  \leftskip\z@\@plus 1fil%
  \rightskip\z@\@plus -1fil%
  \parfillskip\z@\@plus 2fil\relax}
\caption@ifundefined\abovecaptionskip{%
  \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
\caption@ifundefined\belowcaptionskip{%
  \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
\newcommand*\caption@rule{\caption@ifrule\caption@hrule\relax}
\newcommand*\caption@hrule{\hrule\@height\z@}
\DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}}
\DeclareCaptionOption{position}{\caption@setposition{#1}}
\DeclareCaptionOption{figureposition}{%
  \captionsetup*[figure]{position=#1}}
\@onlypreamble@key{caption}{figureposition}
\DeclareCaptionOption{tableposition}{%
  \captionsetup*[table]{position=#1}}
\@onlypreamble@key{caption}{tableposition}
\newcommand*\caption@setposition[1]{%
  \caption@ifinlist{#1}{d,default}{%
    \let\caption@position\caption@defaultpos
  }{\caption@ifinlist{#1}{t,top,above}{%
    \let\caption@position\@firstoftwo
  }{\caption@ifinlist{#1}{b,bottom,below}{%
    \let\caption@position\@secondoftwo
  }{\caption@ifinlist{#1}{a,auto}{%
    \let\caption@position\@undefined
  }{%
    \caption@Error{Undefined position `#1'}%
  }}}}}
\let\caption@defaultpos\@undefined
\newcommand*\caption@iftop{%
  \ifx\caption@position\@undefined
    \let\caption@position\@secondoftwo
  \fi
  \caption@position}
\newcommand*\caption@fixposition{%
  \ifx\caption@position\@undefined
    \caption@autoposition
  \fi}
\newcommand*\caption@autoposition{%
  \ifvmode
    \edef\caption@tempa{\the\prevdepth}%
    \caption@Debug{\protect\prevdepth=\caption@tempa}%
    \ifdim\prevdepth>-\p@
      \let\caption@position\@secondoftwo
    \else
      \let\caption@position\@firstoftwo
    \fi
  \else
    \caption@Debug{no \protect\prevdepth}%
    \let\caption@position\@secondoftwo
  \fi}
\newcommand*\caption@setautoposition[1]{%
  \def\caption@autoposition{\caption@setposition{#1}}}
\newcommand*\caption@beginhook{}
\newcommand*\caption@endhook{}
\newcommand*\AtBeginCaption{\l@addto@macro\caption@beginhook}
\newcommand*\AtEndCaption{\l@addto@macro\caption@endhook}
\DeclareCaptionOption{list}[1]{\caption@setlist{#1}}
\DeclareCaptionOption{listof}[1]{\caption@setlist{#1}}
\newcommand*\caption@setlist{\caption@set@bool\caption@iflist}
\DeclareCaptionOption{listtype}{\caption@setlisttype{#1}}
\DeclareCaptionOption{listtype+}{\caption@setlisttype@ext{#1}}
\newcommand*\caption@setlisttype{%
  \caption@setlisttype@ext{}%
  \caption@@setlisttype\caption@listtype}
\newcommand*\caption@@setlisttype[2]{%
  \edef#1{#2}%
  \ifx#1\@empty \let#1\@undefined \fi}
\newcommand*\caption@setlisttype@ext{%
  \caption@@setlisttype\caption@listtype@ext}
\newcommand*\DeclareCaptionListFormat[2]{%
  \global\@namedef{caption@lstfmt@#1}##1##2{#2}}
\@onlypreamble\DeclareCaptionListFormat
\DeclareCaptionOption{listformat}{\caption@setlistformat{#1}}
\newcommand*\caption@setlistformat[1]{%
  \@ifundefined{caption@lstfmt@#1}%
    {\caption@Error{Undefined list format `#1'}}%
    {\expandafter\let\expandafter\caption@lstfmt
       \csname caption@lstfmt@#1\endcsname}}
\DeclareCaptionListFormat{empty}{}
\DeclareCaptionListFormat{simple}{#1#2}
\DeclareCaptionListFormat{parens}{#1(#2)}
\DeclareCaptionListFormat{subsimple}{#2}
\DeclareCaptionListFormat{subparens}{(#2)}
\newcommand*\caption@setdefaultlistformat[1]{%
  \ifx\caption@lstfmt\caption@lstfmt@default
    \caption@set@default@listformat{#1}%
    \caption@setlistformat{default}%
  \else
    \caption@set@default@listformat{#1}%
  \fi}
\newcommand*\caption@set@default@listformat[1]{%
  \def\caption@lstfmt@default{\@nameuse{caption@lstfmt@#1}}}
\caption@set@default@listformat{subsimple}
\DeclareCaptionOption{debug}[1]{%
  \caption@set@bool\caption@ifdebug{#1}%
  \caption@ifdebug
    {\let\caption@Debug\caption@Info}%
    {\let\caption@Debug\@gobble}}
\DeclareOption{debug}{\setkeys{caption}{debug}}
\setkeys{caption}{debug=0}
\caption@setbool{documentclass}{1}
\caption@ifundefined\caption@documentclass{%
  \@ifclassloaded{beamer}{%
    \caption@InfoNoLine{beamer document class detected}%
    \def\caption@documentclass{beamer}%
  }{\@ifclassloaded{elsarticle}{%
    \caption@InfoNoLine{elsarticle document class detected}%
    \def\caption@documentclass{elsarticle}%
  }{\@ifclassloaded{memoir}{%
    \caption@InfoNoLine{memoir document class detected}%
    \def\caption@documentclass{memoir}%
  }{\caption@ifdefined\scr@caption{%
    \caption@InfoNoLine{KOMA-Script document class detected}%
    \def\caption@documentclass{koma}%
  }{\caption@ifdefined\@captionheadfont{%
    \caption@InfoNoLine{AMS or SMF document class detected}%
    \def\caption@documentclass{ams}%
  }{\caption@ifdefined\CaptionFonts{%
    \caption@InfoNoLine{NTG document class detected}%
    \def\caption@documentclass{ntg}%
  }{\caption@ifdefined\cph@font{%
      \caption@ifdefined\cpb@font\@firstoftwo\@secondoftwo
    }{%
      \@secondoftwo
    }{%
    \caption@InfoNoLine{thesis document class detected}%
    \def\caption@documentclass{thesis}%
  }{%
    % article|report|book [2005/09/16 v1.4f Standard LaTeX document class]
    \long\def\caption@tempa#1#2{%
      \vskip\abovecaptionskip
      \sbox\@tempboxa{#1: #2}%
      \ifdim \wd\@tempboxa >\hsize
        #1: #2\par
      \else
        \global \@minipagefalse
        \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
      \fi
      \vskip\belowcaptionskip}}
    \ifx\caption@tempa\@makecaption
      \caption@InfoNoLine{Standard document class detected}%
    \else
      \caption@InfoNoLine{%
        Unknown document class (or package),\MessageBreak
        standard defaults will be used}%
      \caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}%
      \caption@setbool{documentclass}{0}%
    \fi
    \def\caption@documentclass{base}%
  }}}}}}%
}{}
\newcommand*\caption@ifclassloaded[1]{%
  \edef\caption@tempa{#1}%
  \ifx\caption@tempa\caption@documentclass
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}
\caption@ifclassloaded{elsarticle}{%
  \DeclareCaptionDefaultFont{font}{\footnotesize}
}{}
\caption@ifclassloaded{ams}{%
  \let\captionmargin\captionindent % set to 3pc by AMS class
  \begingroup\edef\@tempa{\endgroup
    \noexpand\caption@g@addto@list\noexpand\caption@sty@default
      {margin=\the\captionmargin
       \caption@ifdefined\smf@makecaption{,maxmargin=.1\linewidth}{}}}
  \@tempa
  \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin}
  \DeclareCaptionLabelSeparator{default}{.\enspace}
  \DeclareCaptionDefaultFont{font}{\@captionfont}
  \DeclareCaptionDefaultFont{labelfont}{\@captionheadfont}
  \DeclareCaptionDefaultFont{textfont}{\@captionfont\upshape}
  \captionsetup[figure]{position=b}
  \captionsetup[table]{position=t}
}{}
\caption@ifclassloaded{beamer}{%
  \newcommand*\caption@ifbeamertemplate[1]{%
    \begingroup
      \let\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
      \@nameuse{beamer@@tmpop@caption@#1}%
      \ifx\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
        \endgroup\expandafter\@firstoftwo
      \else
        \endgroup\expandafter\@secondoftwo
      \fi}
  \DeclareCaptionLabelFormat{default}{%
    \caption@ifbeamertemplate{numbered}%
      \caption@lfmt@simple
      \caption@lfmt@unnumbered
    {#1}{#2}}
  \DeclareCaptionLabelFormat{default@magyar}{%
    \caption@ifbeamertemplate{numbered}%
      \caption@lfmt@simple@magyar
      \caption@lfmt@unnumbered
    {#1}{#2}}
  \@ifundefined{@@magyar@captionfix}\AtBeginDocument\@firstofone{%
    \@ifundefined{@@magyar@captionfix}{}{%
      \g@addto@macro\@@magyar@captionfix{%
        \let\caption@lfmt@simple@magyar\caption@lfmt@simpleMagyar
        \let\caption@lfmt@simpleMagyar\caption@lfmt@default@magyar}}}
  \caption@declarelabelseparator
    {\caption@ifbeamertemplate{caption name own line}\@gobble\@firstofone}
    {default}
    {\caption@ifbeamertemplate{caption name own line}{\\}%
       {\usebeamertemplate{caption label separator}}}
  \DeclareCaptionDefaultFont{font}{%
    \usebeamerfont*{caption}%
    \usebeamercolor[fg]{caption}}
  \DeclareCaptionDefaultFont{labelfont}{%
    \setbeamercolor*{caption}{}% avoid setting "caption" color additionally
    \usebeamercolor[fg]{caption name}%
    \setbeamerfont*{caption}{}% avoid setting "caption" font additionally
    \usebeamerfont{caption name}}
  \DeclareCaptionDefaultJustification{\raggedright}
  \DeclareOption{beamerclass}{%
    \renewcommand\caption@ifslc{%
      \caption@ifbeamertemplate{caption name own line}\@secondoftwo\@firstoftwo}
    % Since the beamer class do not offer a `list of figures' we switch this support off.
    \captionsetup{list=0}}
  \PassOptionsToPackage{beamerclass}{caption3}
  \defbeamertemplate{caption}{caption3}{%
    \caption@make\insertcaptionname\insertcaptionnumber\insertcaption}
  \DeclareOption{beamer}{%
    % \usebeamertemplate**{caption} will set font
    \DeclareCaptionDefaultFont{font}{}%
    \setbeamertemplate{caption}[caption3]}
}{}
\caption@ifclassloaded{koma}{%
  \DeclareCaptionFormat{default}[#1#2#3\par]{%
    \ifdofullc@p
      \caption@ifin@list\caption@lsepcrlist\caption@lsepname
        {\caption@Error{%
           The option `labelsep=\caption@lsepname' does not work\MessageBreak
           with \noexpand\setcaphanging (which is set by default)}}%
        {\caption@fmt@hang{#1}{#2}{#3}}%
    \else
      #1#2%
      \ifdim\cap@indent<\z@
        \par
        \noindent\hspace*{-\cap@indent}%
      \else\if@capbreak
        \par
      \fi\fi
      #3\par
    \fi}
  \DeclareCaptionLabelSeparator{default}{\captionformat}
  \DeclareCaptionDefaultFont{font}{\scr@fnt@caption}
  \DeclareCaptionDefaultFont{labelfont}{\scr@fnt@captionlabel}
  \let\caption@KV@parindent\KV@caption@parindent
  \DeclareCaptionOption{parindent}[]{%
    \ifx,#1,%
      \caption@Debug{Option `parindent' ignored}%
    \else
      \caption@KV@parindent{#1}%
    \fi}%
  \let\caption@KV@parskip\KV@caption@parskip
  \DeclareCaptionOption{parskip}[]{%
    \ifx,#1,%
      \caption@Debug{Option `parskip' ignored}%
    \else
      \caption@KV@parskip{#1}%
    \fi}%
}{}
\caption@ifclassloaded{ntg}{%
  \DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont}
  \DeclareCaptionDefaultFont{textfont}{\CaptionTextFont}
}{}
\caption@ifclassloaded{thesis}{%
  \DeclareCaptionDefaultFormat{hang}
  \DeclareCaptionDefaultFont{labelfont}{\cph@font}
  \DeclareCaptionDefaultFont{textfont}{\cpb@font}
}{}
\caption@ifdefined\ArabiCoreLoaded{%
  \newcommand\caption@rl[1]{\if@rl\textRL{#1}\else\textLR{#1}\fi}
  \def\fnum@figure{\figurename\nobreakspace\thefigure}%
  \def\fnum@table{\tablename\nobreakspace\thetable}%
  \DeclareCaptionLabelSeparator{arabi}{ : }
  \DeclareCaptionLabelSeparator{default}{%
    \if@rl\caption@lsep@arabi\else\caption@lsep@colon\fi}
}{%
  \let\caption@rl\@firstofone
}
\caption@ifdefined\FB@makecaption{%
  \ifx\@makecaption\STD@makecaption
    \DeclareCaptionLabelSeparator{default}{\CaptionSeparator}
    \def\caption@frenchb{% supress frenchb warning
      \let\STD@makecaption\@makecaption
      \let\FB@makecaption\@makecaption}
  \else
    \ifx\@makecaption\@undefined\else
      \caption@InfoNoLine{%
        The definition of \protect\@makecaption\space
        has been changed,\MessageBreak
        frenchb will NOT customize it}%
    \fi
  \fi
}{}
\caption@ifdefined\frenchTeXmods{%
  \DeclareCaptionDefaultFont{textfont}{\itshape}%
  \DeclareCaptionLabelSeparator{default}{\captionseparator\space}%
}{}
\DeclareCaptionListFormat{subperiod}{#2.}
\def\caption@tempa#1{%
  \@ifpackagewith{babel}{#1}{%
    \caption@InfoNoLine{#1 babel option is loaded}%
    \expandafter\addto\csname extras#1\endcsname{%
       % change default labelsep and listformat
       \caption@setdefaultlabelsep{period}%
       \caption@setdefaultlistformat{subperiod}}%
    \expandafter\addto\csname noextras#1\endcsname{%
       % change default labelsep and listformat
       \caption@setdefaultlabelsep{colon}%
       \caption@setdefaultlistformat{subsimple}}%
  }{}}
\caption@tempa{hungarian}
\caption@tempa{magyar}
\newcommand*\caption@xpackage[2]{%
  \expandafter\ifx\csname ver@#2.\caption@pkgextension\endcsname\relax
    \expandafter\@firstofone
  \else
    \expandafter\@gobbletwo
  \fi
  {#1{#2}}}
\let\caption@pkgextension\@pkgextension
\newcommand*\caption@loadpackage{%
  \caption@xpackage\caption@@loadpackage}
\newcommand*\caption@@loadpackage[2]{%
  \caption@Info{Option `#2' requires the `#1' package}%
  \RequirePackage{#1}\relax}
\newcommand*\caption@requirepackage{%
  \caption@xpackage\caption@@requirepackage}
\newcommand*\caption@@requirepackage[2]{%
  \@cons\caption@packagelist{{#1}{#2}}}% load package later on
\newcommand*\caption@pkg@list{}
\newcommand*\caption@packagelist{}
\@onlypreamble\caption@packagelist
\caption@AtBeginDocument{%
  \def\caption@tempa{\endgroup}%
  \begingroup
  \def\@elt#1#2{%
    \g@addto@macro\caption@tempa{%
      \caption@loadpackage{#1}{#2}}}%
  \caption@packagelist
  \caption@tempa
  \renewcommand*\caption@@loadpackage[2]{%
    \caption@Error{Option `#2' requires the `#1' package}}%
  \let\caption@@requirepackage\caption@@loadpackage
  }
\newcommand*\caption@usepackage[3]{%
  \IfCaptionOptionCheck
    {\caption@requirepackage{#1}{#2}}%
    {\let\KV@prefix@ORI\KV@prefix
     \let\@tempc@ORI\@tempc
     \caption@loadpackage{#1}{#2}%
     #3%
     \let\@tempc\@tempc@ORI
     \let\KV@prefix\KV@prefix@ORI}}
\newcommand*\caption@newfloat{\caption@usepackage{newfloat}}
\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}}
\@onlypreamble@key{caption}{figurename}
\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}}
\@onlypreamble@key{caption}{tablename}
\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}}
\@onlypreamble@key{caption}{listfigurename}
\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}}
\@onlypreamble@key{caption}{listtablename}
\newcommand*\caption@SetName[2]{%
  \caption@newfloat{#1name}{\newfloat@setname{#1}{#2}}}
\@onlypreamble\caption@SetName
\DeclareCaptionOption{name}{%
  \IfCaptionOptionCheck{}{\caption@setname\@captype{#1}}}
\newcommand*\caption@setname[2]{%
  \@namedef{#1name}{#2}}
\DeclareCaptionOption{figurewithin}{\caption@within{figure}{#1}}
\DeclareCaptionOptionNoValue{figurewithout}{\caption@within{figure}{none}}
\DeclareCaptionOption{tablewithin}{\caption@within{table}{#1}}
\DeclareCaptionOptionNoValue{tablewithout}{\caption@within{table}{none}}
\newcommand*\caption@within[2]{%
  \caption@newfloat{#1within}{\newfloat@setwithin{#1}{#2}}}
\DeclareCaptionOption{within}{%
  \caption@newfloat{within}{\newfloatsetup{within=#1}}}
\DeclareCaptionOptionNoValue{without}{%
  \caption@newfloat{without}{\newfloatsetup{without}}}
\DeclareCaptionJustification[ragged2e]{Justified}{\justifying}
\DeclareCaptionJustification[ragged2e]{Centering}{\Centering}
\DeclareCaptionJustification[ragged2e]{RaggedLeft}{\RaggedLeft}
\DeclareCaptionJustification[ragged2e]{RaggedRight}{\RaggedRight}
\DeclareCaptionFont[sansmath]{sansmath}{\sansmath}
\DeclareCaptionFont{singlespacing}{%
  \caption@ifdefined\setspace@singlespace{%
    \setstretch\setspace@singlespace}{}}% normally 1
\DeclareCaptionFont[setspace]{onehalfspacing}{\onehalfspacing}
\DeclareCaptionFont[setspace]{doublespacing}{\doublespacing}
\DeclareCaptionFont[setspace]{stretch}{\setstretch{#1}}
\caption@AtBeginDocument{%
  \def\@tempa{2005/06/28 ver: 1.3 subfig package}%
  \expandafter\ifx\csname ver@subfig.sty\endcsname\@tempa
    \caption@InfoNoLine{subfig package v1.3 is loaded}%
    \let\caption@setfloattype\@gobble
    \let\@dottedxxxline\sf@NEW@dottedxxxline
    \let\sf@subfloat\sf@NEW@subfloat
  \fi
  \let\sf@NEW@dottedxxxline\@undefined
  \let\sf@NEW@subfloat\@undefined}
\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{%
  \begingroup
    \caption@setfloattype{#1}%
    \caption@setoptions{subfloat}%
    \caption@setoptions{sub#1}%
    \ifnum #3>\@nameuse{c@#2depth}\else
      \@dottedtocline{\z@}{#4}{#5}{#6}{#7}%
    \fi
  \endgroup}
\def\sf@NEW@subfloat{%
  \begingroup
    \@nameuse{caption@warmup}%
    \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
      {\sf@@subfloat}%
      {\sf@@subfloat[\@empty]}}
%%\@ifl@aded{dtx}{subfig}{\caption@loadpackage{ragged2e}{}}{} % not needed
\DeclareCaptionOption{lofdepth}[2]{\caption@ifdefined\c@lofdepth{\setcounter{lofdepth}{#1}}{}}
\DeclareCaptionOption{lotdepth}[2]{\caption@ifdefined\c@lotdepth{\setcounter{lotdepth}{#1}}{}}
\captionsetup{style=default,position=default,%
              list,listformat=default,twoside=\if@twoside 1\else 0\fi}
\ProcessOptions*
\newcommand\caption@addcontentsline[2]{%
  \caption@ifcontentsline{#2}{%
    \begingroup
      \let\@tempa\@gobble
      \caption@ifdefined\caption@listtype
        {\let\@tempa\@firstofone}%
        {\edef\caption@listtype{#1}}%
      \caption@ifdefined\caption@listtype@ext
        {\edef\caption@listtype{\caption@listtype\caption@listtype@ext}%
         \let\@tempa\@firstofone}%
        {}%
      \@tempa
        {\caption@Debug{addcontentsline: #1 => \caption@listtype}%
         \@namedef{the\caption@listtype}{\@nameuse{the#1}}}%
      \expandafter\caption@@addcontentsline\expandafter{\caption@listtype}{#2}%
    \endgroup}%
    \caption@addsubcontentslines{#1}}
\newcommand\caption@@addcontentsline[2]{%
  {\let\\\space
   \@ifundefined{ext@#1}%
     {\caption@Error{No float type '#1' defined}}%
     {\def\captionlisttype{#1}%
      \caption@add@contentsline
        {\csname ext@#1\endcsname}%
        {#1}%
        {\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}%
        {\ignorespaces #2}%
      \caption@chkfloat{#1}{#2}}}}
\newcommand*\caption@add@contentsline{%
  \caption@@@addcontentsline}
\newcommand*\caption@@@addcontentsline[4]{%
  \addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}}
\let\caption@chkfloat\@gobbletwo
\newcommand\caption@ifcontentsline[1]{%
  \caption@iflist
    {\def\@tempa{#1}}%
    {\let\@tempa\@empty}%
  \ifx\@tempa\@empty
    \expandafter\@gobble
  \else
    \expandafter\@firstofone
  \fi}
\newcommand*\caption@addsubcontentslines[1]{}
\newif\ifcaption@star
\newcommand*\caption@fnum[1]{\caption@lfmt{\@nameuse{#1name}}{\@nameuse{the#1}}}
\newcommand\caption@make[2]{\caption@@make{\caption@lfmt{#1}{#2}}}
\newcommand\caption@@make[2]{%
  \begingroup
    \caption@@make@{#1}{#2}%
  \endgroup
  \caption@@make@epilogue}
\newcommand\caption@@make@[2]{%
  \caption@stepthecounter
  \caption@beginhook
  \caption@box\hsize{%
    \caption@ifslc{\caption@slc{#1}{#2}\caption@singleline\relax}{}%
    \caption@calcmargin
    \caption@tempdima\captionmargin
    \ifdim\captionmargin@=\z@ \else
      \caption@ifoddpage{}{\advance\caption@tempdima\captionmargin@}%
    \fi
    \caption@ifh{\advance\caption@tempdima\caption@indent}%
    \hspace\caption@tempdima
    \caption@tempdima\captionwidth
    \caption@ifh{\advance\caption@tempdima-\caption@indent}%
    \caption@parbox\caption@tempdima{%
      \caption@ifh{%
        \ifdim\caption@indent=\z@
          \leavevmode
        \else
          \hskip-\caption@indent
        \fi}%
      \caption@@@make{#1}{#2}}%
    \caption@tempdima\captionmargin
    \ifdim\captionmargin@=\z@ \else
      \caption@ifoddpage{\advance\caption@tempdima\captionmargin@}{}%
    \fi
    \hspace\caption@tempdima
  }%
  \caption@endhook}
\newcommand\caption@@make@epilogue{%
  \global\caption@starfalse}
\newcommand*\caption@calcmargin{%
  \caption@calcmargin@hook
  \ifx\caption@maxmargin\@undefined \else
    \ifdim\captionmargin>\caption@maxmargin\relax
      \captionmargin\caption@maxmargin\relax
    \fi
  \fi
  \ifx\caption@minmargin\@undefined \else
    \ifdim\captionmargin<\caption@minmargin\relax
      \captionmargin\caption@minmargin\relax
    \fi
  \fi
  \ifdim\captionwidth=\z@
    \captionwidth\hsize
    \advance\captionwidth by -2\captionmargin
    \advance\captionwidth by -\captionmargin@
  \else
    \captionmargin\hsize
    \advance\captionmargin by -\captionwidth
    \divide\captionmargin by 2
    \captionmargin@\z@
  \fi
  \caption@Debug{%
    \string\hsize=\the\hsize,
    \string\captionwidth=\the\captionwidth,\MessageBreak
    \string\captionmargin=\the\captionmargin,
    \string\captionmargin@=\the\captionmargin@}%
}
\newcommand\caption@slc[4]{%
  \caption@Debug{Begin SLC}%
  \singlelinecaptiontrue
  \begingroup
  \caption@singleline
  \let\caption@hj\@empty
  \caption@calcmargin % calculate \captionwidth
  \caption@prepareslc
  \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
  \ifdim\wd\@tempboxa>\captionwidth
    \endgroup
    \singlelinecaptionfalse
    #4%
  \else
    \endgroup
    #3%
  \fi
  \caption@Debug{End SLC}}
\newif\ifsinglelinecaption
\newcommand*\caption@singleline{%
  \caption@xsetup\caption@opt@singleline
  \let\caption@fmt\caption@slfmt}
\@ifundefined{caption@prepareslc}\def\g@addto@macro\caption@prepareslc{%
  \let\label\caption@gobble
  \let\hypertarget\@gobbletwo
  \let\caption@footnotemark@ORI\footnotemark
  \def\footnote{\caption@withoptargs\caption@footnote}%
  \def\footnotemark{\caption@withoptargs\caption@footnotemark}%
  \let\@footnotetext\caption@gobble
  \let\caption@endnotemark@ORI\endnotemark
  \def\endnote{\caption@withoptargs\caption@endnote}%
  \def\endnotemark{\caption@withoptargs\caption@endnotemark}%
  \let\@endnotetext\caption@gobble
  \let\pagenote\caption@gobble
  \let\acused\@gobble
  \let\AC@placelabel\@gobble
  \let\glsunset\@gobble
}
\newcommand\caption@footnote[2]{%
  \caption@footnotemark{#1}}
\newcommand\caption@footnotemark[1]{%
  \begingroup
    \let\stepcounter\caption@l@stepcounter
    \caption@footnotemark@ORI#1%
  \endgroup}
\newcommand\caption@endnote[2]{%
  \caption@endnotemark{#1}}
\newcommand\caption@endnotemark[1]{%
  \begingroup
    \let\stepcounter\caption@l@stepcounter
    \caption@endnotemark@ORI#1
  \endgroup}
\newcommand*\caption@l@stepcounter[1]{%
  \advance\csname c@#1\endcsname\@ne\relax}
\newcommand*\caption@applyfont{%
  \caption@hj\captionfont\captionsize}
\newcommand\caption@@@make[2]{%
  \sbox\@tempboxa{#1}%
  \ifdim\wd\@tempboxa=\z@
    \let\caption@lsep\relax
  \fi
  \caption@ifempty{#2}{%
    \let\caption@lsep\@empty
    \let\caption@tfmt\@firstofone
  }%
  \@setpar{\@@par\caption@@par}\caption@@par
  \caption@applyfont
  \caption@fmt
    {\ifcaption@star\else
       \begingroup
         \captionlabelfont
         #1%
       \endgroup
     \fi}%
    {\ifcaption@star\else
       \begingroup
         \caption@iflf\captionlabelfont
         \relax\caption@lsep
       \endgroup
     \fi}%
    {{\captiontextfont
      \captiontextstart
      \caption@ifstrut
        {\vrule\@height\ht\strutbox\@width\z@}%
        {}%
      \nobreak\hskip\z@skip % enable hyphenation
      \caption@tfmt{#2}%
      \caption@ifstrut
        {\ifhmode\@finalstrut\strutbox\fi}%
        {}%
      \captiontextend}}}
\newcommand*\captiontextstart{}
\newcommand*\captiontextend{\par}
\newcommand\caption@ifempty[1]{%
  \caption@if@empty{#1}%
  \caption@ifempty\@unused}
\newcommand\caption@if@empty[1]{%
  \def\caption@tempa{#1}%
  \ifx\caption@tempa\@empty
    \let\caption@ifempty\@secondoftwo
  \else
    \expandafter\def\expandafter\caption@tempa\expandafter{%
      \caption@car#1\caption@if@empty\caption@nil}%
    \def\caption@tempb{\caption@if@empty}%
    \ifx\caption@tempa\caption@tempb
      \let\caption@ifempty\@secondoftwo
    \else
      \def\caption@tempb{\ignorespaces}%
      \ifx\caption@tempa\caption@tempb
        \expandafter\caption@if@empty\expandafter{\@gobble#1}%
      \else
        \def\caption@tempb{\label}%
        \ifx\caption@tempa\caption@tempb
          \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
        \else
          \def\caption@tempb{\index}%
          \ifx\caption@tempa\caption@tempb
            \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
          \else
            \def\caption@tempb{\glossary}%
            \ifx\caption@tempa\caption@tempb
              \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
            \else
              \let\caption@ifempty\@gobbletwo
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi}
\long\def\caption@car#1#2\caption@nil{#1}% same as \@car, but \long
\newcommand*\caption@@par{%
  \parindent\caption@parindent\hangindent\caption@hangindent}%
\newcommand*\DeclareCaptionType{%
  \caption@loadpackage{newfloat}{}%
  \DeclareFloatingEnvironment}
\@onlypreamble\DeclareCaptionType
\newcommand\caption@ForEachType[1]{%
  \caption@ifdefined\ForEachFloatingEnvironment
    {\ForEachFloatingEnvironment{#1}}%
    {\def\@elt##1{#1}%
     \caption@ifdefined\c@figure\@elt\@gobble{figure}%
     \caption@ifdefined\c@table\@elt\@gobble{table}%
     \let\@elt\relax
     \newfloat@addtohook{#1}}}
\providecommand\newfloat@addtohook[1]{%
  \toks@=\expandafter{\newfloat@hook{##1}#1}%
  \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%
  \@tempa}
\providecommand*\newfloat@hook[1]{}
\newcommand*\DeclareCaptionSubType{%
  \caption@teststar\caption@declaresubtype\@firstoftwo\@secondoftwo}
\@onlypreamble\DeclareCaptionSubType
\newcommand*\caption@declaresubtype[1]{%
  \@testopt{\caption@@declaresubtype{#1}}{alph}}
\@onlypreamble\caption@declaresubtype
\def\caption@@declaresubtype#1[#2]#3{%
  \@ifundefined{c@#3}%
    {\caption@Error{No float type '#3' defined}}%
    {\caption@ifsubtype{sub#3}%
     {\caption@Debug{Modify subtype `sub#3'}}%
     {\caption@Debug{New subtype `sub#3'}%
      \@ifundefined{c@sub#3}%
        {\newcounter{sub#3}\relax}%
        {\caption@Warning{Using already defined counter `sub#3'}}%
      \@addtoreset{sub#3}{#3}%
      \@namedef{ext@sub#3}{\csname ext@#3\endcsname}%
      \caption@declaresublistentry{#3}%
      \@cons\caption@subtypelist{{#3}}}%
     \caption@ifdefined\contentsuse{%
       \contentsuse{sub#3}{\csname ext@sub#3\endcsname}}{}%
     \@namedef{sub#3name}{}%
     \@namedef{sub#3autorefname}{\csname #3autorefname\endcsname}%
     #1% is \@firstoftwo in star form, and \@secondoftwo otherwise
     {\@namedef{p@sub#3}{}%
      \@namedef{thesub#3}{\csname the#3\endcsname.\@nameuse{#2}{sub#3}}}%
     {\@namedef{p@sub#3}{\csname the#3\endcsname}%
      \@namedef{thesub#3}{\@nameuse{#2}{sub#3}}}%
     \@namedef{theHsub#3}{\csname theH#3\endcsname.\arabic{sub#3}}%
    }}
\@onlypreamble\caption@@declaresubtype
\newcommand*\caption@declaresublistentry{%
  \caption@ifdefined\l@chapter
    {\caption@@declaresublistentry\l@subsection}%
    {\caption@@declaresublistentry\l@subsubsection}}
\@onlypreamble\caption@declaresublistentry
\newcommand*\caption@@declaresublistentry[2]{%
  \ifx#1\@undefined
    \caption@@@declaresublistentry\relax\@dottedtocline\caption@nil{#2}%
  \else
    \expandafter\caption@@@declaresublistentry#1{}{}\@dottedtocline\caption@nil{#2}%
  \fi}
\@onlypreamble\caption@@declaresublistentry
\long\def\caption@@@declaresublistentry#1\@dottedtocline#2\caption@nil#3{%
  \def\@tempa{#1}%
  \ifx\@tempa\@empty
    \caption@@@@declaresublistentry{#3}#2\caption@nil
  \else
    \caption@@@@declaresublistentry{#3}@{3.8em}{3.2em}\caption@nil
  \fi}
\@onlypreamble\caption@@@declaresublistentry
\def\caption@@@@declaresublistentry#1#2#3#4#5\caption@nil{%
  \expandafter\caption@@@@@declaresublistentry\expandafter
    {\csname @dotted\csname ext@#1\endcsname line\endcsname}{#1}{#3}{#4}}
\@onlypreamble\caption@@@@declaresublistentry
\newcommand*\caption@@@@@declaresublistentry[4]{%
  \@namedef{l@sub#2}{#1{2}{#3}{#4}}%
  \expandafter\caption@@@@@@declaresublistentry
    \expandafter#1\expandafter{\csname ext@#2\endcsname depth}}
\@onlypreamble\caption@@@@@declaresublistentry
\newcommand*\caption@@@@@@declaresublistentry[2]{
  \ifx#1\relax
    \def#1##1{%
      \def\next{\@dottedtocline{##1}}%
      \@ifundefined{c@#2}{}{%
        \ifnum ##1>\@nameuse{c@#2}\relax
          \let\next\@gobblefour
        \else
          \c@tocdepth=\@nameuse{c@#2}\relax
        \fi}%
      \next}%
  \fi}
\@onlypreamble\caption@@@@@@declaresublistentry
\newcommand*\caption@subtypelist{}
\newcommand*\caption@ifsubtype[1]{%
  \begingroup
    \let\next\@secondoftwo
    \edef\@tempa{#1}%
    \def\@elt##1{%
      \def\@tempb{sub##1}%
      \ifx\@tempa\@tempb
        \let\next\@firstoftwo
     \fi}%
    \caption@subtypelist
  \expandafter\endgroup\next}
\newcommand*\caption@restorecounters{%
  \caption@restore@counters
  \global\let\caption@restore@counters\@empty}
\newcommand*\caption@restore@counters{}
\newcommand*\caption@savesubcounters{%
  \def\@elt##1{\caption@savecounter{sub##1}}%
  \caption@subtypelist
  \let\@elt\relax}%
\newcommand*\caption@savecounter[1]{%
  \edef\caption@tempa{%
    \noexpand\l@addto@macro\noexpand\caption@restore@counters
      {\noexpand\setcounter{#1}{\number\value{#1}}}}%
  \caption@tempa}
\newcommand*\caption@For{\caption@withoptargs\caption@@For}
\newcommand\caption@@For[3]{%
  \caption@AtBeginDocument#1{%
    \def\@elt##1{#3}%
    \@nameuse{caption@#2}%
    \let\@elt\relax}}%
\endinput
%%
%% End of file `caption3.sty'.
