4

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
      \caption{Expected size of adapter sequences}
        \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}%
      \label{tab:addlabel}%
    \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}

0

1 Answer 1

5

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

\caption{Expected size of adapter sequences}
\label{tab:addlabel}

% 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}

enter image description here

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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .