Graphics, Figures & TablesHelp with width adjustment for table using multicolumn.

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ankitravankar
Posts: 10
Joined: Mon Jun 18, 2012 10:06 am

Help with width adjustment for table using multicolumn.

Post by ankitravankar »

Hi,

I need help with the column width adjustment for my table. The table looks too constrained. I want the text to have spaces between the lines. The text is not centered and also the lines are not aligned properly for this table. Can someone help me and teach on how to adjust width when using \multicolumn. I am using this table on a two column article.
Thanks

Code: Select all

\begin{table*}[htbp]
\centering
\caption{Table caption}
\begin{tabular}{|*{18}{c|}}
\hline
\multicolumn{9}{|c}{\textbf{k-means clustering}} & \multicolumn{9}{|c|}{\textbf{Fuzzy c-means clustering}} \\ \hline
\multicolumn{3}{|c}{\textbf{50 clusters}} & \multicolumn{3}{|c}{\textbf{60 clusters}} & \multicolumn{3}{|c}{\textbf{70 clusters}} & 
\multicolumn{3}{|c}{\textbf{50 clusters}} & \multicolumn{3}{|c}{\textbf{60 clusters}} & \multicolumn{3}{|c|}{\textbf{70 clusters}} \\ \hline 
\textbf{CJ} & \textbf{HT} & \textbf{SVD} &\textbf{CJ} & \textbf{HT} & \textbf{SVD} &\textbf{CJ} & \textbf{HT} & \textbf{SVD} &\textbf{CJ} & \textbf{HT} & \textbf{SVD} &\textbf{CJ} & \textbf{HT} & \textbf{SVD} &\textbf{CJ} & \textbf{HT} & \textbf{SVD} \\ \hline
 2.453 & 2.453 & 2.453 & 2.453 & 2.453& 2.453 & 2.453& 2.453 & 2.453 & 2.453 &  2.453 & 2.453  &  2.453 & 2.453 & 2.453  &  2.453 &  2.453 &  2.453 \\ \hline
 
\end{tabular}
\raggedright{ \tabnote{CJ= some text, HT= some text, SVD= some text}}
\end{table*}
Attachments
table.jpg
table.jpg (37.53 KiB) Viewed 5693 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Help with width adjustment for table using multicolumn.

Post by Johannes_B »

I don't know your actual setup, please provide a minimum working example next time.

There are many Values in just one line, i don't know if there might be mor rows. But here is a counter proposal using booktabs:

Code: Select all

\documentclass[twocolumn,12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{booktabs}
\usepackage{blindtext}
\begin{document}
\begin{table*}[htbp]
\caption{Table caption about clusters}
\centering
\begin{tabular}{l*{9}{c}}
\toprule
%\multicolumn{9}{c}{{k-means clustering}} & \multicolumn{9}{c}{{Fuzzy c-means clustering}} \\ 
%\multicolumn{3}{c}{{50 clusters}} & \multicolumn{3}{c}{{60 clusters}} & \multicolumn{3}{c}{{70 clusters}}  
&\multicolumn{3}{c}{{50 clusters}} & \multicolumn{3}{c}{{60 clusters}} & \multicolumn{3}{c}{{70 clusters}} \\ 
\cmidrule(lr){2-4}
\cmidrule(lr){5-7}
\cmidrule(lr){8-10}
                          & {CJ}  & {HT}  & {SVD} & {CJ}  & {HT}  & {SVD} & {CJ}  & {HT}  & {SVD} \\
\midrule
k-means & 2.453 & 2.453 & 2.453 & 2.453 & 2.453 & 2.453 & 2.453 & 2.453 & 2.453 \\
 Fuzzy c-means & 2.453 & 2.453 & 2.453 & 2.453 & 2.453 & 2.453 & 2.453 & 2.453 & 2.453 \\
 \bottomrule
 \end{tabular}
\end{table*}
\blindtext[8]
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply