Why is a longtable environment on top of pages vertically placed different to a tabular environment? I'm digging several days on this question and didn't find a way to align the longtable vertically in the same way.
Code:
\documentclass[11pt,a4paper]{article}
\usepackage{longtable}
\newcommand{\lorem}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pellentesque iaculis nunc eget congue. Etiam lobortis nisi velit. Proin tristique massa a lectus ullamcorper semper. Aenean ut dignissim diam. Integer ullamcorper eros nibh. Cras molestie neque quis lectus lobortis egestas. Maecenas vel tortor in nulla sagittis venenatis. Nulla ac eros dui, eget lacinia ante. Fusce elementum nisl ac tortor hendrerit id lacinia orci malesuada. Praesent eu iaculis mi. Vestibulum sodales tempor rutrum. }
\newcommand{\examplelongtable}{%
\begin{longtable}{|l|p{58mm}|}
%
\hline
\endfirsthead
%
\hline\multicolumn{2}{|l|}{\textsl{\ldots continued}}
\endhead
%
\multicolumn{2}{|l|}{\textsl{will be continued\ldots}}\\*
\hline
\endfoot
%
\hline
\endlastfoot
%
aa: & 4711\\
\hline%
aaa: & 2\\
\hline%
aaaa: & 4711-2\\
\end{longtable}
}
\newcommand{\exampletabular}{%
\begin{tabular}[H]{|l|p{58mm}|}
\hline
aa: & 4711\\
\hline%
aaa: & 2\\
\hline%
aaaa: & 4711-2\\
\hline
\end{tabular}
}
\setlength{\parskip}{1.0\baselineskip}
\setlength{\LTpre}{0pt}
\setlength{\LTpost}{0pt}
\setlength{\LTleft}{\parindent}
\begin{document}
\exampletabular
\lorem
\lorem
\lorem
\lorem
\lorem
\examplelongtable
\end{document}
Supposedly there is a very simple solution, but I seem to be unable to find it...
If I explicitly set a \newpage before the longtable example, an adapted \vspace*{-...} would help, but not on a regular page-break, where the source code doesn't "know" where it occurs.
[H]option totabular. If you use[t], instead, the alignment will be the same. – egreg Sep 18 '12 at 17:26\topskip. The top element in the table, the top line, is aligned with the baseline of the first line in the text body. In the case oflongtable. Here the first header box has height 0.4pt because of the rule. Then 10.6pt of\topskip(11pt) are added. – Heiko Oberdiek Sep 18 '12 at 18:16tableandfloatpackage. At the top, both tables are equally aligned with\begin{tabular}[t]{|l|p{58mm}|}- but, can anyone explain, why not at bottom, too? Putting one more\loremat the end shows about 5.0pt more distance than belowtabular... – tueftl Sep 26 '12 at 06:21[t]tabularand alongtable; a[t]tabularis set in a\halignwrapped in a\vtop, which means that only the first row contributes to the height of the box, the rest is depth; thus the interline glue after thistabularwill quite certainly be\lineskip. On the contrary,longtablemakes only the\halign, so that each row contributes autonomously to height and depth. – egreg Sep 26 '12 at 09:07tabularandlongtable), the more it's getting intricated and I'm tinkering with the idea to give up :-( Now the\noalign{\kern-\topskip}before\hline\endfirstheadseems to be completely ignored... @DavidCarlisle No, I don't know exactly what I'm doing there and if that is correct. Maybe I'll try to get a MWE from it. – tueftl Sep 26 '12 at 11:14