2

I am writing a research paper in double column format but the table is not fitting in the format . It looks like this enter image description here

My table is not displayed properly. This is my code.

\begin{table}[!h]
\centering
    \caption{Results}     
    \label{tab:table}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline 
\multirow{2}{*}{Name} & \multicolumn{3}{c|}{Kannada} & \multicolumn{3}{c|}{Malayalam}\\
\cline{2-7} 
 & (P)\% & (R)\% & (F)\% & A & B & C\\
\hline 
Morfessor CAP &  48.07&60.39    &     53.53 & 47.25 &60.01  &52.88   \\
\hline 
  morpheme induction& 66.78 & 57.97  &  62.07  &60.33   & 59.55  &59.95  \\
\hline 

\hline 
\end{tabular}
\end{table}

How to fix it?

5
  • If you want it to fit in the column, you need to either shrink it or rotate it. You can also use table* to span more than one column. Feb 7, 2015 at 18:12
  • How to do it? using which package?
    – karu
    Feb 7, 2015 at 18:16
  • 1
    no package is needed just use table* rather than table (and remove the [h!] option Feb 7, 2015 at 18:17
  • graphicx (and adjustbox IIRC) support \scalebox \resizebox and \rotatebox Feb 7, 2015 at 18:17
  • But with * it creates a large table in another page
    – karu
    Feb 7, 2015 at 18:19

1 Answer 1

2

The main problem is that the table's first column will become quite wide unless you let the words wrap. I suggest you use a tabularx environment, width set to \columnwidth, and the first column's type set to (a modified form of) X. Reducing the value of the parameter \tabcolsep by about half (from 6pt to 3.5pt and eliminating the whitespace to the left and right of the tabularx environment completes the job obtaining a fit without having to resort to more desperate measures, such a choosing a smaller font size.

I would also suggest you get rid of all vertical bars in the table and use the rule-drawing macros of the booktabs package instead of \hline to get well-spaced horizontal lines.

The first horizontal line in the following screenshot is there just to illustrate the width of column.

enter image description here

\documentclass[twocolumn]{article}
\usepackage{tabularx,booktabs,caption}
\newcolumntype{Z}{>{\raggedright}X}
\begin{document}
\hrule % just to illustrate width of column

\begin{table}[h!]
\caption{Results}\label{tab:table}
\setlength\tabcolsep{3.5pt} % default value: 6pt
\begin{tabularx}{\columnwidth}{@{} Z *{6}{c} @{}}
\toprule 
Name & \multicolumn{3}{c}{Kannada} & \multicolumn{3}{c@{}}{Malayalam}\\
\cmidrule(lr){2-4} \cmidrule(l){5-7} 
& (P)\% & (R)\% & (F)\% & A & B & C\\
\midrule 
Morfessor CAP     &  48.07&60.39    &    53.53 & 47.25 &60.01  &52.88   \\ 
Morpheme induction& 66.78 & 57.97  &  62.07  &60.33   & 59.55  &59.95  \\
\bottomrule 
\end{tabularx}
\end{table}
\end{document}
5
  • creates errors, ! Package array Error: Illegal pream-token (Z): `c' used.See the array package documentation for explanation.Type H <return> for immediate help.... \end{tabularx}
    – karu
    Feb 7, 2015 at 19:09
  • Did you load the tabularx package and execute the instruction \newcolumntype{Z}{>{\raggedright}X}?
    – Mico
    Feb 7, 2015 at 19:11
  • Yes. I have included the file in the directory and used using \include
    – karu
    Feb 7, 2015 at 19:22
  • @karu - \include -- what? You haven't confirmed whether you've run the \newcolumntype instruction. LaTeX will definitely choke on the code shown above unless you run that command.
    – Mico
    Feb 7, 2015 at 19:24
  • Got the result, it is working fine
    – karu
    Feb 7, 2015 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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