[Tex/LaTex] Include table as a subfigure


Is it possible to include "table code" as a sub-figure (instead of an image) using the package subfig? If so, how?

Best Answer

You can include any content (table, text, figure, ...) within a figure or table environment. That is, there is no restriction to only have figures within a figure environment, nor to only have a tabular within a table environment. The same goes for \subfloat from the \subfig package. The respective environments just maintain different counters and they end up in different "List of ..."s - administrative differences of sorts.

Here's a minimal example:

enter image description here

\usepackage{subfig}% http://ctan.org/pkg/subfig
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\mytab}{% Just for this example
    One & Two & Three \\
    $x$ & $y$ & $z$ \\
    1 & 2 & 3 \\

  \caption{Here are some tables in a \texttt{figure} environment.}%

  \caption{Here are some tables in a \texttt{table} environment.}%