%sample file
%table floats---different tests
\documentclass{book}

\usepackage{calc}
\usepackage{tabularx,array}

\usepackage{longtable}
\usepackage{floatpagestyle}

%load floatrow
\usepackage[font=small,footskip=.5\skip\footins,
   capbesidesep=quad,floatrowsep=quad]{floatrow}

\floatsetup[table]{style=Plaintop,captionskip=5pt}
\floatsetup[longtable]{LTcapwidth=table,margins=centering}

%load caption
\usepackage[font=small,justification=centerlast]{caption}[2004/11/28]

%%%for all versions of caption 3.x?
\DeclareCaptionFormat{flushrightlabel}{\leavevmode\rightline{#1}#2#3\normalfont\par}
%%%for caption 3.d?
%\DeclareCaptionFormat*{flushrightlabel}{\rightline{#1}#3\par}

\captionsetup[table]%
   {format=flushrightlabel,labelformat=continued,labelsep=newline,textfont=bf,labelfont=sl}
%%%for caption 3.d?
%\captionsetup[table]%
%   {format=flushrightlabel,labelsep=none,textfont=bf,labelfont=sl}

%>>>
\DeclareCaptionLabelFormat{continued}{\bothIfFirst{#1}{ }#2\Continued}
\newcommand\Continued{}
%\DeclareCaptionLabelFormat{continued}{\bothIfFirst{#1}{ }#2. \emph{Continued}}
\def\ContinuedTable{\ContinuedFloat\def\Continued{. \emph{Continued}}\caption{}}
%\def\ContinuedTable{\ContinuedFloat\captionsetup[table]{labelformat=continued}\caption{}}
%<<<

\captionsetup[floatfoot]{format=default}
\captionsetup[longtable]{labelformat=default}


%load subfig
\newif\ifLoadSubfig
\IfFileExists{subfig.sty}{\usepackage[justification=centerlast]{subfig}
\captionsetup[subtable]{format=default,labelfont=bf,textfont=sl}

\AtBeginDocument{\floatsetup{subfloatrowsep=quad}}
\LoadSubfigtrue}{\LoadSubfigfalse}

\let\wideemptyfloatpage\emptyfloatpage

\newif\ifLoadRotating
\IfFileExists{rotating.sty}
{\usepackage[figuresright]{rotating}

\DeclareMarginSet{expand}%
  {\setfloatmargins{\hfil}
                   {\hskip-\headsep\hskip-.7\headheight plus1fil}}
\floatsetup[rotfloat]{margins=expand}
\LoadRotatingtrue}{\LoadRotatingfalse}

\newcommand\TABULARX[1][]{\begin{tabularx}{\hsize}{|X|X|X|}
\hline
Text for first column of first row#1&
    More text for second column of first row#1&
        More text for third column of first row#1\\\hline
Text for first column of second row#1&
    More text for second column of second row#1&
        More text for third column of second row#1\\\hline
Text for first column of third row#1&
    More text for second column of third row#1&
        More text for third column of third row#1\\\hline
\end{tabularx}}

\newcommand\TABULARS[1][]{\begin{tabular*}
 {\hsize}{@{\extracolsep{-.4\tabcolsep plus1fill}}|p{.29\hsize}|p{.29\hsize}|p{.29\hsize}|}
\hline
Text for first column of first row#1&
    More text for second column of first row#1&
        More text for third column of first row#1\\\hline
Text for first column of second row#1&
    More text for second column of second row#1&
        More text for third column of second row#1\\\hline
Text for first column of third row#1&
    More text for second column of third row#1&
        More text for third column of third row#1\\\hline
\end{tabular*}}

\newcommand\TABULARI{\begin{tabular}{|l|>{\phantom0}c|>{\phantom0}c|}
  \hline
  \raisebox{-1.5ex}{Column Head}
               & \multicolumn{2}{c|}{Data} \\
               \cline{2-3}
               & \multicolumn{1}{c|}{I}
                           & \multicolumn{1}{c|}{II}
  \\\hline
  First row    &         1 &         2 \\
  Second row   &         3 &         4 \\
  Third row    &         6 &         8 \\
  Fourth row   & \llap{1}0 & \llap{1}6 \\
  \hline
\end{tabular}}

\newcommand\TABULARII{\begin{tabular}{|l|c|c|c|}
  \hline
  \raisebox{-1.5ex}{Column Head}
               & \multicolumn{3}{c|}{Data} \\
               \cline{2-4}
               & I      & II      & III        \\
  \hline
  First row    & 1      & 2       & \phantom01 \\
  Second row   & 3      & 4       & \phantom06 \\
  Third row    & 6      & 8       &         28 \\
  \hline
\end{tabular}}

\providecommand*{\Lopt}[1]{\textsf{#1}}
\providecommand*{\file}[1]{\texttt{#1}}
\providecommand*{\pkg}[1]{\texttt{#1}}
\providecommand*{\env}[1]{\texttt{#1}}
\providecommand*{\com}[1]{\texttt{\char`\\#1}}
\providecommand*{\meta}[1]{$\langle$\textit{#1}$\rangle$}

\hfuzz3pt
\hbadness7000

\def\text{And more text and some more text and a bit more text and
a little more text and a little peace of text to fill space}

\def\Text{{\mdseries \text. \text. \text.  \text. }}

\begin{document}

\chapter{Table Layout}

\begin{sl}
This example shows floats in one-column document.

\emph{Common float settings.}\\
Font for float contents \verb|\small|; skips before foot material half reduced;
footnote rule has maximum width${{}\approx27}$\,mm; separation between
beside caption and object equals to 1\,em; separation between beside float
boxes also equals to 1\,em.
\begin{verbatim}
\usepackage[font=small,footskip=.5\skip\footins,
   captionskip=5pt,capbesidesep=quad,floatrowsep=quad]{floatrow}
\end{verbatim}

\emph{Common caption settings.}\\
For caption text used \verb|\small| font;
justification \texttt{centerlast} (last line centered).
\begin{verbatim}
\usepackage[font=small,justification=centerlast]{caption}
\end{verbatim}

\emph{Common subcaption settings.}\\
Justification centerlast (last line centered).
\begin{verbatim}
\usepackage[justification=centerlast]{subfig}
\end{verbatim}

\emph{Special settings for float types.}

\emph{Table.}\\
For tables is used \texttt{Plaintop} style (captions aligned by top line);
skip between caption and object  half reduced.
\begin{verbatim}
\floatsetup[table]{style=Plaintop,captionskip=5pt}
\end{verbatim}

\emph{Special caption settings for float types.}

\emph{Table.}\\
For tables was created special format with separated label flushed to the right;
font of label slanted, font of caption text bold.

To restore normal behavior for \verb|\floatfoot| macro, here goes \verb|\captionsetup|
for \texttt{floatfoot} style.
\begin{verbatim}
\DeclareCaptionFormat{flushrightlabel}{\leavevmode
  \rightline{#1}#2#3\par}

\captionsetup[table]%
   {format=flushrightlabel,labelsep=newline,
    textfont=bf,labelfont=sl}

\captionsetup[floatfoot]{format=default}
\end{verbatim}
With caption's version 3d you may set table format by this way:
\begin{verbatim}
\DeclareCaptionFormat*{flushrightlabel}{\rightline{#1}#3\par}

\captionsetup[table]%
   {format=flushrightlabel,labelsep=none,textfont=bf,labelfont=sl}
\end{verbatim}
You may see, that there are absent settings for \verb|\floatfoot|.
(Unfortunately, if your table has only label, and no any text, the unwanted
space appears instead of caption title.)

For continued table (like table~\ref{rot:tab:cont} on the page~\pageref{rot:tab:cont})
was created new label format and defined command \verb|\ContinuedTable|, which includes
special \texttt{continued} format and \verb|\ContinuedFloat| command.
\begin{verbatim}
\DeclareCaptionLabelFormat{continued}{\bothIfFirst{#1}{ }#2.
  \emph{Continued}}

\def\ContinuedTable{\ContinuedFloat
  \captionsetup[table]{labelformat=continued}}
\end{verbatim}

\emph{Special settings for special float layout.}

\emph{Rotated.}\\
For rotated floats beside caption placed to right side of object;
right side expanded to the top of running head. To delete running head from pages
with rotated float was used \verb|\emptyfloatpage| macro\footnote{In current example the
\protect\com{wideemptyfloatpage} command is the synonym.} and
loaded \pkg{floatpagestyle} package.
\begin{verbatim}
\DeclareMarginSet{expand}%
   {\setfloatmargins{\hfil}
                   {\hskip-\headsep\hskip-.7\headheight plus1fil}}
\floatsetup[rotfloat]{sidecappos=right,floatmargins=expand}
\end{verbatim}

\end{sl}

\clearpage
\bfseries\boldmath
Example of plain \env{table} environment (table~\ref{float:plain:table}),

\begin{table}
\caption{Plain table environment with \env{tabularx}. \text}\label{float:plain:table}
\TABULARX
\end{table}

\Text

\Text

\clearpage
Example of plain \env{table} environment (table~\ref{float:w:plain:table})
with predefined width.
Before \env{table} environment was written:
\begin{verbatim}
\thisfloatsetup{floatwidth=.85\hsize}
\end{verbatim}

\thisfloatsetup{floatwidth=.85\hsize}
\begin{table}
\caption{Plain table environment (\env{tabularx}) with predefined width. \text}\label{float:w:plain:table}
\TABULARX
\end{table}


\Text

\clearpage
Example of table placed in \verb|\ttabbox| (\verb|\floatbox| stuff);
the width of float box equals to the width of table
(see table~\ref{floatbox:FB:tab}).

\begin{table}
\floatbox{table}[\FBwidth]
{\caption{Float box table (\protect\com{ttabbox})
width of table}\label{floatbox:FB:tab}}
{\tabcolsep2\tabcolsep\TABULARI\floatfoot{Text of floatfoot. \text}}
\end{table}

\Text

\ifLoadSubfig

\clearpage
The example of subtables (table~\ref{floatbox:wide:subtab}) with two
subtables~\subref{subtab:A} and~\subref{subtab:B}.

Here for sub tables was used the \env{subfloatrow} environment (this environment
allows usage (and definition) of common horizontal skip between subfloats).
\begin{verbatim}
\begin{table*}\extrarowheight1pt
\floatbox[\captop]{table}[\FBwidth]
{\caption{...}
{\begin{subfloatrow}
\subfloat[...]{...}

\subfloat[...]{...}%
\end{subfloatrow}}
\end{table*}%
\end{verbatim}

\begin{table*}\extrarowheight1pt
\floatbox[\captop]{table}[\FBwidth]
{\caption{Table with two \protect\com{subfloats}
 (from \pkg{subfig} package)}\label{floatbox:wide:subtab}}
{\begin{subfloatrow}
\subfloat[First table\label{subtab:A}]
{\TABULARI}%

\subfloat[Second table with long long long caption\label{subtab:B}]
{\TABULARII}%
\end{subfloatrow}}
\end{table*}%

\Text

\fi

\clearpage
The example of table row (tables~\ref{tab:row:tabI}--\ref{tab:row:tabII}).

\begin{table*}
\begin{floatrow}
\extrarowheight1pt
\ttabbox
{\caption[Beside table~I long header]%
 {Beside table~I with long long long top aligned header}\label{tab:row:tabI}}
{\TABULARI}
%
\ttabbox
{\caption{Beside table~II short header}\label{tab:row:tabII}}
{\TABULARII}
\end{floatrow}
\end{table*}

\Text

\clearpage
Example of two rows: first---of beside tables in \env{tabularx} environments;
second---of beside tables in \env{tabular*} environments. Both rows use first column width${}=.85$\verb|\hsize|,
and second column${}=1.15$\verb|\hsize|.
(see tables~\ref{rot:tabx:tab1}--\ref{rot:tabx:tab2}).

\begin{table}[!t]
\begin{floatrow}\tabcolsep.5\tabcolsep
 \ttabbox[.85\hsize]{\begin{tabularx}{\hsize}{|X|X|}
\hline
A text for first column of first row&
    More text for second column of first row\\\hline
A text for first column of second row&
    More text for second column of second row\\\hline
A text for first column of third row&
    More text for second column of third row\\\hline
\end{tabularx}}{\caption{The \env{tabularx} environment with width \texttt{.85}\protect\com{hsize}}\label{rot:tabx:tab1}}
 \ttabbox[1.15\hsize]{\begin{tabularx}{\hsize}{|X|X|}
\hline
Text for first column of first row&
    More text for second column of first row\\\hline
Text for first column of second row&
    More text for second column of second row\\\hline
Text for first column of third row&
    More text for second column of third row\\\hline
\end{tabularx}}{\caption{The \env{tabularx} (from \pkg{tools} bundle) environment with width \texttt{1.15}\protect\com{hsize}}}
\end{floatrow}
\vskip\floatsep

\begin{floatrow}\tabcolsep.75\tabcolsep
 \ttabbox[.85\hsize]{{\begin{tabular*}{\hsize}{@{\extracolsep{-.4\tabcolsep plus1fill}}
   |p{.44\hsize}|p{.44\hsize}|}
\hline
A text for first column of first row&
    More text for second column of first row\\\hline
A text for first column of second row&
    More text for second column of second row\\\hline
A text for first column of third row &
    More text for second column of third row\\\hline
\end{tabular*}}}{\caption{The \env{tabular*} environment with width \texttt{.85}\protect\com{hsize}}}
 \ttabbox[1.15\hsize]{{\begin{tabular*}{\hsize}{@{\extracolsep{-.4\tabcolsep plus1fill}}|p{.45\hsize}|p{.45\hsize}|}
\hline
Text for first column of first row&
    More text for second column of first row\\\hline
Text for first column of second row&
    More text for second column of second row\\\hline
Text for first column of third row &
    More text for second column of third row\\\hline
\end{tabular*}}}{\caption{The starred \LaTeX's \env{tabular*} environment with width \texttt{1.15}\protect\com{hsize}}\label{rot:tabx:tab2}}
\end{floatrow}
\end{table}

\Text

\clearpage
Example of continued rotated plain table on facing pages
(see table~\ref{rot:tab} on pages~\pageref{rot:tab}--\pageref{rot:tab:cont}).

\ifodd\value{page}\else
\Text \Text

\Text \Text

\ifodd\value{page}\else
\Text \Text
\Text \Text

\Text \Text

\fi

\fi

\newdimen\rottextwidth\rottextwidth\textwidth

\begin{sidewaystable}
\buildFBBOX{\vbox to\rottextwidth\bgroup\vss}{\egroup}
\wideemptyfloatpage
\caption{Plain table inside
\protect\env{sidewaystable} environment,
full text width. \text}\label{rot:tab}

\TABULARX[ \text. \text. ]
\end{sidewaystable}
%
\begin{sidewaystable}
\buildFBBOX{\vbox to\rottextwidth\bgroup}{\vss\egroup}
\emptyfloatpage\ContinuedTable
\label{rot:tab:cont}

\TABULARX[ \text.]
\end{sidewaystable}

\Text

\Text

\Text

\Text

\clearpage
Example of two beside tables in wide rotated table environment (\env{sidewaystable*})
(see tables~\hbox{\ref{rot:side:tab1}--\ref{rot:side:tab2}}
on page~\pageref{rot:side:tab1}).

\begin{sidewaystable*}\wideemptyfloatpage
\begin{floatrow}
 \ttabbox[\hsize]
  {{\TABULARS[. \text]\floatfoot{If you use inside \protect\com{floatbox} stuff
\texttt{tabularx} or \texttt{tabular*} environments with \protect\com{hsize}
command inside \meta{width} argument, you must repeat the \protect\com{hsize} argument
in \meta{width} argument of \protect\com{floatbox} macro.}}}
  {\caption{}\label{rot:side:tab1}}
 \ttabbox[\hsize]
  {{\TABULARS[. \text]\floatfoot{If you want to set width of \texttt{tabularx} or \texttt{tabular*} environments
 like \texttt{.8}\protect\com{hsize} (or \texttt{1.2}\protect\com{hsize}) and they placed inside any
\protect\com{floatbox} macro, load \texttt{.8}\protect\com{hsize} in \meta{width} argument of
\protect\com{floatbox} macro, and in \meta{width} argument of \texttt{tabularx} or \texttt{tabular*}
load only \protect\com{hsize} macro.}}}
  {\caption{}\label{rot:side:tab2}}
\end{floatrow}

\end{sidewaystable*}

\Text

\Text

\clearpage
Example of two rows of beside tables in wide rotated table
(see tables~\ref{rot:tworow:tab1}--\ref{rot:tworow:tab2} on page~\pageref{rot:tworow:tab2}).
There were used \env{tabularx} environment in first row and
\env{tabular*}---in the second.

\begin{sidewaystable*}\wideemptyfloatpage
\begin{floatrow}
 \ttabbox[\hsize]
  {{\TABULARX}}{\caption{}\label{rot:tworow:tab1}}
 \ttabbox[\hsize]
  {{\TABULARX}}{\caption{}}
\end{floatrow}
\vskip\floatsep

\begin{floatrow}
 \ttabbox[\hsize]{{\TABULARS}}{\caption{}}
 \ttabbox[\hsize]{{\TABULARS}}{\caption{}\label{rot:tworow:tab2}}
\end{floatrow}

\end{sidewaystable*}

\Text
\Text


\end{document} 