Information and discussion about graphics, figures & tables in LaTeX documents.
martinoshea
Posts: 3 Joined: Wed Apr 21, 2010 7:03 pm
Post
by martinoshea » Wed Apr 21, 2010 7:13 pm
Hello
Can anyone help? I have a table which displays as follows:
Capture.png (20.04 KiB) Viewed 2851 times
Which is formed from LaTeX as follows using MikTeX 2.6:
Code: Select all
\begin{table} [htbp]
\centering
{\footnotesize\tt
\begin{tabular} {| l | r | r | r | r | r | r |}
\hline
\multicolumn{1}{|c|}{Mining type}
&\multicolumn{4}{|c|}{Datasets mined / student-alloc feeds}
&\multicolumn{2}{|c|}{Datasets mined / student-orig feeds} \\
\hline
& 1st feed & 2nd feed & 3rd feed & 4th feed & 1st feed & 2nd feed \\ [0.5ex]
\hline
OM & 33 & 31 & 31 & 8 & 19 & 13 \\
\hline
VM & 0 & 3 & 1 & 25 & 3 & 6 \\
\hline
Totals & 33 & 34 & 32 & 33 & 22 & 19 \\
\hline
\end{tabular} }
\caption{Datasets created according to mining types.}
\label{tab:RSS_Feeds_Mining_Type_Breakdown}
\end{table}
If anyone can tell me why the column on the right are sized incorrectly?
Thanks
Martin O'Shea.
NEW: TikZ book now 40% off at Amazon.com for a short time.
frabjous
Posts: 2064 Joined: Fri Mar 06, 2009 12:20 am
Post
by frabjous » Wed Apr 21, 2010 7:25 pm
How would you like it to be sized?
Here's what it's doing...
You've got a multicolumn cell "Datasets mined / student-orig feeds" -- so those two columns together need to be wide enough to fit that. It's making the penultimate column just wide enough fit the widest thing exclusively in it ("1st feed"), and then stretching the last column so that there is room for the multicolumn cell.
But what would you like? For each of these two columns to be half of "Datasets mined / student-orig feeds", evenly (which would still make them larger than the others), or would you like "Datasets mined / student-orig feeds" to be wrapped? Or what? If this is incorrect, what's correct?
martinoshea
Posts: 3 Joined: Wed Apr 21, 2010 7:03 pm
Post
by martinoshea » Wed Apr 21, 2010 7:34 pm
Thanks for the reply.
I would like the two columns below "Datasets mined / student-orig feeds" to be evenly spaced like the 4 below "Datasets mined / student-alloc feeds".
Juanjo
Posts: 657 Joined: Sat Jan 27, 2007 12:46 am
Post
by Juanjo » Thu Apr 22, 2010 10:35 pm
Try this:
Code: Select all
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{@{}l*{6}{c}@{}}
\toprule
Mining type & & & \multicolumn{3}{c}{Datasets mined} \\
& \multicolumn{4}{c}{Student-alloc feeds}
& \multicolumn{2}{c}{Student-orig feeds} \\ \cmidrule(lr){2-5}\cmidrule(l){6-7}
& 1st feed & 2nd feed & 3rd feed & 4th feed & 1st feed & 2nd feed \\ [0.5ex]
\midrule
OM & 33 & 31 & 31 & 8 & 19 & 13 \\
VM & 0 & 3 & 1 & 25 & 3 & 6 \\
Totals & 33 & 34 & 32 & 33 & 22 & 19 \\
\bottomrule
\end{tabular}
\caption{Datasets created according to mining types.}
\label{tab:RSS_Feeds_Mining_Type_Breakdown}
\end{table}
\end{document}