%%
%% This is file `caption3.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% caption.dtx  (with options: `kernel')
%% 
%% Copyright (C) 1994-2010 Axel Sommerfeldt (caption@sommerfee.de)
%% 
%% --------------------------------------------------------------------------
%% 
%% 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,
%% ltcaption.dtx, and subcaption.dtx, the derived files caption.sty,
%% caption2.sty, caption3.sty, ltcaption.sty, and subcaption.sty, and the
%% user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%% 
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{caption3}[2010/01/14 v3.1m caption3 kernel (AR)]
\providecommand*\@nameundef[1]{%
  \expandafter\let\csname #1\endcsname\@undefined}
\providecommand\l@addto@macro[2]{%
  \begingroup
    \toks@\expandafter{#1#2}%
    \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}%
  \@tempa}
\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@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{%
  \expandafter#1\expandafter{\caption@tempa}}
\newcommand\caption@DoCheckCommand[2]{%
  \begingroup
    \let\@tempa#1%
    #2%
    \ifx\@tempa#1%
      \endgroup
      \let\caption@CheckCommand\@gobbletwo
    \else
      \endgroup
    \fi}
\@onlypreamble\caption@DoCheckCommand
\let\caption@CheckCommand\caption@DoCheckCommand
\@onlypreamble\caption@CheckCommand
\newcommand*\caption@IfCheckCommand{%
  \ifx\caption@CheckCommand\@gobbletwo
    \let\caption@CheckCommand\caption@DoCheckCommand
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}
\@onlypreamble\caption@IfCheckCommand
\let\caption@begindocumenthook\@empty
\let\caption@@begindocumenthook\@empty
\def\caption@AtBeginDocument{%
  \caption@teststar\g@addto@macro
    \caption@@begindocumenthook\caption@begindocumenthook}
\AtBeginDocument{%
   \PackageInfo{caption}{Begin \noexpand\AtBeginDocument code\@gobble}%
   \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
   \PackageInfo{caption}{End \noexpand\AtBeginDocument code\@gobble}}
\newcommand*\caption@Warning[1]{%
  \caption@WarningNoLine{#1\on@line}}
\newcommand*\caption@WarningNoLine[1]{%
  \PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}}
\newcommand*\caption@Error[1]{%
  \PackageError{caption}{#1}\caption@eh}
\let\caption@KV@err\caption@Error
\newcommand*\caption@wh{%
  See the caption package documentation for explanation.}
\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}
\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}}\define@key{caption}{#2}}
\@onlypreamble\caption@declareoption
\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]#2{%
  \@bsphack
    \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi
    \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}%
  \@esphack}
\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'\MessageBreak}}}
\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\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
  \let\KV@errx\KV@err
  \edef\caption@keydepth{\caption@keydepth i}%
  \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
  \ifx\caption@keydepth\@empty \captionsetup@starfalse \fi
  \@esphack}
\let\caption@keydepth\@empty
\newcommand*\caption@ExecuteOptions[2]{%
  \@expandtwoargs\caption@setkeys{#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
\newdimen\captionmargin
\newdimen\captionmargin@
\newdimen\captionwidth
\DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}}
\DeclareCaptionOption{width}{\setcaptionwidth{#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@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{%
  \captionmargin\z@
  \captionmargin@\z@
  \setlength\captionwidth}
\newcommand*\caption@thecounter{0}
\newcommand*\caption@stepcounter{%
  \@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}}}
\providecommand*\caption@ifkomaclass{%
  \@ifundefined{scr@caption}\@gobble\@firstofone}
\@onlypreamble\caption@ifkomaclass
\caption@ifkomaclass{%
  \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}%
}
\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}}
\DeclareCaptionOption{singlelinecheck}[1]{\caption@set@bool\caption@ifslc{#1}}
\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#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{%
    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]{%
  format=default,labelsep=default,textformat=default,%
  justification=default,font=default,labelfont=default,textfont=default}
\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)}
\def\caption@lfmt@default{\caption@lfmt@simple}
\newcommand\DeclareCaptionLabelSeparator{%
  \caption@teststar\caption@declarelabelseparator\@gobble\@firstofone}
