%% The LaTeX package tcolorbox - version 4.12 (2018/01/12)
%% tcbxparse.code.tex: Code for xparse features
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2018 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot 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 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
%\makeatletter
\tcb@set@library@version{4.12}

\RequirePackage{xparse}[2013/12/31]

\tcbset{%
  IfNoValueTF/.code args={#1#2#3}{\IfNoValueTF{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}},
  IfValueTF/.code args={#1#2#3}{\IfValueTF{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}},
  IfBooleanTF/.code args={#1#2#3}{\IfBooleanTF{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}},
  verbatim/.style={fontupper=\ttfamily,nobeforeafter,tcbox raise base,top=0pt,bottom=0pt,left=1mm,right=1mm,boxrule=0.3mm}
}

%-- tcolorbox --
\long\def\tcb@New@TColorBox#1#2#3{%
  \tcb@newenvironment{#1}{#2}{\tcolorbox[#3,options@for=#1]}{\endtcolorbox}}

\def\DeclareTColorBox{%
  \let\tcb@newenvironment\DeclareDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

\def\NewTColorBox{%
  \let\tcb@newenvironment\NewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

\def\RenewTColorBox{%
  \let\tcb@newenvironment\RenewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

\def\ProvideTColorBox{%
  \let\tcb@newenvironment\ProvideDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

%-- tcolorbox (total) --
\long\def\tcb@New@TotalTColorBox#1#2#3#4{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\begin{tcolorbox}[#3,options@for=#1]#4\end{tcolorbox}}}

\def\DeclareTotalTColorBox{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

\def\NewTotalTColorBox{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

\def\RenewTotalTColorBox{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

\def\ProvideTotalTColorBox{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

%-- tcbox --
\long\def\tcb@New@TCBox#1#2#3{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcbox[#3,options@for=#1]}}

\def\DeclareTCBox{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

\def\NewTCBox{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

\def\RenewTCBox{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

\def\ProvideTCBox{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

%-- tcbox (total) --
\long\def\tcb@New@TotalTCBox#1#2#3#4{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcbox[#3,options@for=#1]{#4}}}

\def\DeclareTotalTCBox{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\def\NewTotalTCBox{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\def\RenewTotalTCBox{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\def\ProvideTotalTCBox{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\DeclareTotalTCBox{\tcboxverb}{ O{} v }{verbatim,#1}{#2}

%-- tcboxfit --
\long\def\tcb@New@TCBoxFit#1#2#3{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcboxfit[#3,options@for=#1]}}

\def\DeclareTCBoxFit{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\def\NewTCBoxFit{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\def\RenewTCBoxFit{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\def\ProvideTCBoxFit{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\long\def\tcb@New@TotalTCBoxFit#1#2#3#4{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcboxfit[#3,options@for=#1]{#4}}}

\def\DeclareTotalTCBoxFit{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}

\def\NewTotalTCBoxFit{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}

\def\RenewTotalTCBoxFit{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}

\def\ProvideTotalTCBoxFit{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}


%-- tcblisting --
\long\def\tcb@New@TCBListing#1#2#3{%
  \tcb@newenvironment{#1}{#2}{\tcblisting{#3,options@for=#1}}{\endtcblisting}}

\def\DeclareTCBListing{%
  \let\tcb@newenvironment\DeclareDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

\def\NewTCBListing{%
  \let\tcb@newenvironment\NewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

\def\RenewTCBListing{%
  \let\tcb@newenvironment\RenewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

\def\ProvideTCBListing{%
  \let\tcb@newenvironment\ProvideDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

%-- tcbinputlisting --
\long\def\tcb@New@TCBInputListing#1#2#3{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcbinputlisting{#3,options@for=#1}}%
}

\def\DeclareTCBInputListing{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}

\def\NewTCBInputListing{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}

\def\RenewTCBInputListing{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}

\def\ProvideTCBInputListing{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}


%-- sidebyside --

\def\tcb@sbs@content@none{\tcb@sbs@text@left\tcblower\tcb@sbs@text@right}
\def\tcb@sbs@content@left{\box\tcb@upperbox\tcblower\tcb@sbs@text@right}
\def\tcb@sbs@content@right{\tcb@sbs@text@left\tcblower\box\tcb@lowerbox}
\def\tcb@sbs@content@both{\box\tcb@upperbox\tcblower\box\tcb@lowerbox}

\tcbset{%
  sidebyside adapt/.is choice,
  sidebyside adapt/none/.style={%
    sidebyside@adapt@process/.style={%
      code={\let\tcb@sbs@content\tcb@sbs@content@none},
    }%
  },
  sidebyside adapt/left/.style={%
    sidebyside@adapt@process/.style={%
      code={\sbox{\tcb@upperbox}{\tcb@sbs@text@left}\let\tcb@sbs@content\tcb@sbs@content@left},
      lefthand width=\wd\tcb@upperbox,
    }%
  },
  sidebyside adapt/right/.style={%
    sidebyside@adapt@process/.style={%
      code={\sbox{\tcb@lowerbox}{\tcb@sbs@text@right}\let\tcb@sbs@content\tcb@sbs@content@right},
      righthand width=\wd\tcb@lowerbox,
    }%
  },
  sidebyside adapt/both/.style={%
    sidebyside@adapt@process/.style={%
      code={\sbox{\tcb@upperbox}{\tcb@sbs@text@left}\sbox{\tcb@lowerbox}{\tcb@sbs@text@right}\let\tcb@sbs@content\tcb@sbs@content@both},
      text width=\wd\tcb@upperbox+\kvtcb@sbs@gap+\wd\tcb@lowerbox,
      lefthand width=\wd\tcb@upperbox,
    }%
  },
  %
  sidebyside switch/.is choice,
  sidebyside switch/true/.style={%
    sidebyside@switch/.code={%
      \tcb@swap{\tcb@sbs@text@left}{\tcb@sbs@text@right}
    }%
  },
  sidebyside switch/false/.style={%
    sidebyside@switch/.style=%
  },
  sidebyside switch/.default=true
}


\DeclareTotalTColorBox{\tcbsidebyside}{ +O{} +m +m }{%
  code={\long\def\tcb@sbs@text@left{#2}\long\def\tcb@sbs@text@right{#3}},%
  #1,%
  sidebyside,%
  sidebyside@switch,sidebyside@adapt@process%
}{\tcb@sbs@content}


\tcbset{%
  reset@xparse/.style={%
    sidebyside adapt=none,sidebyside switch=false,%
  },
  initialize@reset=reset@xparse,
}
