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.

This is related to How to make a figure span on two columns in a scientific paper?

In a table* element, I want to put two \tabular{} elements, and get them appear side by side. I will then need to caption them as (a) and (b) and create labels (for references in the text) and so forth. If I just use the table* element, the tables appear below each other and are centred across the two columns.

EDIT: In response to TH: This is what I tried. Both tables still appear on the right column.

\begin{table*}
\subfloat[Before processing]{
\begin{tabular}{|c|c|c|c|c|}
\hline 
Year & Month & Country & State & Impressions\tabularnewline
\hline
\hline 
2007 & JAN & IN & TN & 3\tabularnewline
\hline 
2007 & JAN & IN & TN & 1\tabularnewline
\hline 
\end{tabular}
}

\begin{table}
\subfloat[After processing]{
\begin{tabular}{|c|c|c|c|c|}
\hline 
Year & Month & Country & State & Impressions\tabularnewline
\hline
\hline 
2007 & JAN & IN & TN & 7\tabularnewline
\hline 
2007 & FEB & IN & KA & 13\tabularnewline
\hline 
\end{tabular}
}
\caption{overall}
\end{table*}
share|improve this question
    
I've found it easier to use the multicol package, stop the multicol environment, set the tables as you wish (in 1 column mode) then start the multicol environment again. –  Mica Nov 29 '10 at 22:25
add comment

2 Answers

up vote 5 down vote accepted

You should use the subfig package.

\begin{table*}
\subfloat[First caption]{\begin{tabular}{...}...\end{tabular}}
\subfloat[Second caption]{\begin{tabular}{...}...\end{tabular}}
\caption{Overall caption}
\end{table*}

This can be used in conjunction with the floatrow package. See the subfig documentation for an example that aligns captions using floatrow.

EDIT:
Your example has an extra \begin{table} that doesn't belong. It also has a blank line which causes TeX to start a new paragraph which is why one table appears on top of the other.

Here's a complete example where I've also cleaned up your tables following the guidelines given in the documentation to the booktabs package.

\documentclass[twocolumn]{article}
\usepackage{subfig}
\usepackage{booktabs}
\begin{document}
\begin{table*}
\subfloat[Before processing]{
\begin{tabular}{ccccc}
\toprule
Year & Month & Country & State & Impressions\\
\midrule
2007 & JAN & IN & TN & 3\\
2007 & JAN & IN & TN & 1\\
\bottomrule 
\end{tabular}
}%
\hfill
\subfloat[After processing]{
\begin{tabular}{ccccc}
\toprule 
Year & Month & Country & State & Impressions\\
\midrule 
2007 & JAN & IN & TN & 7\\
2007 & FEB & IN & KA & 13\\
\bottomrule 
\end{tabular}
}
\caption{overall}
\end{table*}
\end{document}
share|improve this answer
    
Thanks for your effort, but the tables still appear below each other (and its not because of lack of space - if I make them as separate tables, they do appear on different columns, side-by-side). –  donatello Nov 28 '10 at 17:17
1  
The »subfig« package isn't maintained any more thus not suggestive. »floatrow« also masters sub-figures on its own. So I see no necessity for a conjunction. –  Thorsten Donig Nov 28 '10 at 17:47
    
@donatello: I think you're going to need to provide a minimal example at this point. –  TH. Nov 28 '10 at 18:27
    
@Thorsten: My version of subfig.sty lists Steven Douglas Cochran as the maintainer. ctan.org/pkg/subfig lists Steven as in inactive maintainer and Vafa Khalighi as an active maintainer. Further, the floatrow documentation explicitly mentions working with subfig. –  TH. Nov 28 '10 at 18:29
    
Hey please see my edit in the q. I've provided an example. –  donatello Nov 28 '10 at 18:54
show 3 more comments

Complying with the request of TH., here comes an example that uses the »subcaption« package (shipped with caption). The tables will appear on top of page 3 of the resulting document.

\documentclass[11pt,a4paper,twocolumn,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage[font=footnotesize]{subcaption}
\usepackage{booktabs}
\usepackage{blindtext}

%\DeclareCaptionSubType*[arabic]{table}
%\captionsetup[subtable]{labelformat=simple,labelsep=colon}

\title{Two tables side by side in a \texttt{table*} environment within a two column document}
\author{Donatello}

\begin{document}
  \maketitle

  \blinddocument

  \begin{table*}
    \caption{Dummy tables}\label{tab:dummy}
    \centering
    \begin{subtable}[t]{\columnwidth}
      \caption{Dummy sub-table}\label{subtab-1:dummy}
      \centering
      \begin{tabular}{ccc}\toprule
        Table head & Table head & Table head \\ \midrule
        Some values & Some values & Some values \\
        Some values & Some values & Some values \\
        Some values & Some values & Some values \\ \bottomrule
      \end{tabular}
    \end{subtable}
    \hfill
    \begin{subtable}[t]{\columnwidth}
      \caption{Dummy sub-table}\label{subtab-2:dummy}
      \centering
      \begin{tabular}{ccc}\toprule
        Table head & Table head  & Table head\\ \midrule
        Some values & Some values & Some values \\
        Some values & Some values & Some values \\
        Some values & Some values & Some values \\ \bottomrule
      \end{tabular}
    \end{subtable}
  \end{table*}

  \blinddocument
\end{document}

I have chosen \columnwidth as width for the two subtable environments and centered the two sub-tables optically in the respective column.

The commented lines shall serve as a possible example for redefining the numbering of the subtables.

As always, the blindtext package is only for creating dummy text thus not part of the solution.

share|improve this answer
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.