\@onlypreamble\DeclareCaptionLabelSeparator
\newcommand\caption@declarelabelseparator[3]{%
  \global\expandafter\let\csname caption@iflf@#2\endcsname#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{simple}{#1}
\DeclareCaptionTextFormat{period}{#1.}
\def\caption@tfmt@default{\caption@tfmt@simple}
\newcommand*\DeclareCaptionFont[2]{%
  \define@key{caption@fnt}{#1}[]{\l@addto@macro\caption@fnt{#2}}}
\@onlypreamble\DeclareCaptionFont
\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{scriptsize}{\scriptsize}
\DeclareCaptionFont{footnotesize}{\footnotesize}
\DeclareCaptionFont{small}{\small}
\DeclareCaptionFont{normalsize}{\normalsize}
\DeclareCaptionFont{large}{\large}
\DeclareCaptionFont{Large}{\Large}
\DeclareCaptionFont{singlespacing}{%
  \@ifundefined{setspace@singlespace}{}{%
    \setstretch\setspace@singlespace}}% normally 1
\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}
\DeclareCaptionFont{doublespacing}{\doublespacing}
\DeclareCaptionFont{stretch}{\setstretch{#1}}
\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[2]{%
  \global\@namedef{caption@hj@#1}{#2}% for compatibility to v3.0
  \DeclareCaptionFont{#1}{#2}}
\@onlypreamble\DeclareCaptionJustification
\newcommand*\DeclareCaptionDefaultJustification[1]{%
  \global\@namedef{caption@hj@default}{#1}% for compatibility to v3.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}
\DeclareCaptionJustification{Centering}{%
  \caption@ragged\Centering\centering}
\DeclareCaptionJustification{RaggedLeft}{%
  \caption@ragged\RaggedLeft\raggedleft}
\DeclareCaptionJustification{RaggedRight}{%
  \caption@ragged\RaggedRight\raggedright}
\newcommand*\caption@ragged{%
  \caption@Debug{We need ragged2e}%
  \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}%
  \global\let\caption@ragged\caption@@ragged
  \caption@ragged}
\caption@AtBeginDocument{%
  \@ifundefined{caption@r@ragged2e}{%
    \newcommand*\caption@@ragged{%
      \caption@Warning{%
        `ragged2e' support has been changed.\MessageBreak
        Rerun to get captions right}%
      \global\let\caption@ragged\@secondoftwo % suppress further warnings
      \caption@ragged}%
  }{%
    \caption@Debug{We load ragged2e}%
    \IfFileExists{ragged2e.sty}{%
      \RequirePackage{ragged2e}%
      \let\caption@@ragged\@firstoftwo
    }{%
      \newcommand*\caption@@ragged[2]{%
        \@ifundefined{caption\string#1}{%
          \caption@Warning{%
            `ragged2e' package not loaded, therefore\MessageBreak
            substituting \string#2 for \string#1\MessageBreak}%
          \global\@namedef{caption\string#1}}{}%
        #2}%
    }%
  }}
\@ifundefined{abovecaptionskip}{%
  \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
\@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}}
\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}
\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
    {\def\caption@Debug{\PackageInfo{caption}}}%
    {\let\caption@Debug\@gobble}}
\DeclareOption{debug}{\setkeys{caption}{debug}}
\setkeys{caption}{debug=0}
\caption@CheckCommand\@makecaption{%
  % article|report|book [2005/09/16 v1.4f Standard LaTeX document class]
  \long\def\@makecaption#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}}
\providecommand*\caption@ifamsclass{%
  \@ifundefined{@captionheadfont}\@gobble\@firstofone}
\@onlypreamble\caption@ifamsclass
\caption@ifamsclass{%
  \caption@CheckCommand\@makecaption{%
    % amsart|amsproc|amsbook [2004/08/06 v2.20]
    \long\def\@makecaption#1#2{%
      \setbox\@tempboxa\vbox{\color@setgroup
        \advance\hsize-2\captionindent\noindent
        \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
            {\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}%
        \unskip\kern-2\captionindent\par
        \global\setbox\@ne\lastbox\color@endgroup}%
      \ifhbox\@ne % the normal case
        \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
      \fi
      \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
        \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
      \else % tempboxa contained more than one line
        \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip
            \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
      \fi
      \ifnum\@tempcnta<64 % if the float IS a figure...
        \addvspace\abovecaptionskip
        \hbox to\hsize{\kern\captionindent\box\@ne\hss}%
      \else % if the float IS NOT a figure...
        \hbox to\hsize{\kern\captionindent\box\@ne\hss}%
        \nobreak
        \vskip\belowcaptionskip
      \fi
    \relax
    }}
  \caption@CheckCommand\@makecaption{%
    % smfart|smfbook [1999/11/15 v1.2f Classe LaTeX pour les articles publies par la SMF]
    \long\def\@makecaption#1#2{%
      \ifdim\captionindent>.1\hsize \captionindent.1\hsize \fi
      \setbox\@tempboxa\vbox{\color@setgroup
        \advance\hsize-2\captionindent\noindent
        \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
            {\@cdr#2\@nil}{\@addpunct{.}\@captionfont\upshape\enspace#2}%
        \unskip\kern-2\captionindent\par
        \global\setbox\@ne\lastbox\color@endgroup}%
      \ifhbox\@ne % the normal case
        \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
      \fi
      \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
        \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
        \@tempdima\wd\@ne\advance\@tempdima-\captionindent
        \wd\@ne\@tempdima
      \else % tempboxa contained more than one line
        \setbox\@ne\vbox{\rightskip=0pt plus\captionindent\relax
            \unvbox\@tempboxa\parskip\z@skip
            \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
      \fi
      \ifnum\@tempcnta<64 % if the float IS a figure...
        \addvspace\abovecaptionskip
        \noindent\kern\captionindent\box\@ne
      \else % if the float IS NOT a figure...
        \noindent\kern\captionindent\box\@ne
        \nobreak
        \vskip\belowcaptionskip
      \fi
    \relax
    }}
  \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
       \@ifundefined{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}
}
\providecommand*\caption@ifbeamerclass{%
  \@ifclassloaded{beamer}\@firstofone\@gobble}
\@onlypreamble\caption@ifbeamerclass
\caption@ifbeamerclass{%
  \caption@CheckCommand\beamer@makecaption{%
    % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
    \long\def\beamer@makecaption#1#2{%
      \def\insertcaptionname{\csname#1name\endcsname}%
      \def\insertcaptionnumber{\csname the#1\endcsname}%
      \def\insertcaption{#2}%
      \nobreak\vskip\abovecaptionskip\nobreak
      \sbox\@tempboxa{\usebeamertemplate**{caption}}%
      \ifdim \wd\@tempboxa >\hsize
        \usebeamertemplate**{caption}\par
      \else
        \global \@minipagefalse
        \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
      \fi
      \nobreak\vskip\belowcaptionskip\nobreak}}
  \DeclareCaptionLabelFormat{default}{#1}
  \DeclareCaptionDefaultJustification{\raggedright}
  \DeclareCaptionDefaultFont{font}{%
    \usebeamerfont*{caption}%
    \usebeamercolor[fg]{caption}}
  \DeclareCaptionDefaultFont{labelfont}{%
    \usebeamercolor[fg]{caption name}%
    \usebeamerfont*{caption name}}
  \defbeamertemplate{caption}{caption3}{%
    \caption@make\insertcaptionname\insertcaptionnumber\insertcaption}
  \DeclareOption{beamer}{%
    % \usebeamertemplate**{caption} will set font
    \DeclareCaptionDefaultFont{font}{}%
    \setbeamertemplate{caption}[caption3]}
}
\providecommand*\caption@ifkomaclass{%
  \@ifundefined{scr@caption}\@gobble\@firstofone}
\@onlypreamble\caption@ifkomaclass
\caption@ifkomaclass{%
  \caption@CheckCommand\@makecaption{%
    % scrartcl|scrreprt|scrbook [2007/03/07 v2.97a KOMA-Script document class]
    \long\def\@makecaption#1#2{%
      \if@captionabove
        \vskip\belowcaptionskip
      \else
        \vskip\abovecaptionskip
      \fi
      \@@makecaption\@firstofone{#1}{#2}%
      \if@captionabove
        \vskip\abovecaptionskip
      \else
        \vskip\belowcaptionskip
      \fi}}
  \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}
}
\providecommand*\caption@ifntgclass{%
  \@ifundefined{CaptionFonts}\@gobble\@firstofone}
\@onlypreamble\caption@ifntgclass
\caption@ifntgclass{%
  \caption@CheckCommand\@makecaption{%
    % artikel|rapport|boek [2004/06/07 v2.1a NTG LaTeX document class]
    \long\def\@makecaption#1#2{%
      \vskip\abovecaptionskip
      \sbox\@tempboxa{{\CaptionLabelFont#1:} \CaptionTextFont#2}%
      \ifdim \wd\@tempboxa >\hsize
        {\CaptionLabelFont#1:} \CaptionTextFont#2\par
      \else
        \global \@minipagefalse
        \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
      \fi
      \vskip\belowcaptionskip}}
  \DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont}
  \DeclareCaptionDefaultFont{textfont}{\CaptionTextFont}
}
\providecommand*\caption@ifthesisclass{%
  \@ifundefined{cph@font}{\@gobble}{\@ifundefined{cpb@font}\@gobble\@firstofone}}
\caption@ifthesisclass{%
  \caption@CheckCommand\@makecaption{%
    % thesis.cls 1996/25/01 1.0g LaTeX document class (wm).
    \long\def\@makecaption#1#2{%
     \vskip\abovecaptionskip
     \setbox\@tempboxa\hbox{{\cph@font #1:} {\cpb@font #2}}%
     \ifdim \wd\@tempboxa >\hsize
        \@hangfrom{\cph@font #1: }{\cpb@font #2\par}%
     \else
        \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
     \fi
     \vskip\belowcaptionskip}}
  \DeclareCaptionDefaultFormat{hang}
  \DeclareCaptionDefaultFont{labelfont}{\cph@font}
  \DeclareCaptionDefaultFont{textfont}{\cpb@font}
}
\@ifundefined{FB@makecaption}{}{%
  \caption@CheckCommand\@makecaption{%
    % frenchb.ldf [2005/02/06 v1.6g French support from the babel system]
    % frenchb.ldf [2007/10/05 v2.0e French support from the babel system]
    \long\def\@makecaption#1#2{%
      \vskip\abovecaptionskip
      \sbox\@tempboxa{#1\CaptionSeparator #2}%
      \ifdim \wd\@tempboxa >\hsize
        #1\CaptionSeparator #2\par
      \else
        \global \@minipagefalse
        \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
      \fi
      \vskip\belowcaptionskip}}
  \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
      \PackageInfo{caption}{%
        The definition of \protect\@makecaption\space
        has been changed,\MessageBreak
        frenchb will NOT customize it}%
    \fi
  \fi
}
\@ifundefined{frenchTeXmods}{}{%
  \caption@CheckCommand\@makecaption{%
    % french(le).sty [2006/10/03 The french(le) package /V5,9991/]
    % french(le).sty [2007/06/28 The french(le) package /V5,9994/]
    \def\@makecaption#1#2{%
      \ifFTY%
        \def\@secondofmany##1##2\void{##2}%
        \def\@tempa{\@secondofmany#2\void}%
        \ifx\@tempa\empty%
          \let\captionseparator\empty%
        \fi%
        \@mcORI{#1}{\relax\captionfont{#2}}%
      \else
        \@mcORI{#1}{#2}%
      \fi}}
  \caption@CheckCommand\@makecaption{%
    % french(le).sty [2007/02/11 The french(le) package /V5,9993/]
    \def\@makecaption#1#2{%
      \ifFTY%
        \def\@secondofmany##1##2\void{##2}%
        \protected@edef\@tempa{\@secondofmany#2\void}%
        \ifx\@tempa\empty%
          \let\captionseparator\empty%
        \fi%
        \@mcORI{#1}{\relax\captionfont{#2}}%
      \else
        \@mcORI{#1}{#2}%
      \fi}}
  \DeclareCaptionDefaultFont{textfont}{\itshape}%
  \DeclareCaptionLabelSeparator{default}{\captionseparator\space}%
}
\DeclareCaptionListFormat{subperiod}{#2.}
%%% \def\caption@tempa#1{\@ifundefined{extras#1}{}{%
%%%   \expandafter\addto\csname extras#1\endcsname{%
%%%      % reverse changes made by magyar.ldf
%%%      \let\@makecaption\caption@makecaption
%%%      \babel@save\@makecaption
%%%      \caption@redefine
%%%      \babel@save\@caption
%%%      % 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}
\captionsetup{style=default,position=default,%
              list,listformat=default,twoside=\if@twoside 1\else 0\fi}
\ProcessOptions*
\caption@IfCheckCommand{%
  \caption@setbool{documentclass}{1}%
}{%
  \caption@setbool{documentclass}{0}%
  \PackageInfo{caption}{%
         Unknown document class (or package),\MessageBreak
         standard defaults will be used}%
  \caption@Debug{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}%
}
\newcommand*\caption@addcontentsline[2]{%
  \caption@iflist
    {\def\@tempa{#2}}%
    {\let\@tempa\@empty}%
  \ifx\@tempa\@empty \else
    {\let\\\space
     \addcontentsline{\csname ext@#1\endcsname}{#1}%
                     {\protect\numberline
                       {\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}%
                       {\ignorespaces #2}}}%
  \fi}
\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@stepcounter
  \caption@beginhook
  \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
  \caption@ifslc{\caption@slc{#1}{#2}\captionwidth\relax}{}%
  \caption@calcmargin
  \@tempdima\captionmargin
  \ifdim\captionmargin@=\z@ \else
    \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}%
  \fi
  \caption@ifh{\advance\@tempdima\caption@indent}%
  \hspace\@tempdima
  \@tempdima\captionwidth
  \caption@ifh{\advance\@tempdima-\caption@indent}%
  \caption@parbox\@tempdima{%
    \caption@ifh{%
      \ifdim\caption@indent=\z@
        \leavevmode
      \else
        \hskip-\caption@indent
      \fi}%
    \caption@@@make{#1}{#2}}%
  \@tempdima\captionmargin
  \ifdim\captionmargin@=\z@ \else
    \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}%
  \fi
  \hspace\@tempdima
  \caption@endhook
  \endgroup
  \global\caption@starfalse}
\newcommand*\caption@calcmargin{%
  \ifdim\captionwidth=\z@
    \captionwidth\linewidth
    \advance\captionwidth by -2\captionmargin
    \advance\captionwidth by -\captionmargin@
  \else
    \captionmargin\linewidth
    \advance\captionmargin by -\captionwidth
    \divide\captionmargin by 2
    \captionmargin@\z@
  \fi
  \caption@Debug{%
    \string\hsize=\the\hsize,
    \string\linewidth=\the\linewidth,\MessageBreak
    \string\leftmargin=\the\leftmargin,
    \string\rightmargin=\the\rightmargin,\MessageBreak
    \string\margin=\the\captionmargin,
    \string\margin@=\the\captionmargin@,
    \string\width=\the\captionwidth}%
}
\newcommand\caption@slc[4]{%
  \caption@Debug{Begin SLC}%
  \begingroup
  \caption@singleline
  \let\caption@hj\@empty
  \caption@calcmargin % calculate #3 if necessary
  \caption@prepareslc
  \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
  \ifdim\wd\@tempboxa>#3%
    \endgroup
  \else
    \endgroup
    \caption@singleline
    #4%
  \fi
  \caption@Debug{End SLC}}
\newcommand*\caption@singleline{%
  \caption@xsetup\caption@opt@singleline
  \let\caption@fmt\caption@slfmt}
\newcommand*\caption@prepareslc{%
  \let\@footnotetext\@gobble\let\@endnotetext\@gobble
  \def\label{\caption@withoptargs\@gobbletwo}%
  \let\stepcounter\caption@l@stepcounter
  \let\refstepcounter\stepcounter\let\H@refstepcounter\stepcounter}
\newcommand*\caption@l@stepcounter[1]{\advance\csname c@#1\endcsname\@ne\relax}
\newcommand*\caption@parbox{\parbox[b]}
\newcommand\caption@@@make[2]{%
  \sbox\@tempboxa{#1}%
  \ifdim\wd\@tempboxa=\z@
    \let\caption@lsep\relax
  \fi
  \caption@ifempty{#2}{%
    \let\caption@lsep\relax
  }%
  \@setpar{\@@par\caption@@par}\caption@@par
  \caption@hj\captionfont\captionsize\caption@fmt
    {\ifcaption@star\else{\captionlabelfont#1}\fi}%
    {\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}%
    {{\captiontextfont
      \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}%
      \nobreak\hskip\z@skip % enable hyphenation
      \caption@tfmt{#2}%
      \caption@ifstrut{\ifhmode\@finalstrut\strutbox\fi}{}%
      \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{%
  \@testopt\@DeclareCaptionType{}}
\@onlypreamble\DeclareCaptionType
\def\@DeclareCaptionType[#1]#2{%
  \def\caption@type{#2}%
  \caption@Debug{New type `#2'}%
  \newcounter{#2}\@namedef{theH#2}{}%
  \KV@caption@DCT@within\caption@within@default
  \caption@DeclareWithinOption{#2}%
  \KV@caption@DCT@placement{tbp}%
  \@ifundefined{c@float@type}%
    {\newcounter{float@type}%
     \setcounter{float@type}{\@ifundefined{c@figure}14}}%
    {}%
  \caption@Debug{float type `#2'=\the\value{float@type}}%
  \expandafter\xdef\csname ftype@#2\endcsname{\the\value{float@type}}%
  \addtocounter{float@type}{\value{float@type}}%
  \KV@caption@DCT@fileext{lo#2}%
  \@namedef{fnum@#2}{\@nameuse{#2name}\nobreakspace\@nameuse{the#2}}%
  \newenvironment{#2}{\@float{#2}}{\end@float}%
  \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}%
  \expandafter\newcommand\csname listof#2s\endcsname{\caption@listof{#2}}%
  \@ifundefined{l@figure}%
    {\@namedef{l@#2}{\@dottedtocline{1}{1.5em}{2.3em}}}%
    {\expandafter\let\csname l@#2\endcsname\l@figure}%
  \expandafter\newcommand\csname #2name\endcsname{}%
  \edef\@tempa{\def\noexpand\@tempa{\@car#2\@nil}}%
  \uppercase\expandafter{\@tempa}%
  \edef\@tempb{\noexpand\g@addto@macro\noexpand\@tempa{\@cdr#2\@nil}}%
  \@tempb
  \expandafter\let\csname #2name\endcsname\@tempa
  \expandafter\newcommand\csname list#2name\endcsname{}%
  \expandafter\xdef\csname list#2name\endcsname{List of \@tempa s}%
  \@cons\caption@typelist{{#2}}%
  \caption@setkeys[caption]{caption@DCT}{#1}%
  \@ifundefined{float@exts}{\newtoks\float@exts}{}%
  \let\float@do=\relax
  \edef\@tempa{\noexpand\float@exts{\the\float@exts\float@do{\@nameuse{ext@#2}}}}%
  \@tempa
  \@ifundefined{float@addtolists}{%
    \newcommand\float@addtolists[1]{%
      \def\float@do####1{\addtocontents{####1}{##1}}\the\float@exts}%
    \@ifundefined{@chapter}{}{\caption@PatchChapter}}{}%
  \@ifnextchar[\@@DeclareCaptionType\relax}
\@onlypreamble\@DeclareCaptionType
\def\@@DeclareCaptionType[#1]{%
  \KV@caption@DCT@name{#1}%
  \@ifnextchar[\@@@DeclareCaptionType\relax}
\@onlypreamble\@@DeclareCaptionType
\def\@@@DeclareCaptionType[#1]{%
  \KV@caption@DCT@listname{#1}}
\@onlypreamble\@@@DeclareCaptionType
\let\DeclareFloatingEnvironment\DeclareCaptionType % old command name
\@onlypreamble\DeclareFloatingEnvironment
\newcommand*\caption@within@default{\@ifundefined{c@chapter}{none}{chapter}}
\@onlypreamble\caption@within@default
\newcommand*\caption@listof[1]{%
  \begingroup
    \expandafter\let\expandafter\listfigurename\csname list#1name\endcsname
    \expandafter\let\expandafter\ext@figure\csname ext@#1\endcsname
    \let\caption@ORI@starttoc\@starttoc
    \renewcommand*\@starttoc[1]{%
      \expandafter\caption@ORI@starttoc\expandafter{\ext@figure}}%
    \listoffigures
  \endgroup}
\newcommand*\caption@typelist{}
\define@key{caption@DCT}{fileext}{\@namedef{ext@\caption@type}{#1}}
\@onlypreamble@key{caption@DCT}{fileext}
\define@key{caption@DCT}{listname}{\@namedef{list\caption@type name}{#1}}
\@onlypreamble@key{caption@DCT}{listname}
\define@key{caption@DCT}{name}{\@namedef{\caption@type name}{#1}}
\@onlypreamble@key{caption@DCT}{name}
\define@key{caption@DCT}{placement}{\@namedef{fps@\caption@type}{#1}}
\@onlypreamble@key{caption@DCT}{placement}
\define@key{caption@DCT}{within}{%
  \@ifundefined{c@chapter}{}{\@removefromreset\caption@type{chapter}}%
  \@removefromreset\caption@type{section}%
  \begingroup
    \caption@setkeys[caption]{caption@within}{#1}%
  \endgroup}
\define@key{caption@DCT}{without}{\KV@caption@DCT@within{none}}
\define@key{caption@within}{none}[]{%
  \caption@within{}{}}
\define@key{caption@within}{section}[]{%
  \@addtoreset\caption@type{section}%
  \caption@within{\ifnum\c@section>\z@ \thesection.\fi}{\theHsection.}}
\@ifundefined{c@chapter}{}{%
  \define@key{caption@within}{chapter}[]{%
    \@addtoreset\caption@type{chapter}%
    \caption@within{\ifnum\c@chapter>\z@ \thechapter.\fi}{\theHchapter.}}
}%  \@onlypreamble@key{caption@within}{chapter}}
\newcommand*\caption@within{%
  \expandafter\caption@within@\expandafter{\caption@type}}
\newcommand*\caption@within@[3]{%
  \global\@namedef{the#1}{#2\arabic{#1}}%
  \@ifundefined{theH#1}\caption@AtBeginDocument\@firstofone
    {\global\@namedef{theH#1}{#3\arabic{#1}}}}
\providecommand*\@removefromreset[2]{{%
  \expandafter\let\csname c@#1\endcsname\@removefromreset
  \def\@elt##1{%
    \expandafter\ifx\csname c@##1\endcsname\@removefromreset
    \else
      \noexpand\@elt{##1}%
    \fi}%
  \expandafter\xdef\csname cl@#2\endcsname{%
    \csname cl@#2\endcsname}}}
\newcommand*\caption@PatchChapter{%
  \providecommand*\@chapterlistsgap{10\p@}%
  % report.cls [2005/09/16 v1.4f Standard LaTeX document class]
  \caption@patch@chapter{report}{%
    \ifnum \c@secnumdepth >\m@ne
      \refstepcounter{chapter}%
      \typeout{\@chapapp\space\thechapter.}%
      \addcontentsline{toc}{chapter}%
        {\protect\numberline{\thechapter}##1}%
    \else
      \addcontentsline{toc}{chapter}{##1}%
    \fi
    \chaptermark{##1}%
    \addtocontents{lof}{\protect\addvspace{10\p@}}%
    \addtocontents{lot}{\protect\addvspace{10\p@}}%
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]%
    \else
      \@makechapterhead{##2}%
      \@afterheading
    \fi
  }{%
    \ifnum \c@secnumdepth >\m@ne
      \refstepcounter{chapter}%
      \typeout{\@chapapp\space\thechapter.}%
      \addcontentsline{toc}{chapter}%
        {\protect\numberline{\thechapter}##1}%
    \else
      \addcontentsline{toc}{chapter}{##1}%
    \fi
    \chaptermark{##1}%
    \ifdim \@chapterlistsgap>\z@
      \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
      \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
      \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
    \fi
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]%
    \else
      \@makechapterhead{##2}%
      \@afterheading
    \fi}%
  % book.cls [2005/09/16 v1.4f Standard LaTeX document class]
  \caption@patch@chapter{book}{%
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \refstepcounter{chapter}%
        \typeout{\@chapapp\space\thechapter.}%
        \addcontentsline{toc}{chapter}%
          {\protect\numberline{\thechapter}##1}%
      \else
        \addcontentsline{toc}{chapter}{##1}%
      \fi
    \else
      \addcontentsline{toc}{chapter}{##1}%
    \fi
    \chaptermark{##1}%
    \addtocontents{lof}{\protect\addvspace{10\p@}}%
    \addtocontents{lot}{\protect\addvspace{10\p@}}%
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]%
    \else
      \@makechapterhead{##2}%
      \@afterheading
    \fi
  }{%
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \refstepcounter{chapter}%
        \typeout{\@chapapp\space\thechapter.}%
        \addcontentsline{toc}{chapter}%
          {\protect\numberline{\thechapter}##1}%
      \else
        \addcontentsline{toc}{chapter}{##1}%
      \fi
    \else
      \addcontentsline{toc}{chapter}{##1}%
    \fi
    \chaptermark{##1}%
    \ifdim \@chapterlistsgap>\z@
      \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
      \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
      \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
    \fi
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]%
    \else
      \@makechapterhead{##2}%
      \@afterheading
    \fi}%
  % amsbook.cls [2004/08/06 v2.20]
  % smfbook.cls [1999/11/15 v1.2f Classe LaTeX pour les monographies editees par la SMF]
  \caption@patch@chapter{ams/smfbook}{%
    \refstepcounter{chapter}%
    \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty
    \else \let\@secnumber\thechapter \fi
    \typeout{\chaptername\space\@secnumber}%
    \def\@toclevel{0}%
    \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{##2}%
    \else \@tocwriteb\tocchapter{chapter}{##2}\fi
    \chaptermark{##1}%
    \addtocontents{lof}{\protect\addvspace{10\p@}}%
    \addtocontents{lot}{\protect\addvspace{10\p@}}%
    \@makechapterhead{##2}\@afterheading
  }{%
    \refstepcounter{chapter}%
    \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty
    \else \let\@secnumber\thechapter \fi
    \typeout{\chaptername\space\@secnumber}%
    \def\@toclevel{0}%
    \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{##2}%
    \else \@tocwriteb\tocchapter{chapter}{##2}\fi
    \chaptermark{##1}%
    \ifdim \@chapterlistsgap>\z@
      \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
      \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
      \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
    \fi
    \@makechapterhead{##2}\@afterheading}%
  % scrreprt/scrbook.cls
  \@ifundefined{KOMAClassName}{}{%
    \caption@Debug{document class `\KOMAClassName' detected}%
   \let\caption@patch@chapter\@gobblethree}%
  % rapport1/3.cls [2004/06/07 v2.1a NTG LaTeX document class]
  \caption@patch@chapter{rapport}{%
    \ifnum \c@secnumdepth >\m@ne
      \refstepcounter{chapter}%
      \typeout{\@chapapp\space\thechapter.}%
      \addcontentsline{toc}{chapter}%
        {\protect\numberline{\thechapter}\toc@font0 ##1}%
    \else
      \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
    \fi
    \chaptermark{##1}%
    \addtocontents{lof}{\protect\addvspace{10\p@}}%
    \addtocontents{lot}{\protect\addvspace{10\p@}}%
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]%
    \else
      \@makechapterhead{##2}%
      \@afterheading
    \fi
  }{%
    \ifnum \c@secnumdepth >\m@ne
      \refstepcounter{chapter}%
      \typeout{\@chapapp\space\thechapter.}%
      \addcontentsline{toc}{chapter}%
        {\protect\numberline{\thechapter}\toc@font0 ##1}%
    \else
      \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
    \fi
    \chaptermark{##1}%
    \ifdim \@chapterlistsgap>\z@
      \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
      \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
      \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
    \fi
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]%
    \else
      \@makechapterhead{##2}%
      \@afterheading
    \fi}%
  % boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class]
  \caption@patch@chapter{boek}{%
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \refstepcounter{chapter}%
        \typeout{\@chapapp\space\thechapter.}%
        \addcontentsline{toc}{chapter}%
          {\protect\numberline{\thechapter}\toc@font0 ##1}%
      \else
        \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
      \fi
    \else
      \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
    \fi
    \chaptermark{##1}%
    \addtocontents{lof}{\protect\addvspace{10\p@}}%
    \addtocontents{lot}{\protect\addvspace{10\p@}}%
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]%
    \else
      \@makechapterhead{##2}%
      \@afterheading
    \fi
  }{%
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \refstepcounter{chapter}%
        \typeout{\@chapapp\space\thechapter.}%
        \addcontentsline{toc}{chapter}%
          {\protect\numberline{\thechapter}\toc@font0 ##1}%
      \else
        \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
      \fi
    \else
      \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
    \fi
    \chaptermark{##1}%
    \ifdim \@chapterlistsgap>\z@
      \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
      \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
      \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
    \fi
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]%
    \else
      \@makechapterhead{##2}%
      \@afterheading
    \fi}%
  % thesis.cls [1996/25/01 1.0g LaTeX document class (wm).]
  \caption@patch@chapter{thesis}{%
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \refstepcounter{chapter}%
        \typeout{\chaptername\space\thechapter.}
        \if@thema
          \ifx\@shortauthor\@empty
            \addcontentsline{toc}{chapter}{%
            \protect\numberline{\thechapter.}##1}%
          \else
            \addcontentsline{toc}{chapter}{%
            \protect\numberline{\thechapter.}%
            \@shortauthor\hfill\mbox{}\vskip\normallineskip ##1}%
          \fi
        \else
          \addcontentsline{toc}{chapter}{%
          \protect\numberline{\thechapter.}##1}%
        \fi
      \else
        \addcontentsline{toc}{chapter}{##1}
      \fi
    \else
      \addcontentsline{toc}{chapter}{##1}
    \fi
    \chaptermark{##1}
    \addtocontents{lof}{\protect\addvspace{10pt}}
    \addtocontents{lot}{\protect\addvspace{10pt}}
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]
    \else
      \@makechapterhead{##2}
      \@afterheading
    \fi
  }{%
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \refstepcounter{chapter}%
        \typeout{\chaptername\space\thechapter.}%
        \if@thema
          \ifx\@shortauthor\@empty
            \addcontentsline{toc}{chapter}{%
            \protect\numberline{\thechapter.}##1}%
          \else
            \addcontentsline{toc}{chapter}{%
            \protect\numberline{\thechapter.}%
            \@shortauthor\hfill\mbox{}\vskip\normallineskip ##1}%
          \fi
        \else
          \addcontentsline{toc}{chapter}{%
          \protect\numberline{\thechapter.}##1}%
        \fi
      \else
        \addcontentsline{toc}{chapter}{##1}%
      \fi
    \else
      \addcontentsline{toc}{chapter}{##1}%
    \fi
    \chaptermark{##1}%
    \ifdim \@chapterlistsgap>\z@
      \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
      \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
      \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
    \fi
    \if@twocolumn
      \@topnewpage[\@makechapterhead{##2}]%
    \else
      \@makechapterhead{##2}%
      \@afterheading
    \fi}%
  \ifx\caption@patch@chapter\@gobblethree \else
    \caption@Debug{%
      Unsupported document class detected,\MessageBreak
      or \noexpand\@chapter was redefined by another package}%
  \fi
  \let\caption@PatchChapter\@undefined}
\newcommand\caption@patch@chapter[3]{%
  \begingroup
    \let\if@mainmatter\iffalse
    \let\if@thema\iffalse
    \def\@tempa[##1]##2{#2}%
    \ifx\@tempa\@chapter
      \caption@Debug{document class `#1' detected}%
      \gdef\@chapter[##1]##2{#3}%
      \global\let\caption@patch@chapter\@gobblethree
    \fi
  \endgroup}
\long\def \@gobblethree #1#2#3{}
\newcommand*\caption@patch@stpelt{%
  \let\caption@stpelt\@stpelt
  \def\@stpelt##1{%
    \caption@stpelt{##1}%
    \begingroup
      \let\@elt\caption@stpelt
      \csname caption@cl@##1\endcsname
    \endgroup}%
  \let\caption@patch@stpelt\relax}
\@onlypreamble\caption@patch@stpelt
\newcommand*\caption@addtoreset[2]{%
  \caption@patch@stpelt
  \@ifundefined{caption@cl@#2}{\@namedef{caption@cl@#2}{}}{}%
  \expandafter\@cons\csname caption@cl@#2\endcsname{{#1}}}
\@onlypreamble\caption@addtoreset
\newcommand*\caption@removefromreset[2]{%
  \begingroup
    \expandafter\let\csname c@#1\endcsname\caption@removefromreset
    \def\@elt##1{%
      \expandafter\ifx\csname c@##1\endcsname\caption@removefromreset
      \else
        \noexpand\@elt{##1}%
      \fi}%
    \expandafter\xdef\csname caption@cl@#2\endcsname{%
      \csname caption@cl@#2\endcsname}%
  \endgroup}
\@onlypreamble\caption@removefromreset
\newcommand*\DeclareCaptionSubType{%
  \caption@teststar\@DeclareCaptionSubType\@firstoftwo\@secondoftwo}
\@onlypreamble\DeclareCaptionSubType
\newcommand*\@DeclareCaptionSubType[1]{%
  \@testopt{\@@DeclareCaptionSubType{#1}}{alph}}
\@onlypreamble\@DeclareCaptionSubType
\def\@@DeclareCaptionSubType#1[#2]#3{%
  \@ifundefined{c@#3}%
    {\caption@Error{No float type '#3' defined}}%
    {\@ifundefined{c@sub#3}%
       {\caption@Debug{New subtype `sub#3'}%
        \newcounter{sub#3}%
        \caption@addtoreset{sub#3}{#3}%
        \@namedef{ext@sub#3}{\csname ext@#3\endcsname}%
        \@ifundefined{l@chapter}%
          {\edef\@tempa{\expandafter\expandafter\expandafter\noexpand
                        \expandafter\@car\l@subsubsection\@nil}%
           \def\@tempb{\@dottedtocline}%
           \ifx\@tempa\@tempb % \l@subsubsection starts with \@dottedtocline
             \expandafter\edef\csname l@sub#3\endcsname{%
               \noexpand\@dottedtocline{2}%
               \expandafter\expandafter\expandafter\noexpand
               \expandafter\@gobbletwo\l@subsubsection}%
           \else
             \@namedef{l@sub#3}{\@dottedtocline{2}{3.8em}{3.2em}}%
           \fi}%
          {\expandafter\let\csname l@sub#3\endcsname\l@subsection}%
        \@cons\caption@subtypelist{{#3}}}%
       {\caption@Debug{Modify caption `sub#3'}}%
     \@namedef{sub#3name}{}%
     \@namedef{sub#3autorefname}{\csname #3name\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\@@DeclareCaptionSubType
\newcommand*\caption@subtypelist{}
\newcommand*\caption@For{\caption@withoptargs\caption@@For}
\newcommand\caption@@For[3]{%
  \caption@AtBeginDocument#1{%
    \def\@elt##1{#3}%
    \@nameuse{caption@#2}%
    \let\@elt\relax}}%
\caption@AtBeginDocument{%
  \def\@tempa{\@ifstar\sf@@subref\sf@subref}%
  \ifx\subref\@tempa
    \PackageInfo{caption3}{subfig package 1.2 or 1.3 is loaded\@gobble}%
    \let\caption@setfloattype\@gobble
    \let\@dottedxxxline\sf@NEW@dottedxxxline
    \let\sf@subfloat\sf@NEW@subfloat
    \DeclareRobustCommand*\subref{\@ifstar\sf@@subref\sf@subref}%
    \@ifpackageloaded{hyperref}{%
      \renewcommand*\sf@updatecaptionlist[4]{%
        \xdef\sf@captionlist{%
          \sf@captionlist,%
              {\protect\numberline{\@subcaplabel}\noexpand{\ignorespaces #2}}%
              {\@currentHref}}}%
    }{}%
  \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
    \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]}}
\endinput
%%
%% End of file `caption3.sty'.

