1

I am using package longtable. When I actually place a 'long table', at the page-end I've a row without any hline below it (which was also expected as there isn't any in the code). See this code -

\documentclass{article}
\usepackage{longtable}

\begin{document}
    \begin{longtable}{cc}
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
    \end{longtable}
\end{document}

But if I try to put one hline manually I've two issues -

  1. hline comes on the next page.
  2. I've to adjust the hlines whenever I add some data.

If you see page 1 of the provided code, the table ends without one hline and on page 2 table starts without an hline. I want a package which will provide me auto-bordered tables over the pages. Which means even though no specific commands are issued, new page will auto generate the borders.

3

1 Answer 1

2

Here is your MWE. You have to remove the \hline from the first line of the code, and have headers and footer that only contain a \hline (if you do not want text that is repeated on every page). It is lot of information in the longtable manual:

enter image description here

\documentclass{article}
\usepackage{longtable}

\begin{document}
    \begin{longtable}{cc}

\hline
\endfirsthead
\hline
\endhead
\hline
\endfoot
\hline
\endlastfoot


        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
        abcd&efgh\\
        abcd&efgh\\
        abcd&efgh\\
        \hline
    \end{longtable}
\end{document}

You must log in to answer this question.

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