[Tex/LaTex] Putting two tables side by side (one table with subtables)
minipagesubfloatstables
I want to put two tables side by side. Table 1 has two subtables in it. Each table itself is built using the \begin{tabular} environment. A sample of the table is here:
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}
If you set the pos option to H (from the float package) then you can enclose your ctables inside minipages:
\documentclass{article}
\usepackage{booktabs}
\usepackage{ctable}
\usepackage{float}
\begin{document}
\begin{center}
\begin{minipage}{.5\textwidth}
\ctable[caption = Two ctables side by side,
label = tab:test1,
width = 5cm,pos= H,left]{c>{\raggedright}X}{
\tnote{footnotes are placed under the table}
}{
\ML
\multicolumn{2}{c}{Multicolumn entry!}
\NN
\midrule
one&
The width of this column depends on the width of the table.\tmark
}
\end{minipage}%THIS COMMENT IS SIGNIFICANT
\begin{minipage}{.5\textwidth}
\ctable[caption = Two ctables side by side,
label = tab:test2,
width = 5cm,pos= H,left]{c>{\raggedright}X}{
\tnote{footnotes are placed under the table}
}{
\ML
\multicolumn{2}{c}{Multicolumn entry!}
\NN
\midrule
one&
The width of this column depends on the width of the table.\tmark
}
\end{minipage}
\end{center}
\end{document}
Of course, now your tables are not floating objects so their correct placement is your responsibility.
Best Answer