Join figure and table on the same page

You can use the capt-of package to put individual captions for the table and the figure with or without using the usual floating environments:

\documentclass[a4paper]{article}

\usepackage[english]{babel}
\usepackage{capt-of}

\begin{document}
\listoffigures
\listoftables

A non-floating version works\dots
\begin{center}
  \captionof{table}{Caption of the first table}\label{tab:tableone}
  \begin{tabular}{ll}
  ... & ... \\
  \end{tabular}
  \\[\floatsep]
  \rule{4cm}{2cm} % \includegraphics{yourpicture}
  \captionof{figure}{Caption of the first figure}\label{fig:figureone}
\end{center}

\dots as well as a floating example.
\begin{figure}[bp]
  \centering
  \captionof{table}{Caption of the second table}\label{tab:tabletwo}
  \begin{tabular}{ll}
  ... & ... \\
  \end{tabular}
  \\[\floatsep]
  \rule{4cm}{2cm} % \includegraphics{yourpicture}
  \captionof{figure}{Caption of the second figure}\label{fig:figuretwo}
\end{figure}

\end{document}

EDIT: extended the example to show a floating environment, too.


You can use the subcaption package with the help of the underlying caption package.

\documentclass{article}
\usepackage{subcaption}
\usepackage{mwe} %<- For dummy image
\DeclareCaptionLabelFormat{andtable}{#1˜#2 \& \tablename˜\thetable}

\begin{document}

\listoftables
\listoffigures


\begin{figure}
\begin{subfigure}{0.5\textwidth}\centering
\includegraphics[width=0.3\textwidth]{example-image-a}%
\label{fig:fig1}
\caption{important image}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
\begin{tabular}[b]{cc}
a &b\\c&d
\end{tabular}
\label{tab:table1}
\caption{important result}
\end{subfigure}
\captionlistentry[table]{important result}
\captionsetup{labelformat=andtable}
\caption[important image]{typeset together}
\end{figure}


\end{document}

enter image description here


I gather that the figure should be at the very top of a page, to be followed immediately by the table environment. (Moreover, I'm taking for granted that the two environments will actually fit on a single page, right?)

You could achieve these objectives by loading the afterpage package and "encasing" the figure and table environments in an \afterpage{...} statement, as is shown in the following code fragment:

\afterpage{%    % defer execution until the next page break occurs anyway
   \begin{figure}[t!] % not "pt"
      \centering
      % remaining contents of figure environment
   \end{figure}
   \begin{table}[h!] % not t or b or p
      \centering
      % remaining contents of table environment
   \end{table}
} % end of argument of `\afterpage` command

I'm further assuming that there are no deferred figure and/or table environments already waiting to be typeset. If that were the case, you should issue a \clearpage instruction as the very first item in the argument of the \afterpage command. (Even if there are no accumulated deferred floats to take care of, there's no harm done by issuing a \clearpage instruction anyway at the start of the \afterpage material; it would simply be ignored by TeX.)

In addition, if the figure and table environments combined take up most of the page (say, more than 75% of the page), you may also want to issue a second \clearpage instruction, following the end of the table environment. This will tell LaTeX that you want to have just those two floats on the page in question.

Tags:

Tables

Floats