%%
%% This is file `ctable.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ctable.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2005 by Wybo Dekker <wybo@dekkerdocumenten.nl>
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX version
%% 1999/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{ctable}
    [2013/06/15 v1.26 ctable package for \
     flexible typesetting of table and figure floats using key/value directives]
\RequirePackage{ifpdf,xcolor,xkeyval,array,tabularx,booktabs,rotating}
\ifpdf
  \RequirePackage{transparent}
\else
  \PackageWarningNoLine{ctable}{\MessageBreak
    Transparency disabled: pdfTeX is not running in PDF mode
  }
  \def\transparent#1{}
\fi
\def\NN{\tabularnewline}
\def\FL{\toprule}
\def\ML{\NN\midrule}
\def\LL{\NN\bottomrule}
\def\@defaultctblfgcolor#1 #2 #3={\definecolor{@defaultctblframefg}{rgb}{#1,#2,#3}}
\def\@defaultctblbgcolor#1 #2 #3={\definecolor{@defaultctblframebg}{rgb}{#1,#2,#3}}
\def\@ctblfgcolor#1 #2 #3={%
  \definecolor{@ctblframefg}{rgb}{#1,#2,#3}
  \def\@ctblfgactual{@ctblframefg}}
\def\@ctblbgcolor#1 #2 #3={%
  \definecolor{@ctblframebg}{rgb}{#1,#2,#3}
  \def\@ctblbgactual{@ctblframebg}}
\def\@ctbltextsuperscript#1{%
  \ifx\@ctblsuper\@ctbltrue\@textsuperscript{#1}\else{\footnotesize#1}\fi
}
\def\@ctbltrue{1}
\def\@ctblfalse{0}
\def\@ctbldoinside{\relax}
\newif\if@ctblusex
\newif\if@ctblinmemoir
\newif\if@ctblhascaption
\@ifclassloaded{memoir}{\@ctblinmemoirtrue}{\@ctblinmemoirfalse}
\@ifpackageloaded{caption}{\@ctblhascaptiontrue}{\@ctblhascaptionfalse}
\newdimen\@ctblframesep         \newdimen\@defaultctblframesep
\newdimen\@ctblframerule        \newdimen\@defaultctblframerule
\newdimen\@ctblwidth            \newdimen\@defaultctblwidth
\newdimen\@ctblcaptionskip      \newdimen\@defaultctblcaptionskip
\newdimen\@ctblmaxwidth         \newdimen\@defaultctblmaxwidth
\newdimen\@ctblmincapwidth      \newdimen\@defaultctblmincapwidth
\newdimen\@ctblfooterwidth      \newdimen\@defaultctblfooterwidth
\newdimen\@ctblw % the final width
\newdimen\@ctblfloatwidth
\newdimen\@ctbloldsep
\newdimen\@ctbloldrule
\newbox\ctbl@t          % tabular saved and measured here

\define@key{suctbl}{bgopacity}{\def\@defaultctblbgopacity{#1}}
\define@key{suctbl}{botcap}[]{\let\@defaultctblbotcap\@ctbltrue}
\define@key{suctbl}{captionsinside}[]{\def\rot@LR{-1}
                                      \if@twoside\@rot@twosidetrue
                                      \else\@rot@twosidefalse\fi}
\define@key{suctbl}{captionsleft}[]{\@rot@twosidefalse\def\rot@LR{-1}}
\define@key{suctbl}{captionsright}[]{\@rot@twosidefalse\def\rot@LR{0}}
\define@key{suctbl}{captionskip}{\@defaultctblcaptionskip=#1}
\define@key{suctbl}{center}[]{\let\@defaultctblalign\centering}
\define@key{suctbl}{continued}{\def\@defaulttextcontinued{#1}}
\define@key{suctbl}{doinside}{\def\@defaultctbldoinside{#1}}
\define@key{suctbl}{figure}[]{\def\@defaultctbltaborfig{figure}}
\define@key{suctbl}{framebg}{\@defaultctblbgcolor#1=}
\define@key{suctbl}{framefg}{\@defaultctblfgcolor#1=}
\define@key{suctbl}{framerule}{\@defaultctblframerule=#1}
\define@key{suctbl}{framesep}{\@defaultctblframesep=#1}
\define@key{suctbl}{left}[]{\let\@defaultctblalign\raggedright}
\define@key{suctbl}{maxwidth}{\@defaultctblmaxwidth=#1}
\define@key{suctbl}{mincapwidth}{\@defaultctblmincapwidth=#1}
\define@key{suctbl}{footerwidth}[-1pt]{\@defaultctblfooterwidth=#1}
\define@key{suctbl}{nonotespar}[]{\let\@defaultctblnotespar\@ctblfalse}
\define@key{suctbl}{nosideways}[]{\let\@defaultctblsideways\empty}
\define@key{suctbl}{nostar}[]{\def\@defaultctblstarred{}}
\define@key{suctbl}{nosuper}[]{\let\@defaultctblsuper\@ctblfalse}
\define@key{suctbl}{notespar}[]{\let\@defaultctblnotespar\@ctbltrue}
\define@key{suctbl}{pos}{\def\@defaultctblpos{#1}}
\define@key{suctbl}{right}[]{\let\@defaultctblalign\raggedleft}
\define@key{suctbl}{sideways}[]{\def\@defaultctblsideways{sideways}}
\define@key{suctbl}{star}[]{\def\@defaultctblstarred{*}}
\define@key{suctbl}{super}[]{\let\@defaultctblsuper\@ctbltrue}
\define@key{suctbl}{table}[]{\def\@defaultctbltaborfig{table}}
\define@key{suctbl}{topcap}[]{\let\@defaultctblbotcap\@ctblfalse}
\define@key{suctbl}{width}{\@defaultctblwidth=#1}

\newcommand{\setupctable}[1]{\setkeys{suctbl}{#1}}
\setupctable{
  bgopacity=1,
  captionskip=0pt,
  center,
  continued=(continued),
  doinside={},
  footerwidth=0pt,
  framebg=1 1 1,
  framefg=0 0 0,
  framerule=0pt,
  framesep=0pt,
  maxwidth=0pt,
  mincapwidth=0pt,
  nonotespar,
  nosideways,
  nostar,
  super,
  table,
  topcap,
  width=0pt,
}

\define@key{ctbl}{bgopacity}{\def\@ctblbgopacity{#1}}
\define@key{ctbl}{botcap}[]{\let\@ctblbotcap\@ctbltrue}
\define@key{ctbl}{captionskip}{\@ctblcaptionskip=#1}
\define@key{ctbl}{caption}{\def\@ctblcaption{#1}}
\define@key{ctbl}{cap}{\def\@ctblcap{#1}}
\define@key{ctbl}{center}[]{\let\@ctblalign\centering}
\define@key{ctbl}{continued}[\@defaulttextcontinued]{\def\@ctblcontinued{#1}}
\define@key{ctbl}{doinside}{\def\@ctbldoinside{#1}}
\define@key{ctbl}{figure}[]{\def\@ctbltaborfig{figure}}
\define@key{ctbl}{framebg}{\@ctblbgcolor#1=}
\define@key{ctbl}{framefg}{\@ctblfgcolor#1=}
\define@key{ctbl}{framerule}{\@ctblframerule=#1}
\define@key{ctbl}{framesep}{\@ctblframesep=#1}
\define@key{ctbl}{label}{\def\@ctbllabel{#1}}
\define@key{ctbl}{left}[]{\let\@ctblalign\raggedright}
\define@key{ctbl}{maxwidth}{\@ctblmaxwidth=#1}
\define@key{ctbl}{mincapwidth}{\@ctblmincapwidth=#1}
\define@key{ctbl}{footerwidth}[-1pt]{\@ctblfooterwidth=#1}
\define@key{ctbl}{nonotespar}[]{\let\@ctblnotespar\@ctblfalse}
\define@key{ctbl}{nosideways}[]{\let\@ctblsideways\empty}
\define@key{ctbl}{nostar}[]{\def\@ctblstarred{}}
\define@key{ctbl}{nosuper}[]{\let\@ctblsuper\@ctblfalse}
\define@key{ctbl}{notespar}[]{\let\@ctblnotespar\@ctbltrue}
\define@key{ctbl}{pos}{\def\@ctblpos{#1}\def\@ctblbegin{\@ctblbeg[#1]}}
\define@key{ctbl}{right}[]{\let\@ctblalign\raggedleft}
\define@key{ctbl}{sidecap}[]{\let\@ctblbotcap\undefined}
\define@key{ctbl}{sideways}[]{\def\@ctblsideways{sideways}}
\define@key{ctbl}{star}[]{\def\@ctblstarred{*}}
\define@key{ctbl}{super}[]{\let\@ctblsuper\@ctbltrue}
\define@key{ctbl}{table}[]{\def\@ctbltaborfig{table}}
\define@key{ctbl}{topcap}[]{\let\@ctblbotcap\@ctblfalse}
\define@key{ctbl}{width}{\@ctblwidth=#1}
\newcommand{\ctbl@expandonce}[1]{\unexpanded\expandafter{#1}}
\def\@ctblCaption{
   \ifx\@ctblcaption\empty\else
      \def\@ctblcaptionarg{\ifx\@ctbllabel\empty\else\label{\@ctbllabel}\fi
         \@ctblcaption\ \@ctblcontinued\strut}
      \begingroup
        \ifx\@ctblcap\empty
          \edef\x{\endgroup\noexpand\caption[]{\ctbl@expandonce\@ctblcaptionarg}}
        \else
        \edef\x{\endgroup\noexpand\caption[\ctbl@expandonce\@ctblcap]%
                                          {\ctbl@expandonce\@ctblcaptionarg}}
        \fi
      \x
   \fi
}
\newcolumntype{Y}{X}
\def\@ctblXcolumntype#1{%
  \let\NC@find@X\undefined
  \newcolumntype{X}{#1}%
}
\long\def\@ctblframe#1#2#3{%
   \@ctbloldsep\fboxsep\fboxsep\@ctblframesep%
   \@ctbloldrule\fboxrule\fboxrule\@ctblframerule%
   \transparent{\@ctblbgopacity}%
   \fcolorbox{#1}{#2}{\fboxsep\@ctbloldsep\fboxrule\@ctbloldrule\transparent{1}#3}%
}
\newcommand{\tnote}[2][a]{%
   \ifx\@ctblnotespar\@ctbltrue%
     \@ctbltextsuperscript{\normalfont\textit{#1}}\,#2
   \else%
     \hbox{\@ctbltextsuperscript{\normalfont\textit{#1}}}&#2\NN
   \fi
}
\newcommand{\tmark}[1][a]{%
   \hbox{\textsuperscript{\normalfont\textit{#1}}}}
\newdimen\@ctblcurftwidth
\newcommand{\ctable}[4][]{%
   \let\@ctbltaborfig  \@defaultctbltaborfig
   \let\@ctblalign     \@defaultctblalign
   \let\@ctblsideways  \@defaultctblsideways
   \let\@ctblcontinued \empty
   \let\@ctblpos       \@defaultctblpos
   \let\@ctblcaption   \empty
   \let\@ctblcap       \undefined
   \let\@ctbllabel     \empty
   \let\@ctblbotcap    \@defaultctblbotcap
   \let\@ctblstarred   \@defaultctblstarred
   \let\@ctblsuper     \@defaultctblsuper
   \let\@ctblnotespar  \@defaultctblnotespar
   \let\@ctbldoinside  \@defaultctbldoinside
   \let\@ctblbgopacity \@defaultctblbgopacity
   \@ctblframerule     \@defaultctblframerule
   \@ctblcaptionskip   \@defaultctblcaptionskip
   \@ctblframesep      \@defaultctblframesep
   \@ctblwidth         \@defaultctblwidth
   \@ctblmaxwidth      \@defaultctblmaxwidth
   \@ctblmincapwidth   \@defaultctblmincapwidth
   \@ctblfooterwidth   \@defaultctblfooterwidth
   \def\@ctblfgactual {@defaultctblframefg}
   \def\@ctblbgactual {@defaultctblframebg}
   \def\@ctblbeg      {\begin{\@ctblsideways\@ctbltaborfig\@ctblstarred}}
   \def\@ctblbegin    {\@ctblbeg}
   \def\@ctblend      {\end{\@ctblsideways\@ctbltaborfig\@ctblstarred}}
   \setkeys{ctbl}{#1}
   \ifx\@ctblcap\undefined\let\@ctblcap\@ctblcaption\fi
   \ifx\@ctblcap\empty
     \if@ctblhascaption\else
       \PackageWarningNoLine{ctable}{\MessageBreak
          An empty cap= option prevents lot/loc entry only\MessageBreak
          if the caption package is loaded!}
     \fi
   \fi
   \if@ctblinmemoir\else
      \ifx\@ctblbotcap\undefined
         \PackageError{ctable}{\MessageBreak
            You can, currently, use the sidecap option only with memoir documents\MessageBreak
            Use topcap or botcap only}
      \fi
   \fi
   \ifdim\@ctblwidth=0pt\else
      \ifdim\@ctblmaxwidth=0pt\else
         \PackageError{ctable}{\MessageBreak
            You may not use the width and maxwidth options together\MessageBreak
            Use either width or maxwidth}
      \fi
   \fi
   \ifx\@ctblpos\empty
      \ifx\@ctblsideways\empty\else
      \PackageError{ctable}{\MessageBreak
         You may not use the pos and sideways options together\MessageBreak
         Rotated tables and figures are always typeset on a separate page}
      \fi
   \fi
   \ifx\@ctblcaption\empty
      \ifx\@ctbllabel\empty\else
         \PackageError{ctable}{\MessageBreak
            You may not label a captionless table\MessageBreak
            Such a label can't be referenced}
      \fi
   \fi
   \sbox\ctbl@t{%
      \@ctblXcolumntype{l}% temporarily make  type X = l
      \@ctblframe{\@ctblfgactual}{\@ctblbgactual}{%
         \@ctbldoinside
         \begin{tabular}{#2}
            #4%
         \end{tabular}%
      }%
   }%
   \@ctblusexfalse
   \ifdim\@ctblmaxwidth=0pt
      \ifdim\@ctblwidth=0pt
      \else
         \@ctblusextrue
      \fi
   \else
      \ifdim\wd\ctbl@t>\@ctblmaxwidth
         \@ctblusextrue
      \fi
   \fi
   \if@ctblusex
      \sbox\ctbl@t{%
         \@ctblXcolumntype{Y}% restore X
         \@ctblframe{\@ctblfgactual}{\@ctblbgactual}{%
            \@ctbldoinside
            \begin{tabularx}{\ifdim\@ctblwidth>0pt\@ctblwidth\else\@ctblmaxwidth\fi}{#2}
               #4%
            \end{tabularx}%
         }%
      }%
   \fi
   \@ctblw=\wd\ctbl@t
   \@ctblfloatwidth=\ifdim\@ctblmincapwidth>\@ctblw
      \@ctblmincapwidth
   \else
      \@ctblw
   \fi
   \@ctblbegin
      \ifx\@ctblcontinued\empty\else\addtocounter{\@ctbltaborfig}{-1}\fi
      \@ctblalign
      \begin{minipage}{\@ctblfloatwidth}\parindent0pt
         \ifx\@ctblbotcap\@ctblfalse\@ctblCaption\vskip\@ctblcaptionskip\fi
         \ifx\@ctblbotcap\undefined\begin{sidecaption}[\@ctblcap]{\@ctblcaption}[ label ]\fi
         \centering{\usebox\ctbl@t} % insert the tabular
         \def\@ctblfootnotes{#3}%
         \ifx#3\empty\else{% append footnotes, if any
            \@ctblcurftwidth=\ifdim\@ctblfooterwidth=-1pt\@ctblw\else
                                \ifdim\@ctblfooterwidth=0pt\hsize\else
                                \@ctblfooterwidth\fi\fi
            \footnotesize
            \ifx\@ctblnotespar\@ctbltrue%
               \\[.2ex]
               \begin{minipage}{\@ctblcurftwidth}%
                  #3%
               \end{minipage}%
            \else%
               \\
               \begin{tabularx}{\@ctblcurftwidth}{r@{\,}>{\raggedright}X}
                  #3%
               \end{tabularx}%
            \fi
         }
         \fi
         \ifx\@ctblbotcap\undefined\end{sidecaption}\fi
         \ifx\@ctblbotcap\@ctbltrue\vskip\@ctblcaptionskip\@ctblCaption\fi
      \end{minipage}
   \@ctblend
}
\endinput
%%
%% End of file `ctable.sty'.
