When the long tables in my book reaches the end of a page, the vertical lines with no hline look very unappealing. Can longtable add an hline or maybe a thinner line at each pagebreak?
[Tex/LaTex] Add a horizontal line after last line on each page in longtable
longtable
Related Solutions
As I said, read the console output. It tells you precisely what the problem is and precisely what to do about it.
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 60.50554pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
Setting the headheight=61pt
in geometry
's options solves the problem. Note, however, that you have inconsistent and bizarre layout options scattered throughout the preamble, which is a recipe for trouble and confusion.
If combined, you end up with something like this
\usepackage[margin=1in,headheight=61pt,layout=a4paper,top=0.1cm,headsep=0pt]{geometry}
So you are setting all margins to 1" and then resetting the top one to 1mm. You are also setting the layout to A4 and the paper size to US letter. While it is possible that you really do need this configuration, it does seem rather unlikely.
Adding showframe
, for example, we get this
Note that the whole point of longtable is that it does the breaking for you. If you are going to break up the table yourself, you might just as soon use tabular
s. Keep starting and stopping the longtable
environment will lead to inconsistent formatting and spacing.
Your problem here is that you wrote command \caption{...}
at the end of the table.
A longtable
has a special structure you should use. Please read the documentation (use texdoc longtable
on your terminal/console)!
Just add after command \endfoot
the following code:
\hline % <=======================================================
\caption{hello} % <===================================================
\endlastfoot % <=======================================================
to get what you want.
After some pretty printing and deleted not used packages here you get the following MWE
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[protrusion=true, expansion=true]{microtype}
\usepackage[a4paper]{geometry}
\geometry{%
a4paper,tmargin=3.5cm, bmargin=2.5cm, lmargin=1.5cm, rmargin=1.5cm,
headheight=3em, headsep=1.5cm, footskip=1cm
}
\usepackage[table,xcdraw]{xcolor}
\definecolor{mColor1}{rgb}{0.9,0.9,0.9}
\usepackage{longtable}
\usepackage{setspace}
\usepackage{pdflscape}
\usepackage[font=small, labelfont=bf]{caption}
\newcommand{\HRule}[1]{\rule{\linewidth}{#1}}
\onehalfspacing
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}
\begin{document}
\begin{landscape}
\begin{longtable}{| p{2.5cm} | p{2.2cm} | p{2cm} |p{2cm} |p{2.5cm} |p{3.8cm} |p{4cm} |p{3cm}|}
\hline
\rowcolor{mColor1} Form Filename&Date&Status&Charge ID&Amount&Charge is on&ROI&Certificate Filename \\
\hline
\endhead
\hline
\endfoot
\hline % <=======================================================
\caption{hello} % <===================================================
\endlastfoot % <=======================================================
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
%\hline % <===================================================
\end{longtable}
\end{landscape}
\end{document}
with the resulting last table page:
EDIT:
To get a better result I suggest some changings in your table.
- A long table better has a heading at the beginning of the table (see code from beginning of the table until
\endfirsthead
. In the code for the\endfoot
you can add a notice that table is to be continued ... See for more informations the documentation oflongtable
(for example withtexdoc longtable
). - I deleted the color for your first table row and I deleted the vertical lines. The result is a better looking table imho.
- With using packages
ragged2e
andarray
you get a command\RaggedRight
which allows a better hyphenating in your table columns. For example use>{\RaggedRight}p{2.5cm}
to get the first column left justified with better hyphenation. - With
\usepackage{booktabs}
you can use the commands\toprule
,\midrule
and\bottomrule
to get nice horizontal rules in your table where needed.
Please see the following MWE (code changes marked with <=========
):
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[protrusion=true, expansion=true]{microtype}
\usepackage[a4paper]{geometry}
\geometry{%
a4paper,tmargin=3.5cm, bmargin=2.5cm, lmargin=1.5cm, rmargin=1.5cm,
headheight=3em, headsep=1.5cm, footskip=1cm
}
\usepackage{longtable,array} % <========================================
\usepackage{setspace}
\usepackage{pdflscape}
\usepackage{booktabs} % <========== \toprule etc.
\usepackage{ragged2e} % <========== \RaggedRight
\usepackage[font=small, labelfont=bf]{caption}
\onehalfspacing
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}
\begin{document}
\begin{landscape}
\begin{longtable}{>{\RaggedRight}p{2.5cm} >{\RaggedRight}p{1.5cm} >{\RaggedRight}p{2cm} >{\RaggedRight}p{2cm} >{\RaggedRight}p{2.5cm} >{\RaggedRight}p{3.8cm} >{\RaggedRight}p{4cm} >{\RaggedRight}p{3cm}}
%\begin{longtable}{p{2.5cm} p{1.5cm} p{2cm} p{2cm} p{2.5cm} p{3.8cm} p{4cm} p{3cm}}
\caption{hello} \\ % <================================================
\toprule
Form Filename&Date&Status&Charge ID&Amount&Charge is on&ROI&Certificate Filename \\
\midrule
\endfirsthead
\toprule
Form Filename&Date&Status&Charge ID&Amount&Charge is on&ROI&Certificate Filename \\
\midrule
\endhead
\midrule
to be continued \\
\bottomrule
\endfoot
\bottomrule % <===================================================
% \caption{hello} % <===================================================
\endlastfoot % <=======================================================
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
Form 8-190706.do&-&Modification&80006325&500,000,000&Furniture, Plant Machinery, Book debts, Stock in trade&-&-\\
\end{longtable}
\end{landscape}
\end{document}
you get the following result:
Best Answer
use
at the start of the table so it adds a line at the bottom of each page.