# Why one cell in a table have different height?

I am trying to make a table having equal height and width to all the cells. I tried this code:

\documentclass[conference]{IEEEtran}
\setlength{\extrarowheight}{1pt}
\begin{table}
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{|*{12}{p{1.0cm}|}}
\hline
labels     & airplane & automobile & bird & cat & deer & dog & frog & horse & ship & truck & accuracy \\ \hline
airplane   & 915      & 4          & 17   & 19  & 3    & 1   & 0    & 2     & 27   & 12    & 91.50\%  \\ \hline
automobile & 8        & 934        & 3    & 4   & 0    & 0   & 3    & 0     & 10   & 38    & 93.40\%  \\ \hline
bird       & 60       & 1          & 813  & 37  & 19   & 23  & 30   & 10    & 7    & 0     & 81.30\%  \\ \hline
cat        & 18       & 1          & 34   & 746 & 25   & 113 & 37   & 18    & 8    & 0     & 74.60\%  \\ \hline
deer       & 24       & 1          & 38   & 33  & 809  & 19  & 44   & 29    & 2    & 1     & 80.90\%  \\ \hline
dog        & 4        & 0          & 37   & 106 & 23   & 792 & 9    & 26    & 2    & 1     & 79.20\%  \\ \hline
frog       & 2        & 5          & 19   & 35  & 1    & 20  & 912  & 2     & 3    & 1     & 91.20\%  \\ \hline
horse      & 14       & 0          & 26   & 20  & 18   & 28  & 4    & 886   & 3    & 1     & 88.60\%  \\ \hline
ship       & 35       & 10         & 3    & 2   & 0    & 2   & 1    & 0     & 936  & 11    & 93.60\%  \\ \hline
truck      & 23       & 37         & 4    & 10  & 1    & 2   & 2    & 0     & 15   & 906   & 90.60\%  \\ \hline
\end{tabular}
\end{table}


and got output like below:

I couldn't figure out why the third row i.e automobile row is having different height.. Why is that??

• You need to provide more information (a minimum working example, starting with \documentclass). But I suspect that the word automobile is running up against a column margin, perhaps. – Steven B. Segletes Apr 20 '16 at 18:57
• I edited by giving the document class.. and i tried by increasing the width of the columns and it works – Setu Kumar Basak Apr 20 '16 at 19:01
• ...and the preamble content, too. What packages are loaded and in what order could affect things. You really need to post a compileable document that produces the image you show. – Steven B. Segletes Apr 20 '16 at 19:02
• you have defined all the cells as paragraphs, so anything that exceeds the specified width will force an additional line. "automobile" does this. (you can tell because the space to its right is wider than the space to its left; there will also be a warning in the log file.) – barbara beeton Apr 20 '16 at 19:22
• how can i make the text inside cell to left aligned?? – Setu Kumar Basak Apr 20 '16 at 19:28

I propose two solutions, with tabularx, siunitx and eqparbox, for different alignments in columns:

\documentclass[conference]{IEEEtran}
\usepackage{showframe, eqparbox, siunitx} \usepackage{tabularx}
\setlength{\extrarowheight}{2pt}
\newlength{\colwd}

\begin{document}

\begin{table*}
\centering
\setlength\tabcolsep{3.5pt}
\caption{My caption}
\label{my-label}
\begin{tabularx}{\linewidth}{|*{12}{ >{\centering\arraybackslash}X|}}%{|*{12}{p{1.1cm}|}}%
\hline
labels & airplane & automobile & bird & cat & deer & dog & frog & horse & ship & truck & accuracy \\ \hline
airplane & 915 & 4 & 17 & 19 & 3 & 1 & 0 & 2 & 27 & 12 & 91.50\,\% \\ \hline
automobile & 8 & 934 & 3 & 4 & 0 & 0 & 3 & 0 & 10 & 38 & 93.40\,\% \\ \hline
bird & 60 & 1 & 813 & 37 & 19 & 23 & 30 & 10 & 7 & 0 & 81.30\,\% \\ \hline
cat & 18 & 1 & 34 & 746 & 25 & 113 & 37 & 18 & 8 & 0 & 74.60\,\% \\ \hline
deer & 24 & 1 & 38 & 33 & 809 & 19 & 44 & 29 & 2 & 1 & 80.90\,\% \\ \hline
dog & 4 & 0 & 37 & 106 & 23 & 792 & 9 & 26 & 2 & 1 & 79.20\,\% \\ \hline
frog & 2 & 5 & 19 & 35 & 1 & 20 & 912 & 2 & 3 & 1 & 91.20\,\% \\ \hline
horse & 14 & 0 & 26 & 20 & 18 & 28 & 4 & 886 & 3 & 1 & 88.60\,\% \\ \hline
ship & 35 & 10 & 3 & 2 & 0 & 2 & 1 & 0 & 936 & 11 & 93.60\,\% \\ \hline
truck & 23 & 37 & 4 & 10 & 1 & 2 & 2 & 0 & 15 & 906 & 90.60\,\% \\ \hline
\end{tabularx}
\end{table*}
%
\begin{table*}
\centering
\setlength\tabcolsep{3.5pt}
\sisetup{table-format=3.0, table-number-alignment=center}
\caption{My caption}
\label{thy-label}
\begin{tabularx}{\linewidth}{|l|*{10}{S[]|}S[table-format =2.2,table-space-text-post = \,\%]}%{|*{12}{p{1.1cm}|}}%
\hline
airplane & 915 & 4 & 17 & 19 & 3 & 1 & 0 & 2 & 27 & 12 & 91.50\,\% \\ \hline
automobile & 8 & 934 & 3 & 4 & 0 & 0 & 3 & 0 & 10 & 38 & 93.40\,\% \\ \hline
bird & 60 & 1 & 813 & 37 & 19 & 23 & 30 & 10 & 7 & 0 & 81.30\,\% \\ \hline
cat & 18 & 1 & 34 & 746 & 25 & 113 & 37 & 18 & 8 & 0 & 74.60\,\% \\ \hline
deer & 24 & 1 & 38 & 33 & 809 & 19 & 44 & 29 & 2 & 1 & 80.90\,\% \\ \hline
dog & 4 & 0 & 37 & 106 & 23 & 792 & 9 & 26 & 2 & 1 & 79.20\,\% \\ \hline
frog & 2 & 5 & 19 & 35 & 1 & 20 & 912 & 2 & 3 & 1 & 91.20\,\% \\ \hline
horse & 14 & 0 & 26 & 20 & 18 & 28 & 4 & 886 & 3 & 1 & 88.60\,\% \\ \hline
ship & 35 & 10 & 3 & 2 & 0 & 2 & 1 & 0 & 936 & 11 & 93.60\,\% \\ \hline
truck & 23 & 37 & 4 & 10 & 1 & 2 & 2 & 0 & 15 & 906 & 90.60\,\% \\ \hline
\end{tabularx}
\end{table*}

\end{document}