4

I'm trying typeset a table next to a figure using subfig, but I cannot get them to align properly. I have found a similar(/identical) question here, but the solutions/suggestions do not seem to be applicable in my case as (a) I am using a fully-updated TeX Live 2013 distribution; and (b) I do not make use of the hyperref package.

Since the journal I am preparing this document for kind of forces subfig onto me, I would rather solve this without having to resort to using a different subfloat package.

The issue:

enter image description here

And a MWE:

\documentclass{article}

\usepackage{graphicx}
\usepackage{subfig}

\begin{document}
\begin{figure}
  \centering
  \subfloat[Figure]{\rule{4cm}{4cm}\label{subfig:black-hole}}%
  \qquad
  \subfloat[Table]{%
    \begin{tabular}{cc}
      \hline
      C1 & C2 \\ \hline
      A  & A \\
      B  & B \\
      C  & C \\
      D  & D \\
      E  & E \\
      F  & F \\ \hline
    \end{tabular}
    \label{subtbl:the-table}
  }
  \caption{Figure and table.}
  \label{fig:figure-and-table}
\end{figure}

\noindent Look at Figure~\ref{fig:figure-and-table}; it includes both a figure (Figure~\ref{subfig:black-hole}) and a table (Table~\ref{subtbl:the-table}).
\end{document}

Edit: Just to elaborate on my own silliness: I had already tried [b] but I didn't realise that it actually helped. On the top is what I got and on the bottom is what I thought I should get:

  Figure    Table

 ---------
 |       |
 |       |
y|       |  
 |       |  C1 C2
 |       |  -----
 ---------  A  B
     x      -----
   (a)       (b) <- The subcaptions


 ---------  
 |       |
 |       |
y|       |  C1 C2  
 |       |  -----
 |       |  A  B
 ---------  -----
     x      
   (a)       (b) <- The subcaptions

So I thought that the bottom of the table would be aligned with the x axis instead of the x label, which I assume is impossible without some manual work. I'll just keep looking for a way to do that and ask again if I'm lost. :-)

  • It actually does! I had tried that, but not in the MWE. I thought [b] hadn't helped because the table was aligned with the x label instead instead with the x axis. But that is a different question altogether I guess. Thanks a lot! – sudosensei Feb 2 '14 at 16:38
  • Can you elaborate on what type of alignment you would like. – Andrew Swann Feb 2 '14 at 16:39
  • @AndrewSwann See my edit for an illustration of my silliness. :-) – sudosensei Feb 2 '14 at 16:56
  • 1
    You can surround the tabular with a \raisebox{0.5cm}{...}, with 0.5cm replaced by a suitable height. – Andrew Swann Feb 3 '14 at 19:53
  • @AndrewSwann: Yes, thanks. I already solved it by moving the x label at the top. No manual work required that way. – sudosensei Feb 4 '14 at 11:15
5

Use the option [b] to align the table.

\begin{tabular}[b]{cc}

and the result is

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.