%%
%% This is file `ctable.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ctable.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from ctable.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file ctable.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%% File: ctable.dtx
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ctable}
        [2002/07/16 v1.3 LaTeX package ctable]
\RequirePackage{keyval,array,tabularx,booktabs}

\def\NN{\tabularnewline}
\def\FL{\toprule}
\def\ML{\NN\midrule}
\def\LL{\NN\bottomrule}

\newcommand{\tnote}[2][a]{%
  \hbox{\@textsuperscript{\normalfont\textit{#1}}}&#2\NN}
\newcommand{\tmark}[1][a]{%
  \hbox{\@textsuperscript{\normalfont\textit{#1}}}}

\define@key{ctbl}{caption} {\def\ctblcaption{#1}}
\define@key{ctbl}{cap}     {\def\ctblcap    {#1}}
\define@key{ctbl}{label}   {\def\ctbllabel  {#1}}
\define@key{ctbl}{pos}     {\def\ctblbegin  {\ctblbeg[#1]}}
\define@key{ctbl}{width}   {\def\ctblwidth  {#1}}
\define@key{ctbl}{botcap}[]{\def\ctblbotcap {1}}
\define@key{ctbl}{figure}[]{\def\ctblbeg{\begin{figure}}%
                            \def\ctblend{\end{figure}}}

\def\ctblCaption{
  \ifx\ctblcap\empty\let\ctblcap\ctblcaption\fi%
  \ifx\ctblcaption\empty\else
    \caption[\ctblcap]{\label{\ctbllabel}\ctblcaption}
  \fi
}
\newbox\ctbl@tabel

\newcommand{\ctable}[4][]{%
  \def\ctblcaption {}%
  \def\ctblcap     {}%
  \def\ctbllabel   {}%
  \def\ctblbeg     {\begin{table}}%
  \def\ctblbegin   {\ctblbeg}%
  \def\ctblend     {\end{table}}%
  \def\ctblwidth   {}%
  \def\ctblbotcap  {}%
  \setkeys{ctbl}{#1}%
  % save the table contents in a box, so we can determine its width:
  \sbox\ctbl@tabel{%
    \ifx\ctblwidth\empty
      \begin{tabular}{#2}%
        #4%
      \end{tabular}%
    \else
      \begin{tabularx}{\ctblwidth}{#2}%
        #4%
      \end{tabularx}%
    \fi
  }%
  \ctblbegin
    \begin{center}%
      \begin{minipage}{\wd\ctbl@tabel}%
        \ifx\ctblbotcap\empty\ctblCaption\vspace{2ex}\fi
        \usebox\ctbl@tabel % insert the tabular
        \def\ctblfootnotes{#3}%
        \ifx#3\empty\else % append footnotes, if any
           \\%
           \begin{tabularx}{\hsize}{r@{\,}>{\footnotesize\raggedright}X}%
           #3%
           \end{tabularx}%
        \fi
        \ifx\ctblbotcap\empty\else\ctblCaption\fi
      \end{minipage}%
    \end{center}%
  \ctblend%
}
\endinput
%%
%% End of file `ctable.sty'.
