With the environment longtable
we make a table crossing the page boundary.
If a table has a head (\endhead
command), longtable
works perfectly: the baseline of the first line in a usual text page and the baseline of the first line of text in the table are coinside.
But, if a table doesn't have a head, the baseline of the first line of text in the table is lower then the baseline of the first line in a usual text page.
How to reduce the space between top of a page and a table without head?
Is it possible to slightly modify the longtable
package so that all tables in a document would be fixed?
\documentclass{article}
\usepackage[a5paper]{geometry}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{longtable}
\pagestyle{fancy}
\rhead{\thepage}
\lhead{\thepage}
\begin{document}
\lipsum[2]
\begin{longtable}{|p{0.4\textwidth}|p{0.4\textwidth}|}
\hline
Header & Header \\
%\endhead %% Uncomment this line for table with head
\hline
\lipsum[2] & \lipsum[2] \\
\hline
\lipsum[2] & \lipsum[2] \\
\hline
\end{longtable}
\end{document}
\topskip
to 0pt doesn't solve the problem. Actually, we should reduce\topskip
by some amount of space. In my case, this amount is height of vertical rule, which presents part of left border of the first cell. It depends on the content of the first lines of top table cells. In my case it is always 8.4pt, because font doesn't change and lines contain only letters, and start with capital letters. This\topskip
later will be reduced by 0.4pt, the thickness of top border. I think, it can be somehow implemented inlongtable.sty
.\hline
and so that aligns on the first baseline. Probably the easiest thing is to always have a head, if you put the hline and the first row in\endfirsthead
then it should work I think. You don't need to have a head on the later pages.\hline
. But\endfirsthead
without\endhead
doesn't solve problem.\topskip=1.6pt
. But it is too simple. ;-)