3

I would like to place a table and figure side by side in my document. I have achieved this with the following code

\documentclass[a4paper,10pt]{article}

\usepackage{floatrow}
\usepackage{color}
\newfloatcommand{capbtabbox}{table}[][\FBwidth]

\begin{document}
\begin{figure}
  \begin{floatrow}
     \ffigbox[\FBwidth]%
    {\includegraphics*[width=0.45\textwidth]{LiverPhantom.png}}
    {\caption{Liver Phantom}%
    \label{fig:Zoom}%
  }
  \capbtabbox{% 
    \begin{tabular}{|c|cc|cc|cc|} \hline
     \textbf{Head} & \multicolumn{6}{c|}{\textbf{Pixel Width}} \\ \hline
          & \multicolumn{2}{c|}{\textbf{Picker}} & \multicolumn{2}{c|}{\textbf{Blue}} & \multicolumn{2}{c|}{\textbf{Red}} \\ 
          & X & Y & X & Y & X & Y \\ \hline
     \textbf{H1}   & 79.9 & 80.0 & 87.3 & 87.5 & 87.7 & 87.1 \\
     \textbf{H2}   & 79.4 & 79.3 & 87.5 & 87.1 & 87.3 & 87.2 \\
     \textbf{H3}   & 80.2 & 80.4 & - & - & - & -\\ \hline
     \textbf{Mean} & \multicolumn{2}{c|}{\textbf{\color{red}79.9}} & \multicolumn{4}{c|}{\textbf{\color{red}87.3}} \\ \hline
    \end{tabular}
     }{
      \caption{Phantom pixel width}
      \label{fig:ZoomTBl}
  }
  \end{floatrow}
\end{figure}
\end{document}

However, the bottom boundaries of the figure and table have the same y-coordinate. Is it possible to align the table vertically centre with respect to the figure?

1
  • It would help if you gave a complete MWE, starting with \documentclass. Sep 17, 2013 at 12:14

2 Answers 2

5

Although Herbert solved the question, it is worth to note that and easy alternative are two clasic minipages and the caption package:

MWE

\documentclass[a4paper,10pt]{article}
\usepackage{graphicx}
\usepackage[margin=2.54cm]{geometry}
\usepackage{mwe} % for demo figure 
\usepackage{lipsum} % for dummmy text
\usepackage{caption}
\usepackage{color}
\begin{document}
\lipsum[1-4]
\begin{figure}
\begin{minipage}{.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-a.pdf}
\captionof{figure}{Liver Phantom}
\end{minipage}\hfill
\begin{minipage}{.55\textwidth}
    \centering 
\begin{tabular}{|c|cc|cc|cc|} \hline
     \textbf{Head} & \multicolumn{6}{c|}{\textbf{Pixel Width}} \\ \hline
          & \multicolumn{2}{c|}{\textbf{Picker}} & \multicolumn{2}{c|}{\textbf{Blue}} & \multicolumn{2}{c|}{\textbf{Red}} \\
          & X & Y & X & Y & X & Y \\ \hline
     \textbf{H1}   & 79.9 & 80.0 & 87.3 & 87.5 & 87.7 & 87.1 \\
     \textbf{H2}   & 79.4 & 79.3 & 87.5 & 87.1 & 87.3 & 87.2 \\
     \textbf{H3}   & 80.2 & 80.4 & - & - & - & -\\ \hline
     \textbf{Mean} & \multicolumn{2}{c|}{\textbf{\color{red}79.9}} & \multicolumn{4}{c|}{\textbf{\color{red}87.3}} \\ \hline
    \end{tabular}%
\captionof{table}{Phantom pixel width}
\end{minipage}
\end{figure}
\end{document}
1
...
\begin{floatrow}\CenterFloatBoxes
...

see documentation!

You must log in to answer this question.

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