1

i have this code

\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{|c|c|c|c|c|c|}
    \hline
    \multirow{3}[4]{*}{Tested Text} & \multicolumn{5}{c|}{\multirow{2}[2]{*}{         Training Text (tested text is not included)}}\\
          & \multicolumn{5}{c|}{} \\
\cline{2-6}          & BI    & IK    & MR    & MA    & TO \\
    \hline
    BI    &       &       &       &       &  \\
    \hline
    IK    &       &       &       &       &  \\
    \hline
    MR    &       &       &       &       &  \\
    \hline
    MA    &       &       &       &       &  \\
    \hline
    TO    &       &       &       &       &  \\
    \hline
    \end{tabular}%
  \label{tab:addlabelkiki}%
\end{table}%

I don't understand why last column is larger than other as shown in the figurepic?

any sugesstion

2 Answers 2

0

You can replace your code with:

\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{|c|c|c|c|c|c|}
    \hline
    \multirow{3}[4]{*}{Tested Text} & \multicolumn{5}{c|}{Training Text }\\
          & \multicolumn{5}{c|}{(tested text is not included)} \\
\cline{2-6}          & BI    & IK    & MR    & MA    & TO \\
    \hline
    BI    &       &       &       &       &  \\
    \hline
    IK    &       &       &       &       &  \\
    \hline
    MR    &       &       &       &       &  \\
    \hline
    MA    &       &       &       &       &  \\
    \hline
    TO    &       &       &       &       &  \\
    \hline
    \end{tabular}%
  \label{tab:addlabelkiki}%
\end{table}%

In this way you split in two parts the sentence Training Text (tested text is not included) without wraping.

5

I am not really an expert in these matters, but since nobody else has really answered the question... Is it not that the extra width is needed for the "header" text in the \multicolumn box above?

When the table is put together, it goes through the preceding columns but because they are all empty they are just sized by the width of the two letters you have put in. It gets to the last column, and suddenly realises it needs to provide extra width to fit the remaining "header" text in. The answer given by @marchetto thus minimises the problem because you've shortened the "header" text. Equally, if you had longer text in the blank boxes, the column widths would be different. E.g.

\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{|c|c|c|c|c|c|}
    \hline
    \multirow{3}[4]{*}{Tested Text} & \multicolumn{5}{c|}{\multirow{2}[2]{*}{Training Text (tested text is not included)}}\\
          & \multicolumn{5}{c|}{} \\
\cline{2-6}          & BI    & IK    & MR    & MA    & TO \\
    \hline
    BI    &     Here are  & some  & words &   in your columns &  \\
    \hline
    IK    &       &       &       &       &  \\
    \hline
    MR    &       &       &       &       &  \\
    \hline
    MA    &       &       &       &       &  \\
    \hline
    TO    &       &       &       &       &  \\
    \hline
    \end{tabular}%
  \label{tab:addlabelkiki}%
\end{table}%

You can force column widths by defining yourself some new column styles. I read how to do it somewhere on here so can't take any credit for the method, but here you go:

\documentclass[12pt, a4paper, oneside, fleqn]{report}

\usepackage{multirow} 
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}

\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{|c|C{1.5cm}|C{1.5cm}|C{1.5cm}|C{1.5cm}|C{1.5cm}|}
    \hline
    \multirow{3}[4]{*}{Tested Text} & \multicolumn{5}{c|}{\multirow{2}[2]{*}{Training Text (tested text is not included)}}\\
          & \multicolumn{5}{c|}{} \\
\cline{2-6}          & BI    & IK    & MR    & MA    & TO \\
    \hline
    BI    &       &       &       &       &  \\
    \hline
    IK    &       &       &       &       &  \\
    \hline
    MR    &       &       &       &       &  \\
    \hline
    MA    &       &       &       &       &  \\
    \hline
    TO    &       &       &       &       &  \\
    \hline
    \end{tabular}%
  \label{tab:addlabelkiki}%
\end{table}%

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .