Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using 'subfigure', how can I create subtables within a table, such that a) subcaptions are underneath each subtable, and b) there's a reasonable horizontal gap between the subtables? So far I've only be able to get the subcaptions on top, and no reasonable gap, e.g. with following code:

\documentclass{article}
\usepackage{subfigure}
\begin{document}
\begin{table}
\centering
\subtable[caption1]
{\begin{tabular}{c c c}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\subtable[caption2]
{\begin{tabular}{c c c}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\caption{caption for whole table}
\end{table}
\end{document}
share|improve this question
    
One thing that doesn't work is '\usepackage[FIGBOTCAP]{subfigure}'. But having subcaptions underneath should be the default, according to the 'subfigure' manual. –  Harry Macpherson Jan 8 '12 at 19:32
    
Perhaps I'm missing something, but I'd remove the explicit ` (space) commands because the first column doesn't align properly (see also Percusse's output). Alternatively, add an explicit space after the \hline` command. –  Marc van Dongen Jan 8 '12 at 21:18
add comment

1 Answer 1

up vote 6 down vote accepted

Instead of the subfigure package which is now obsolete and should be replaced with subfig package, you can use subcaption package with almost identical code. I am modifying the example in the manual:

\documentclass{article}
\usepackage{subcaption}
\begin{document}

\begin{table}
\begin{subtable}{.5\linewidth}\centering
{\begin{tabular}{ccc}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\caption{A subtable}\label{tab:1a}
\end{subtable}%
\begin{subtable}{.5\linewidth}\centering
{\begin{tabular}{c c c}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\caption{Another subtable}\label{tab:1b}
\end{subtable}
\caption{A table}\label{tab:1}
\end{table}
\end{document}

enter image description here

Nevermind the figure word. I just missed that.

share|improve this answer
    
Many thanks for this. It does the job beautifully; the only problem is that 'subcaption' is incompatible with 'subfigure' and messes up all the other things I've done with 'subfigure' :-( Any idea how to do the job using 'subfigure'? –  Harry Macpherson Jan 8 '12 at 19:38
2  
@HarryMacpherson: subfigure is really obsolete. –  Marco Daniel Jan 8 '12 at 19:57
    
To be honest, I don't think that you should be using subfigure anyway. See subcaption vs. subfigfor a flavor of these reasons. At least you should use subfig in my opinion... –  percusse Jan 8 '12 at 19:57
    
OK thanks everyone. I've reached the conclusion, looking at what people say about subfigure, subfig, and subcaption, that I should ditch subfigure, load subcaption, RTFM for subcaption and work from there! Thanks for solving the problem I asked about, though! :) –  Harry Macpherson Jan 8 '12 at 20:15
    
I have a trouble with this solution and I have posted it here: tex.stackexchange.com/questions/59414/… –  Bravo Jun 11 '12 at 8:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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