0

Why text is going out of cell when using \textbf in table and tabular block?

enter image description here

In this snapshot MLP is a normal text but SVM and LR are \textbf. What should i do?

Code sample (A part of the code):

\begin{table}
  \caption{review}
  \centering
  \begin{tabular}{c | c c c c c}
    \hline
    \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{90}{\textbf{SVM}}}} & Food & 3 & 55 & 21 & 034\\
     & Textile & 12 & 54 & 43 & 21\\
  \dhline

     \Xhline{2.5\arrayrulewidth}    
  \end{tabular} 
  \label{testing}
  \end{table}
4
  • Because the text is wider than the allotted space. But without a minimal example of code it's impossible to suggest a workaround.
    – egreg
    Commented Sep 13, 2015 at 11:13
  • What is this \dhline? Furthermore, the column heads do not appear in your code.
    – Bernard
    Commented Sep 13, 2015 at 11:25
  • 1
    you can not have \multirow inside a \parbox what do you expect this to do? But please always make the example a complete document that shows the problem, it is impossible for anyone to run the fragment as posted. Commented Sep 13, 2015 at 11:28
  • 2
    you have tagged this as tabularx but the example does not use that package. Commented Sep 13, 2015 at 11:28

1 Answer 1

5

Why making a simple table complicate? There is no need for rotated cell entries, they are very difficult to read. Mostly headers are rotated as an emergency to save some space if the data in the column are small, but the header is too wide.

Here a version plain and simple:

\documentclass{article}
\usepackage{booktabs}
\begin{document}
  \begin{tabular}{ccrrrr}
    \toprule
    \bfseries Model & \bfseries Section \\
    \midrule
    \bfseries MLP & Food & 3 & 55 & 21 & 34 \\
    & Textile & 12 & 54 & 43 & 21 \\
    \addlinespace
    \bfseries SVM & Food & 4 & 56 & 22 & 35 \\
    & Textile & 9 & 8 & 7 & 6 \\
    \addlinespace
    \bfseries LR & Food & 30 & 5 & 99 & 1 \\
    & Textile & 12 & 34 & 56 & 78 \\
    \bottomrule
  \end{tabular}
\end{document}

Result

You must log in to answer this question.

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