4

I've this weird problem where the horizontal lines in a table are overflowing. It might be due to one of the many packages, I'm not sure. Is there a way to forcefully fix the table border.

The latex code used to generate the table is this

\begin{table}%[h]
\caption{test} % title of Table
\centering  % used for centering table
\begin{tabular}{|c|c|c|c|c|} \hline
T & t1  & t2  & t3 & t4 \\ \hline
a & 10\%  & 40\% & 70\% & 95\% \\ \hline
b & 20\%  & 50\% & 80\% & 98\% \\ \hline
c & 30\%  & 650\% & 90\% & 99\% \\ \hline
\end{tabular}
\end{table}

Sample image is:

https://i.sstatic.net/0VjCB.png

2

1 Answer 1

1

You need to use \\ \hline (you were missing a slash prior to the \hline):

enter image description here

Code:

\documentclass{article}
\begin{document}
\begin{table}%[h]

\caption{test} % title of Table 
\centering % used for centering table 
\begin{tabular}{|c|c|c|c|c|} \hline 
T & t1 & t2 & t3 & t4 \\ \hline 
a & 10\% & 40\% & 70\% & 95\% \\ \hline 
b & 20\% & 50\% & 80\% & 98\% \\ \hline 
c & 30\% & 650\% & 90\% & 99\% \\ \hline 
\end{tabular} 
\end{table}
\end{document}
4
  • The \\ is not the problem. Also some of the tables have this problem while others are fine. I don't know why the line is not wrapping properly. The text is small and not overflowing the cell.
    – palhello
    Commented Jun 29, 2012 at 1:33
  • @palhello: Ok, the image was not there when I posted my answer based on your original MWE. That is probably an artifact of your viewer. Try viewing in Acrobat. Commented Jun 29, 2012 at 1:34
  • I don't see any change in code. I'm using other packages and it must be ruining this. Any way to fix this without going into the packages ? I am viewing it in the acrobat viewer. This is really weird. Some tables are perfect while others are imperfect. I'm using pdflatex.
    – palhello
    Commented Jun 29, 2012 at 1:37
  • 2
    You need to post a complete compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate package. The code you posted does not show the problem. Also try zooming in and make sure the you still see the problem. Commented Jun 29, 2012 at 1:42

You must log in to answer this question.

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