[Tex/LaTex] Why the horizontal line behaves differently in supertabular and tabular

rulessupertabulartables

I have a problem using the supertabular package. Basically the horizontal lines, instead of stopping at the end of the table, continue until the end of the page.

This is a self-explaining screenshot. The first is a supertabular, the second is a tabular:

screenshot

And here's the code. I tried to cut it in order to make it as short as possible but still keeping it functioning. What am I doing wrong? I'm not very expert at LaTeX so I might be missing something.

\documentclass[a4paper,12pt]{book}

\usepackage{supertabular}       
\usepackage{array}
\usepackage[]{geometry}
%\newcolumntype{v}[1]{>{\raggedright \arraybackslash\hspace{0pt}}p{#1}}

\begin{document}

\tablehead {%
\hline
0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \tabularnewline
}
\tabletail{%
}
\label{tab:lead_overview}

\begin{supertabular*}{\textwidth}{ | c | c | c | c | c | c | c | c | c | c | c | c | }
    \hline
    0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \tabularnewline
    \hline
\end{supertabular*}


\begin{tabular}{ | c | c | c | c | c | c | c | c | c | c | c | c | }
     \hline
    0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11  \\ \hline
    0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11  \\ \hline
\end{tabular}


\end{document}

Best Answer

You are using supertabular* which is used in the same way as tabular*, i.e, it takes a width as its first argument.

You have specified the width of your supertabular* as \textwidth, so your \hline is drawn across the width of the page.

From your question, it sounds like you would prefer to use the supertabular environment, which does not take a width as its first argument. In the context of your example, it sounds like you want the following code:

\begin{supertabular}{ | c | c | c | c | c | c | c | c | c | c | c | c | }
    \hline
    0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \tabularnewline
    \hline
\end{supertabular}

For further reading, start with the documentation

texdoc supertabular

and you can also have a look at the booktabs documentation, which gives some excellent discussion/advice on constructing tables.

Related Question