无头排长桌

无头排长桌

longtable没有头部行,它不是从页面顶部开始,而是有偏移。这是错误还是功能?我该如何修复它?

梅威瑟:

\documentclass[twoside]{article}

\usepackage[paper=a5paper,left=10mm,right=15mm,top=15mm,bottom=20mm,
showframe]{geometry}

\usepackage{longtable}

\newcounter{iii}
\setcounter{iii}{1}
\newcommand{\myrow}{\hline\theiii\stepcounter{iii}\\}

\begin{document}
\LTpre=0pt
\raggedbottom
\fontsize{30}{60}\selectfont
\begin{longtable}{|l|}

    \myrow \myrow \myrow \myrow \myrow \myrow \myrow \myrow
    \myrow \myrow \myrow \myrow \myrow \myrow \myrow \myrow
    \myrow \myrow \myrow

\end{longtable}

\newpage
\begin{longtable}{|l|}
\hline numbers\\
\endhead
    \myrow \myrow \myrow \myrow \myrow \myrow \myrow \myrow
    \myrow \myrow \myrow \myrow \myrow \myrow \myrow \myrow
    \myrow \myrow \myrow
\end{longtable}
\end{document}

比较上 3 页和下 3 页

答案1

长度\topskip用于将基线从文本区域顶部向下移动,以便第一行文本适合。显然,longtable 从当前基线下方开始。

\documentclass[twoside]{article}

\usepackage[paper=a5paper,left=10mm,right=15mm,top=15mm,bottom=20mm,
showframe]{geometry}

\usepackage{longtable}

\newcounter{iii}
\setcounter{iii}{1}
\newcommand{\myrow}{\hline\theiii\stepcounter{iii}\\}


\begin{document}
\bgroup
\topskip=0pt
\LTpre=0pt
\raggedbottom
\fontsize{30}{60}\selectfont
\begin{longtable}{|l|}
    \myrow \myrow \myrow \myrow \myrow \myrow \myrow \myrow
    \myrow \myrow \myrow \myrow \myrow \myrow \myrow \myrow
    \myrow \myrow \myrow
\end{longtable}
\egroup

\end{document}

相关内容