% 3parttable.sty   (or threeparttable) (or 3parttab on DOS)
% by Donald Arseneau   Updated on Dec 9, 1996.
% 
% This package facilitates tables with titles (captions) and notes. The
% title and notes are given a width equal to the body of the table (a
% tabular environment).  By itself, a threeparttable does not float, but
% you can put it in a {table} or a {table*} or some other environment.
% (This causes extra typing, but gives more flexibility.)
%
% Inside a threeparttable there should be a caption, followed by a tabular
% environment, possibly followed by a series of itemized "tablenotes".  At
% present, there is nothing automatic about the notes; you must specify the
% identifier in the body of the table ("\tnote{a}") and in the notes below
% ("\item[a]...").  I chose this method because automatic numbering with
% \footnote would be very hard to use, particularly because many tables
% make repeated reference to a single note.  If someone has a suggestion
% for a convenient, elegant, automatic system, I'll listen!  \tnote
% commands can be given in the caption too, and they will *NOT* appear in
% the list of tables. 
% 
% \begin{table}
%  \begin{threeparttable}
%   \caption{...}
%   \begin{tabular}...% or {tabular*}
%    ...\tnote{1}&....
%    ...
%   \end{tabular}
%   \begin{tablenotes}
%    \item [1] the first note
%    ...
%   \end{tablenotes}
%  \end{threeparttable}
% \end{table}

\edef\endtablenotes % make a scratch macro for restoring catcodes
  {\catcode\string `\string @=\the\catcode\string`\@
   \catcode\string `\string *=\the\catcode\string`\*}
\catcode`\@=11
\catcode`\*=11

\@ifundefined{@tempboxb}{\@nameuse{newbox}\@tempboxb}{}

\newenvironment{threeparttable}{% 3 parts: title, tabular environment, notes
\relax \ifx\\\@centercr \leavevmode \fi
\vbox\bgroup\sloppy
\def\@captype{table}%
\topsep\z@
\@enumdepth\z@
\let\@caption\TPT@caption
\let\TPT@LA@tabular\tabular \let\TPT@LA@tabular*\tabular*
\def\tabular{\edef\TPT@evh{{\the\everyhbox}}\everyhbox{\aftergroup\TPT@endtab 
  \let\TPTrlap\rlap \everyhbox\TPT@evh}\TPT@LA@tabular}%
\def\tabular*{\edef\TPT@evh{{\the\everyhbox}}\everyhbox{\aftergroup\TPT@endtab 
  \let\TPTrlap\rlap \everyhbox\TPT@evh}\TPT@LA@tabular*}%
\let\TPTrlap\relax}%
{\egroup\global\@ignoretrue}

\def\TPT@endtab{\everyhbox{}%
\setbox\@tempboxb\lastbox   % grab tabular environment and measure it
\xdef\TPT@hsize{\hsize\the\wd\@tempboxb\noexpand\@parboxrestore}\TPT@hsize
\ifx\TPT@docapt\@undefined\else
  \TPT@docapt \global\let\TPT@docapt\@undefined \vskip.2\baselineskip
\fi \par \box\@tempboxb \parindent=1em\relax}

\gdef\TPT@hsize{}

\def\TPT@caption#1[#2]#3{\gdef\TPT@docapt{\par\prevdepth-\@m\p@
   \TPT@LA@caption{#1}[#2]{#3}}\ignorespaces}

\def\tablenotes{\TPT@hsize \list{}{\topsep.3\baselineskip \partopsep\z@
\itemsep.1\baselineskip \parsep\z@ \itemindent\z@ \leftmargin1.5em
%  for superscript enumeration, use:
\def\makelabel##1{\tnote{##1}\hfil}\labelwidth .5em\labelsep .3em%
%  for on-the-line enumeration use:
% \labelwidth 1em\labelsep .5em%
\relax}}

\def\tnote#1{\protect\TPTrlap{$^{\fam\z@ #1}$}}% 
\def\TPTrlap#1{} % notes in caption will disappear in list of tables!

\let\TPT@LA@caption\@caption

\endtablenotes % restore catcode of @ and * to starting value

\let\endtablenotes\endlist % and assign proper meaning for \endtablenotes!

\endinput

Example:

Here is some paragraph before the table.  Note that this table does not
float because it is not in a {table} or {table*} environment.

\begin{center}
\begin{threeparttable}
\caption{The Skewing Angles ($\beta$) for $\fam0 Mu(H)+X_2$ and
   $\fam0 Mu(H)+HX$~\tnote{a}}
\begin{tabular}{rlcc}
\hline
&   & $\fam0 H(Mu)+F_2$ & $\fam0 H(Mu)+Cl_2$ \\
\hline
&$\beta$(H)  & $80.9^\circ\tnote{b}$ & $83.2^\circ$ \\
&$\beta$(Mu) & $86.7^\circ$ & $87.7^\circ$ \\
\hline
\end{tabular}
\begin{tablenotes}
\item[a] for the abstraction reaction, $\fam0 Mu+HX \rightarrow MuH+X$.
\item[b] 1 degree${} = \pi/180$ radians.
\end{tablenotes}
\end{threeparttable}

\end{center}
