# Input a table into a subfigure, get the error “Not in outer par mode”

My question is it possible to put a table in the place of a figure when using subfigures? I have tried this example: Include table as a subfigure

but I get the following error: Not in outer par mode

I am using the subcaption package. Which is different. Here is my code:

\begin{figure} [H]
\begin{center}
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
\centering
\begin{tabular}{rr}
\toprule
\textbf{Vis} & \textbf{Expected size of adapter} \\
\midrule
V-R-is  & 8 \\
V-R-8co-is & 1 \\
V-R-12co-my & 1 \\
V-R-G7co-s & 1 \\
\bottomrule
\end{tabular}%
\end{table}

\begin{subfigure}[b]{0.7\textwidth}
\centering
\includegraphics[scale=0.40]{targ_recomb.eps}
\caption{PCR produc}
\end{subfigure}

\begin{subfigure}[b]{0.7\textwidth}
\centering
\includegraphics[scale=0.40]{targ_recomb2.eps}
\caption{1173 reverse primer.}
\end{subfigure}
\caption{PC results}
\label{fig:PCRresult}
\end{center}
\end{figure}


O and btw the \centering doesn't seem to work hence the \begin{center}

Is this possible using the \usepackage{subcaption}

Don't use the [H] specifier in general, but especially in this case where the object you want to typeset is quite big: there's no hope it will fit “here”.

You can profit from caption commands:

\documentclass{article}
\usepackage{caption,subcaption}
\usepackage[demo]{graphicx}
\usepackage{booktabs}

\begin{document}

\begin{figure}
\centering

\begingroup % make the next setting local
\captionsetup{type=table} % here we want to caption a table

% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{tabular}{rr}
\toprule
\textbf{Vis} & \textbf{Expected size of adapter} \\
\midrule
V-R-is  & 8 \\
V-R-8co-is & 1 \\
V-R-12co-my & 1 \\
V-R-G7co-s & 1 \\
\bottomrule
\end{tabular}
\endgroup

\bigskip % some vertical space

\begin{subfigure}{0.7\textwidth}
\centering
\includegraphics[scale=0.40]{targ_recomb.eps}
\caption{PCR produc}
\end{subfigure}

\begin{subfigure}{0.7\textwidth}
\centering
\includegraphics[scale=0.40]{targ_recomb2.eps}
\caption{1173 reverse primer.}
\end{subfigure}

\caption{PC results}
\label{fig:PCRresult}

\end{figure}

\end{document}


I'd probably use \begin{tabular}{lc} instead of \begin{tabular}{lr} because of the wide header.