1

I'm trying to to create a table with many columns, but the horizontal line shows up as incomplete. I also want to have the column width adapt to the content if possible, but I've just been able to adjust it to the width that I want. Any help would be greatly appreciated!

\documentclass{article}


\begin{document}
\SweaveOpts{concordance=TRUE}

\begin{table}[hbtp]
\footnotesize\setlength{\tabcolsep}{2.5pt}
\begin{tabular*}{0.75\textwidth}{| l l c c c c c c c c c c |}
\hline
  Regular name & Second name & Code & $p$ & $fp$ & $\fpg$ & $N$ & $p$ & $s$ & $N$ & $\Delta N$\\ 
\hline
\textit {A} &  A &  A & 0.025 & 0.2  & 0.68& 104 & 0.2  & 0.7 & 108 & 4\\ 
\textit {B} &  B &  B &     0.01 &  0.09 &  0.29 &  44 &    0.09 &  0.35 &  53 &    9\\
\textit {C} &   C & C &     0.02 &  0.05 &  0.105    & 15 &     0.05 &  0.17 &  25 &    10\\
\textit {D} &   D & D & 0.018 & 0.25 &  0.72 &  109 &   0.25 &  0.74 &  112 &   3\\
\textit {E} &   E & E & 0.023 & 0.6 &   0.99 &  152 &   0.6 &   0.99 &  152 &   0\\
\textit {F} &   F & F & 0.11 &  0.04 &  0.06 &  9 & 0.04 &  0.1 &   14 &    5\\
\textit {G} &   G & G & 0.01 &  0.43 &  0.76 &  116 &   0.43 &  0.77 &  118 &   2\\
\textit {H} &   H & H & 0.01 &  0.54 &  0.98 &  150 &   0.54 &  0.98 &  150 &   0\\
\textit {I} &   I & I & 0.19 &  0.1 &   0.26 &  39 &    0.1 &   0.36 &  55 &    16\\
\textit {J} &   J    & J & 0.023 & 0.23 &   0.73 &  112 &   0.23 &  0.79 &  120 & 8\\ 
\hline 
\end{tabular*}
\caption{title}
\label{tab:tab1}
\end{table}
%

\end{document}
1
  • That worked- thanks! I had just tried removing it and did not think of adjusting it. Mar 25, 2014 at 23:16

1 Answer 1

2

There is no stretch glue added between the columns so latex has no way to make the table the specified target width, even if the columns fitted in the specified width, which they don't (which accounts for the overfull box warning), Just use tabular not tabular*:

\begin{tabular}{| l l c c c c c c c c c c |}
2
  • When I tried to use just tabular and not tabular*, and remove the text width command, it failed to compile for some reason. Mar 25, 2014 at 23:16
  • @user2223454 impossible to guess what your error was (unrelated to that change) If you make that change (and comment out the undefined sweave command) your table runs without error and fits in the page. Mar 25, 2014 at 23:19

You must log in to answer this question.

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