10

I'm not a LaTeX expert, and I want to align a table and a figure side by side, with a common caption; the table and the figure should be aligned to the bottom, too.

I tried this:

\begin{figure}
  \begin{minipage}[b]{0.60\linewidth}
    \centering
    \rule{6cm}{6cm} %to simulate an actual figure
  \end{minipage}
  \begin{minipage}[b]{0.30\linewidth}
    \centering
\begin{tabular}{ |l|l|l| }
  \hline
  \multicolumn{3}{|c|}{Zzzzzz} \\
  \hline \hline
  A & B &  C \\ \hline
  0 & 0 &  0\\ \hline
  0 & 1 &  0\\ \hline
  1 & 0 &  0\\ \hline
  1 & 1 &  1\\ \hline%
\end{tabular}
\end{minipage}
\caption{Bla bla}
\label{fig:test}
\end{figure}

But the result is:

*********
*********
*********
*********   Zzzzz
*********   0 0 0
*********   0 0 1
            0 1 0
            0 1 1
            1 1 1

 Figure 1: Bla bla

The table and the figure are not bottom-aligned. I read other answers on tex.stackexchange, but I didn't find a way to fix it.

3
  • What should the caption common to the two environments look like? E.g., do you want it to like Figure and Table x: <Saption text>, where x is the current value of the counter associated with the figureandtable environment?
    – Mico
    Mar 26, 2013 at 10:35
  • @Mico: no, I need only to reference the figure ( Figure X: bla bla) Mar 26, 2013 at 11:29
  • 1
    Nobody has given you the formal welcome yet. So Welcome to TeX.sx!
    – hpesoj626
    Mar 26, 2013 at 12:57

2 Answers 2

10

enter image description here

Pass the b option to your tabular environment, too. BTW, Please consider always adding a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. I have converted your code snippet into a MWE here.

\documentclass[10pt]{article}

\begin{document}
\begin{figure}
  \begin{minipage}[b]{0.60\linewidth}
    \centering
    %\includegraphics[width=\linewidth]{example-image}
    \rule{6cm}{6cm} %to simulate an actual figure
  \end{minipage}%
  \begin{minipage}[b]{0.30\linewidth}
    \centering
\begin{tabular}[b]{ |l|l|l| }
  \hline
  \multicolumn{3}{|c|}{Zzzzzz} \\
  \hline \hline
  A & B &  C \\ \hline
  0 & 0 &  0\\ \hline
  0 & 1 &  0\\ \hline
  1 & 0 &  0\\ \hline
  1 & 1 &  1\\ \hline%
\end{tabular}
\end{minipage}
\caption{Bla bla}
\label{fig:test}
\end{figure}
\end{document}
4

Similarly to Aligning a figure and table side by side where the alignment is on top, you need a little trick here:

\documentclass[a4paper,10pt]{article}

\begin{document}
\begin{figure}
  \begin{minipage}[b]{0.60\linewidth}
    \centering
    \rule{6cm}{6cm} %to simulate an actual figure
    \par\vspace{0pt}
  \end{minipage}%
  \begin{minipage}[b]{0.30\linewidth}
    \centering%
    \begin{tabular}{ |l|l|l| }%
      \hline%
      \multicolumn{3}{|c|}{Zzzzzz} \\%
      \hline \hline
      A & B &  C \\ \hline%
      0 & 0 &  0\\ \hline%
      0 & 1 &  0\\ \hline%
      1 & 0 &  0\\ \hline%
      1 & 1 &  1\\ \hline%
    \end{tabular}%
    \par\vspace{0pt}
  \end{minipage}
\caption{Bla bla}
\label{fig:test}
\end{figure}
\end{document}

Notice the \par\vspace{0pt} at the end of the minipages. The trick is taken from epslatex.pdf, Section 11.4.1, where the misinterpretation of the [b] parameter of minipages is explained.

You must log in to answer this question.

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