我的长表出现了一些奇怪的问题。有些表格的最后一行后面有一个分页符,而第二页又打印了表头,但没有后续内容。我使用来自如何让 longtable 在开始时尊重 \nopagebreak?。
这是一个不太简单的例子,它显示了第二个表中的问题:
\documentclass[open=any, a5paper, fontsize=9pt, DIV12]{scrbook}
%\usepackage[utf8x]{inputenc} only for pdflatex
\usepackage{etoolbox}
\usepackage{array}
\usepackage{longtable}
\usepackage{libertine}
\setcounter{secnumdepth}{-1}
\newcommand{\br}{\hfill\break}
\newif\ifnormalLT
\normalLTtrue
\makeatletter
\patchcmd {\LT@start}
{\vfil\break}
{\ifnormalLT\vfil\break\fi}
{\typeout{Patching longtable succeeded!}}
{\typeout{Patching longtable failed!}\ERROR}
\patchcmd {\LT@start}
{\penalty\z@}
{\ifnormalLT\penalty\z@\fi}
{\typeout{Patching longtable succeeded!}}
{\typeout{Patching longtable failed!}\ERROR}
\makeatother
\newenvironment{deklination}
{
\setlength{\extrarowheight}{.75ex}%
\normalLTfalse
\longtable{lp{3cm}p{3cm}p{3cm}}
&\textbf{Sg.}&\textbf{Du.}&\textbf{Pl.}\\
\endhead
}
{\endlongtable}
\usepackage{hyperref}
\begin{document}
\chapter{Lektion IX}
\section{Grammatik}
\subsection{Pronomen der zweiten Person svad, yuṣmad}
\begin{deklination}
\textbf{Nom.}&{svam}&{yuvām}&{yūvam}\\
\textbf{Akk.}&{svām},\br {svā}&{yuvām},\br {vām}&{yuṣmān},\br {vaḥ}\\
\textbf{Inst.}&{svayā}&{yuvābhyām}&{yuṣmābhiḥ}\\
\textbf{Dat.}&{tuhyam},\br {te} &{yuvābhyām},\br {vām}&{yuṣmabhyam},\br {vaḥ}\\
\textbf{Abl.}&{svat}&{yuvābhyām}&{yuṣmat}\\
\textbf{Gen.}&{tava},\br {te}&{yuvayoḥ},\br {vām}&{yuṣmākam},\br {vaḥ}\\
\textbf{Lok.}&{svayi}&{yuvayoḥ}&{yuṣmāsu}\\
\end{deklination}
\subsection{Pronomen der dritten Person tad – er, sie, es; jener, jene, jenes}
\subsubsection{Masculinum}
\begin{deklination}
\textbf{Nom.}&{saḥ}&{tau}&{te}\\
\textbf{Akk.}&{tam}&{tau}&{tān}\\
\textbf{Inst.}&{tena}&{tābhyām}&{taiḥ}\\
\textbf{Dat.}&{tasmai}&{tābhyām}&{tebhyaḥ}\\
\textbf{Abl.}&{tasmāt}&{tābhyām}&{tebhyaḥ}\\
\textbf{Gen.}&{tasya}&{tayoḥ}&{teṣām}\\
\textbf{Lok.}&{tasmin}&{tayoḥ}&{teṣu}\\%
\end{deklination}
\subsubsection{Femininum}
\begin{deklination}
\textbf{Nom.}&{sā}&{te}&{tāḥ}\\
\textbf{Akk.}&{tām}&{te}&{tāḥ}\\
\textbf{Inst.}&{tayā}&{tābhyām}&{tabhiḥ}\\
\textbf{Dat.}&{tasyai}&{tābhyām}&{tābhyaḥ}\\
\textbf{Abl.}&{tasyāḥ}&{tābhyām}&{tābhyaḥ}\\
\textbf{Gen.}&{tasyāḥ}&{tayoḥ}&{tāsām}\\
\textbf{Lok.}&{tasyām}&{tayoḥ}&{tasu}\\%
\end{deklination}
\subsubsection{Neutrum}
\begin{deklination}
\textbf{Nom.}&{tat} (d)&{te}&{tāni}\\
\textbf{Akk.}&{tat} (d)&{te}&{tāni}\\
\textbf{Inst.}&{tena}&{tābhyām}&{taiḥ}\\
\textbf{Dat.}&{tasmai}&{tābhyām}&{tebhyaḥ}\\
\textbf{Abl.}&{tasmāt}&{tābhyām}&{tebhyaḥ}\\
\textbf{Gen.}&{tasya}&{tayoḥ}&{teṣām}\\
\textbf{Lok.}&{tasmin}&{tayoḥ}&{teṣu}\\
\end{deklination}
\end{document}
答案1
嗯,我想可能是
longtabu 和 floats:带有 floats 的页面上的表格分隔符错误
但事实并非如此。
实际上,我会使用一种比补丁建议的更简单的方法来保留表格标题,这在您的情况下做了正确的事情:
\documentclass[open=any, a5paper, fontsize=9pt, DIV12]{scrbook}
\usepackage[utf8x]{inputenc}% only for pdflatex
\usepackage{etoolbox}
\usepackage{array}
\usepackage{longtable}
\usepackage{libertine}
\setcounter{secnumdepth}{-1}
\newcommand{\br}{\hfill\break}
\newenvironment{deklination}[1]
{\setlength{\extrarowheight}{.75ex}%
%\normalLTfalse
\longtable{lp{3cm}p{3cm}p{3cm}}
\noalign{\subsection{#1}}
&\textbf{Sg.}&\textbf{Du.}&\textbf{Pl.}\\
\endhead
}
{\endlongtable}
\usepackage{hyperref}
\begin{document}
\chapter{Lektion IX}
\section{Grammatik}
\begin{deklination}{Pronomen der zweiten Person svad, yuṣmad}
\textbf{Nom.}&{svam}&{yuvām}&{yūvam}\\
\textbf{Akk.}&{svām},\br {svā}&{yuvām},\br {vām}&{yuṣmān},\br {vaḥ}\\
\textbf{Inst.}&{svayā}&{yuvābhyām}&{yuṣmābhiḥ}\\
\textbf{Dat.}&{tuhyam},\br {te} &{yuvābhyām},\br {vām}&{yuṣmabhyam},\br {vaḥ}\\
\textbf{Abl.}&{svat}&{yuvābhyām}&{yuṣmat}\\
\textbf{Gen.}&{tava},\br {te}&{yuvayoḥ},\br {vām}&{yuṣmākam},\br {vaḥ}\\
\textbf{Lok.}&{svayi}&{yuvayoḥ}&{yuṣmāsu}\\
\end{deklination}
\subsection{Pronomen der dritten Person tad – er, sie, es; jener, jene, jenes}
\begin{deklination}{Masculinum}
\textbf{Nom.}&{saḥ}&{tau}&{te}\\
\textbf{Akk.}&{tam}&{tau}&{tān}\\
\textbf{Inst.}&{tena}&{tābhyām}&{taiḥ}\\
\textbf{Dat.}&{tasmai}&{tābhyām}&{tebhyaḥ}\\
\textbf{Abl.}&{tasmāt}&{tābhyām}&{tebhyaḥ}\\
\textbf{Gen.}&{tasya}&{tayoḥ}&{teṣām}\\
\textbf{Lok.}&{tasmin}&{tayoḥ}&{teṣu}\\%
\end{deklination}
\begin{deklination}{Femininum}
\textbf{Nom.}&{sā}&{te}&{tāḥ}\\
\textbf{Akk.}&{tām}&{te}&{tāḥ}\\
\textbf{Inst.}&{tayā}&{tābhyām}&{tabhiḥ}\\
\textbf{Dat.}&{tasyai}&{tābhyām}&{tābhyaḥ}\\
\textbf{Abl.}&{tasyāḥ}&{tābhyām}&{tābhyaḥ}\\
\textbf{Gen.}&{tasyāḥ}&{tayoḥ}&{tāsām}\\
\textbf{Lok.}&{tasyām}&{tayoḥ}&{tasu}
\end{deklination}
\begin{deklination}{Neutrum}
\textbf{Nom.}&{tat} (d)&{te}&{tāni}\\
\textbf{Akk.}&{tat} (d)&{te}&{tāni}\\
\textbf{Inst.}&{tena}&{tābhyām}&{taiḥ}\\
\textbf{Dat.}&{tasmai}&{tābhyām}&{tebhyaḥ}\\
\textbf{Abl.}&{tasmāt}&{tābhyām}&{tebhyaḥ}\\
\textbf{Gen.}&{tasya}&{tayoḥ}&{teṣām}\\
\textbf{Lok.}&{tasmin}&{tayoḥ}&{teṣu}\\
\end{deklination}
\end{document}