# How to get a footer line in a longtable

I'm trying to do this

\documentclass{article}
\usepackage{longtable}
\title{A longtable example}

\begin{document}
\begin{longtable}[h!]{|c|| c|| c|| c|| c|| c|| c|}
\hline
\hline
{Data} & {$\beta_{UP}$} & {$\beta_{LOW}$} & {$\beta_{TEL}$} & {$R_{UP}$} & {$R_{LOW}$}  & {$R_{TEL}$} \\
\hline
200604     &  0.0437  &  0.0087 & -0.0963  &  0.17  &  0.05  & -0.46\\
200605     &  0.0317  &  0.0478 & -0.1136  &  0.20  &  0.40  & -0.61\\
200606     & -0.0699  & -0.0418 & -0.0420  & -0.21  & -0.16  & -0.005\\
200607     & -0.0783  & -0.0483 & -0.0868  & -0.24  & -0.19  & -0.25\\
...
200608     & -0.0551  & -0.0734 & -0.1932  & -0.27  & -0.41  & -0.63\\
201410     & -0.0609  & -0.0849 & -0.3131  & -0.06  & -0.06  & -0.38\\
201411     & -0.0279  & -0.0849 & -0.2353  & -0.03  & -0.09  & -0.29\\
201412     &  0.0884  & -0.0252 & -0.1411  &  0.08  & -0.02  & -0.12 \\
\hline
\caption{table1}
\label{table1}
\end{longtable}

\end{document}


But the result is this

when the table is broken have no line at the end of page. How can I add a horizontal line when the table is broken?

Only one thing more, when I create the longtable the caption is centered in strange way and it is not set as textwidth (usually). As it is shown in the following figure, at the top is the longtable and bellow a typical table.

• [h!] is a syntax error, you can put a \hline in the table foot so it comes at the bottom of the page. Please always make examples complete documents so people can see the problem and test answers. – David Carlisle Jan 5 '16 at 1:00
• don't use math-talic for multi-letter words: \beta_{TEL} should be \beta_{\mathrm{TEL}} (or \mathit if you want italic) – David Carlisle Jan 5 '16 at 1:01
• Thanks @DavidCarlisle, The caption of the longtable was centered in a strange way, in the other tables that I have this dont happen – nandhos Jan 5 '16 at 15:58

\hline
\endfoot
\endlastfoot


to the longtable structure. This creates non-empty \endfoot material along with empty \endlastfoot material.

In addition, you may want to provide better formatting of the data content of the table, e.g., by aligning the numbers on their respective decimal markers.

\documentclass{article}
\usepackage{longtable}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c||}{#1}}
\begin{document}
\begin{longtable}{| c|| *{3}{d{2.4}||} *{3}{d{2.3}||}}
\hline
\hline
Data & \mc{$\beta_{UP}$} & \mc{$\beta_{LOW}$} & \mc{$\beta_{TEL}$} &
\mc{$R_{UP}$} & \mc{$R_{LOW}$}  & \mc{$R_{TEL}$} \\
\hline
\hline
\endfoot
\endlastfoot
200604     &  0.0437  &  0.0087 & -0.0963  &  0.17  &  0.05  & -0.46\\
200605     &  0.0317  &  0.0478 & -0.1136  &  0.20  &  0.40  & -0.61\\
200606     & -0.0699  & -0.0418 & -0.0420  & -0.21  & -0.16  & -0.005\\
200607     & -0.0783  & -0.0483 & -0.0868  & -0.24  & -0.19  & -0.25\\
...& & & & & & \\
200608     & -0.0551  & -0.0734 & -0.1932  & -0.27  & -0.41  & -0.63\\
201410     & -0.0609  & -0.0849 & -0.3131  & -0.06  & -0.06  & -0.38\\
201411     & -0.0279  & -0.0849 & -0.2353  & -0.03  & -0.09  & -0.29\\
201412     &  0.0884  & -0.0252 & -0.1411  &  0.08  & -0.02  & -0.12 \\
\hline
\caption{table1}
\label{table1}
\end{longtable}
\end{document}


Addendum: Your table currently features lots of double vertical and double horizontal lines which don't really improve its legibility. In fact, I'd say they give it a very 'caged' and prison-like look. Do consider getting rid of all vertical lines and replacing the horizontal lines with well-spaced lines by using the macros of the booktabs package. I'm pretty sure that both you and the readers of your document will appreciate the resulting, more 'open' look.

\documentclass{article}
\usepackage{longtable}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\usepackage{amsmath,booktabs,caption}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\begin{document}
\begin{longtable}{ c *{3}{d{2.4}} *{2}{d{2.2}} d{2.3}}
\toprule
Data & \mc{$\beta_{\textit{UP}}$} & \mc{$\beta_{\textit{LOW}}$} & \mc{$\beta_{\textit{TEL}}$} &
\mc{$R_{\textit{UP}}$} & \mc{$R_{\textit{LOW}}$}  & \mc{$R_{\textit{TEL}}$} \\
\midrule
\bottomrule
\endfoot
\endlastfoot
200604     &  0.0437  &  0.0087 & -0.0963  &  0.17  &  0.05  & -0.46\\
200605     &  0.0317  &  0.0478 & -0.1136  &  0.20  &  0.40  & -0.61\\
200606     & -0.0699  & -0.0418 & -0.0420  & -0.21  & -0.16  & -0.005\\
200607     & -0.0783  & -0.0483 & -0.0868  & -0.24  & -0.19  & -0.25\\
\vdots\\
200608     & -0.0551  & -0.0734 & -0.1932  & -0.27  & -0.41  & -0.63\\
201410     & -0.0609  & -0.0849 & -0.3131  & -0.06  & -0.06  & -0.38\\
201411     & -0.0279  & -0.0849 & -0.2353  & -0.03  & -0.09  & -0.29\\
201412     &  0.0884  & -0.0252 & -0.1411  &  0.08  & -0.02  & -0.12 \\
\bottomrule
\caption{table1, no vertical bars, better-spaced horizontal rules}
\label{table1}
\end{longtable}
\end{document}