2

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}
4
  • In your supertabular you have told it to be as wide as the \textwidth, so it's doing what you're telling it to!
    – cmhughes
    Jan 19, 2012 at 17:42
  • @cmhughes I tried removing it, but if I do it gives me an error. What should I specify instead of that?
    – Alenanno
    Jan 19, 2012 at 17:43
  • 1
    Use \begin{supertabular}{|c|c... instead of \begin{supertabluar*}{\textwidth}...
    – cmhughes
    Jan 19, 2012 at 17:45
  • @cmhughes That worked! If you post that as an answer I can accept it. Thanks. :) Like I said, I am not that expert. When you post it, could you include what is that * meaning? Or some links would be good too.
    – Alenanno
    Jan 19, 2012 at 17:49

1 Answer 1

3

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.

You must log in to answer this question.

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