表格之间不能正确分隔

表格之间不能正确分隔

表格过度绘制页脚,当我预计这应该在第五行之后的新页面上中断时(在此文本“Uuuuuuuuuu ttt ppppppp”之后)

这是生成的 PDF:http://web-engineering.com.ua/mtest3.pdf

代码如下:

\documentclass[a4paper,oneside]{book}
\usepackage[paper=a4paper, left=1.5cm, right=1cm, top=1.7cm, bottom=2.5cm]{geometry}
\usepackage{ltablex}
\usepackage{calc}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{color}
\usepackage{colortbl}
\usepackage{fancyhdr}

%\usepackage{mylayout}

%fancyhdr way
\pagestyle{fancy}
\setlength{\headheight}{1cm}
\definecolor{White}{rgb}{1, 1, 1}

\lhead{}
\chead{}
\rhead{}
\lfoot{\textbf{2001-2012 FOOTERT FOOTER FOOTER FOOTER}}
\cfoot{}
\rfoot{}

\makeatletter

\newcommand\nobreakcline[1]{\@nobreakcline#1\@nil}%
\def\@nobreakcline#1-#2\@nil{%
  \omit
  \@multicnt#1%
  \advance\@multispan\m@ne
  \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
  \@multicnt#2%
  \advance\@multicnt-#1%
  \advance\@multispan\@ne
  \leaders\hrule\@height\arrayrulewidth\hfill\\*
  \noalign{\vskip-\arrayrulewidth}}

%code takes from http://tex.stackexchange.com/questions/6350/how-to-disable-pagebreak-on-hline-in-longtable
%intended to fix issue #339
\def\nobreakhline{%
  \noalign{\ifnum0=`}\fi
    \penalty\@M
    \futurelet\@let@token\LT@@nobreakhline
}
\def\LT@@nobreakhline{%
  \ifx\@let@token\hline
    \global\let\@gtempa\@gobble
    \gdef\LT@sep{\penalty\@M\vskip\doublerulesep}
  \else
    \global\let\@gtempa\@empty
    \gdef\LT@sep{\penalty\@M\vskip-\arrayrulewidth}
  \fi

  \ifnum0=`{\fi}%
  \multispan\LT@cols
     \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
  \noalign{\LT@sep}%
  \multispan\LT@cols
     \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
  \noalign{\penalty\@M}%
  \@gtempa}

\makeatother

%For tables
\newdimen{\newtblsparewidth}
\newdimen{\newtblstarfactor}
\setlength{\extrarowheight}{5pt}
\definecolor{Blue}{rgb}{0,0,1}
\definecolor{White}{rgb}{1,1,1}
\arrayrulewidth=1pt

\setlength{\parskip}{1.7ex}

\begin{document}
Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. 
Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. Here some text.
Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. 
Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. Here some text. 
\subsection{Here some text. Here some text. h}
\begin{itemize}
\item Here some list item. here some list Item. here some list item. here some list
\end{itemize}

\hangindent=30pt
\hangafter=0
\noindent \texttt{Some bold text. Bold text BBBBBBBB}

\begin{itemize}
\item Another item. Another item. Anorther item. Naother Item. Another Item Another item. Naother Item. Another item. Another item. Another item. Another item item item just :
\end{itemize}

\hangindent=30pt
\hangafter=0
\noindent \texttt{Latex text content Latex. Page content Latex Page Content . some text Another text Latex text. This is LaTeX Dummy text. And another some }

\begin{itemize}
\item Some command and this is dummy latex text. Dont read this. Thsi is just a dummy
\end{itemize}

\hangindent=30pt
\hangafter=0
\noindent \texttt{Mail Latex. This is Lmeainingless text. This is medaningless text XXXXXXXX-XXXXXXXXXX-XXXXXX-XXX-XX n: Something meaningless . somethong foolish   }

\begin{itemize}
\item Senseless text. Don't read it. Thsi is text without meaning. Just for filling:
\end{itemize}

\hangindent=30pt
\hangafter=0
\noindent \texttt{Bold meaningless LaTexX Content here . YYY}

\begin{itemize}
\item Xxxxxxxxxxe MMM-cccccc gg ddddddd Latex ghff ghf fgfgfas fga afsg agsyyg gshf ghg  ghg hghghhg:
\end{itemize}

\hangindent=30pt
\hangafter=0
\noindent \texttt{XXXXXwer.exe COmhjehhebf ;lkslkhfhjf,fjf helpb, djksdjh /helele 'Vvvvvvvvvvvvvv}

\section{Section section section section section}
Wwwwwww w Iiiiiiiiii  00000   0.0 

\texttt{mmmmmmm /O00000 <Rrrrrrrr Ppppppppp> [Oooooooo Ppppppppp]}

\textbf{Bbbbbb dddd iiii seeeeees -- ttttt aaa ttt swwwwwww aaa wwww eeee dddd:}

\setlength{\newtblsparewidth}{\linewidth-2\tabcolsep-2\tabcolsep-2\tabcolsep-2\tabcolsep}
\setlength{\newtblstarfactor}{\newtblsparewidth / \real{3}}
\begin{tabularx}{\linewidth}{l|X|X|}
\hline\noalign{\vskip-\arrayrulewidth}\endhead
\noalign{\vskip-\arrayrulewidth}\hline\endfoot
\nobreakhline

\multicolumn{1}{|>{\columncolor{Blue}\color{White}}m{0.15\newtblsparewidth}}{\centering OOOOOOO} & 
\multicolumn{1}{|>{\columncolor{Blue}\color{White}}m{0.4\newtblsparewidth}}{\centering SSSsSssS} & 
\multicolumn{1}{|>{\columncolor{Blue}\color{White}}m{0.45\newtblsparewidth}|}{\centering DDDDDDDDDDD} \\ *\nobreakhline

\multicolumn{1}{|m{0.15\newtblsparewidth}}{\multirow{4}{0.15\newtblsparewidth}{IIIIIIl OOOOOOO}} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{</ppppppp | /i> <Ppppppt.mmm>}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Iiiiiiii oo cccccccccs a ppppppp} \\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/a <Ppppppp.mmm>}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Aaaaaaaaaaaaaa iiiiiii -- Iiiiiiii a ppppppp on the nnnnnnn} \\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/j<u|m> <Ppppppp.mmm> [/t <Ttttttttt Liii>] [/g <Llllllle Ii>]}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Aaaaaaaaaa a apppppt -- m to all uuuuu, u to cuuuuuu usss} \\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{</Uuuuuuuu | /x> <Ppppppp.mss | PrrrrrrCorr>}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Uuuuuuuuuu ttt ppppppp} \\ \hline

\multicolumn{1}{|m{0.15\newtblsparewidth}}{\multirow{4}{0.15\newtblsparewidth}{Ddddddd Ooooooo}} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/qqqqq}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Qqqqq mmmm, no ussss n   dddddd} \\* \nobreakcline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/passive}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Uuuuuuuuuu oodo -- pppppppp bbb oooo} \\* \nobreakcline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/q[n|b|r|f]}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Sssssu uuui uuuuuce lllll: %} \\ \cline{2-3}
\newline
\textbf{n} -- Nn UI \newline
\textbf{b} -- Bbbbb UI \newline
\textbf{r} -- Rrrrrrr UI \newline
\textbf{f} -- Fuuu UI (ddddddd) \newline
}\\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/help}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Hhhh innnnnnnnnn} \\ \hline

\multicolumn{1}{|m{0.15\newtblsparewidth}}{\multirow{3}{0.15\newtblsparewidth}{Rrrrrrr Ooooooo}} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/norestart}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Dd nnn reeeeee aaaaa trr irrrttrytyty iy ctytytyt} \\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/ytytututututut}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Phfjdjhjd djhfj djhfljlkj kdjhfsd djfskjdh} \\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/fjhkjhkdhkjh}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Asjdjjh dkshkjdhfks sjdhfkjdh the jhghgdfhghjf} \\ \hline
\end{tabularx}

\end{document}

答案1

你没有给出很多桌子可能损坏的地方,也许 longtable 可以做得更好,但是......

如果你给它一点帮助它可以做得更好:

155 行

\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Uuuuuuuuuu ttt ppppppp} \\ \hline
\noalign{\break}
\multicolumn{1}{|m{0.15\newtblsparewidth}}{\multirow{4}{0.15\newtblsparewidth}{Ddddddd Ooooooo}} & 

如果它是一个 longtable,您可以使用\newpage而不是\noalign{\break}但不幸的是,ltablex您使用的包没有在正确的时间启用 longtables 重新定义,因此您必须下降到原始的\noalign

答案2

以下代码似乎有效:(我刚刚用包命令删除了无意义的文本lipsum。但是,我不知道问题是什么或如何修复它。看起来连续的项目环境正在做一些事情。您提出问题的方式使得实际调试变得不可能。您可以使用经典 lipsum 文本的段落编号在\lipsum[1-x]哪里用无意义的文本填充页面x。更好的是,我们有kantlipsum来自 egreg 的包,它可以输入英文段落。

\documentclass[a4paper,oneside]{book}
\usepackage[paper=a4paper, left=1.5cm, right=1cm, top=1.7cm, bottom=2.5cm]{geometry}
\usepackage{ltablex}
\usepackage{calc}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{color}
\usepackage{colortbl}
\usepackage{fancyhdr}
\usepackage{lipsum}
%\usepackage{mylayout}

%fancyhdr way
\pagestyle{fancy}
\setlength{\headheight}{1cm}
\definecolor{White}{rgb}{1, 1, 1}

\lhead{}
\chead{}
\rhead{}
\lfoot{\textbf{2001-2012 FOOTERT FOOTER FOOTER FOOTER}}
\cfoot{}
\rfoot{}

\makeatletter

\newcommand\nobreakcline[1]{\@nobreakcline#1\@nil}%
\def\@nobreakcline#1-#2\@nil{%
  \omit
  \@multicnt#1%
  \advance\@multispan\m@ne
  \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
  \@multicnt#2%
  \advance\@multicnt-#1%
  \advance\@multispan\@ne
  \leaders\hrule\@height\arrayrulewidth\hfill\\*
  \noalign{\vskip-\arrayrulewidth}}

%code takes from http://tex.stackexchange.com/questions/6350/how-to-disable-pagebreak-on-hline-in-longtable
%intended to fix issue #339
\def\nobreakhline{%
  \noalign{\ifnum0=`}\fi
    \penalty\@M
    \futurelet\@let@token\LT@@nobreakhline
}
\def\LT@@nobreakhline{%
  \ifx\@let@token\hline
    \global\let\@gtempa\@gobble
    \gdef\LT@sep{\penalty\@M\vskip\doublerulesep}
  \else
    \global\let\@gtempa\@empty
    \gdef\LT@sep{\penalty\@M\vskip-\arrayrulewidth}
  \fi

  \ifnum0=`{\fi}%
  \multispan\LT@cols
     \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
  \noalign{\LT@sep}%
  \multispan\LT@cols
     \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
  \noalign{\penalty\@M}%
  \@gtempa}

\makeatother

%For tables
\newdimen{\newtblsparewidth}
\newdimen{\newtblstarfactor}
\setlength{\extrarowheight}{5pt}
\definecolor{Blue}{rgb}{0,0,1}
\definecolor{White}{rgb}{1,1,1}
\arrayrulewidth=1pt

\setlength{\parskip}{1.7ex}

\begin{document}
\chapter{First}
\section{first}
\lipsum[2]
\subsection{Here some text. Here some text. h}
\begin{itemize}
\item \lipsum[3] 

\hangindent=30pt\hangafter=0
\noindent \texttt{Mail Latex. This is Lmeainingless text. This is medaningless text\\
 XXXXXXXX-XXXXXXXXXX-XXXXXX-XXX-XX n: Something meaningless . somethong foolish }

\item am dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. 
Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan
Cras nec ante. Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis parturient montes, 
nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. Pellentesque cursus 
luctus mauris bibendum, erat ligula aliquet


\end{itemize}


\section{Section section section section section}


fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam 

\texttt{fringilla a, euismod sodales, sollicitujusto. Nam }

\textbf{fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam }

\setlength{\newtblsparewidth}{\linewidth-2\tabcolsep-2\tabcolsep-2\tabcolsep-2\tabcolsep}
\setlength{\newtblstarfactor}{\newtblsparewidth / \real{3}}
\begin{tabularx}{\linewidth}{l|X|X|}
\hline\noalign{\vskip-\arrayrulewidth}\endhead
\noalign{\vskip-\arrayrulewidth}\hline\endfoot
\nobreakhline

\multicolumn{1}{|>{\columncolor{Blue}\color{White}}m{0.15\newtblsparewidth}}{\centering OOOOOOO} & 
\multicolumn{1}{|>{\columncolor{Blue}\color{White}}m{0.4\newtblsparewidth}}{\centering SSSsSssS} & 
\multicolumn{1}{|>{\columncolor{Blue}\color{White}}m{0.45\newtblsparewidth}|}{\centering DDDDDDDDDDD} \\ *\nobreakhline

\multicolumn{1}{|m{0.15\newtblsparewidth}}{\multirow{4}{0.15\newtblsparewidth}{IIIIIIl OOOOOOO}} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{</ppppppp | /i> <Ppppppt.mmm>}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Iiiiiiii oo cccccccccs a ppppppp} \\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/a <Ppppppp.mmm>}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Aaaaaaaaaaaaaa iiiiiii -- Iiiiiiii a ppppppp on the nnnnnnn} \\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/j<u|m> <Ppppppp.mmm> [/t <Ttttttttt Liii>] [/g <Llllllle Ii>]}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Aaaaaaaaaa a apppppt -- m to all uuuuu, u to cuuuuuu usss} \\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{</Uuuuuuuu | /x> <Ppppppp.mss | PrrrrrrCorr>}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Uuuuuuuuuu ttt ppppppp} \\ \hline

\multicolumn{1}{|m{0.15\newtblsparewidth}}{\multirow{4}{0.15\newtblsparewidth}{Ddddddd Ooooooo}} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/qqqqq}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Qqqqq mmmm, no ussss n   dddddd} \\* \nobreakcline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/passive}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Uuuuuuuuuu oodo -- pppppppp bbb oooo} \\* \nobreakcline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/q[n|b|r|f]}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Sssssu uuui uuuuuce lllll: %} \\ \cline{2-3}
\newline
\textbf{n} -- Nn UI \newline
\textbf{b} -- Bbbbb UI \newline
\textbf{r} -- Rrrrrrr UI \newline
\textbf{f} -- Fuuu UI (ddddddd) \newline
}\\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/help}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Hhhh innnnnnnnnn} \\ \hline

\multicolumn{1}{|m{0.15\newtblsparewidth}}{\multirow{3}{0.15\newtblsparewidth}{Rrrrrrr Ooooooo}} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/norestart}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Dd nnn reeeeee aaaaa trr irrrttrytyty iy ctytytyt} \\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/ytytututututut}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Phfjdjhjd djhfj djhfljlkj kdjhfsd djfskjdh} \\ \cline{2-3}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.4\newtblsparewidth}}{\textbf{/fjhkjhkdhkjh}} & 
\multicolumn{1}{|m{0.45\newtblsparewidth}|}{Asjdjjh dkshkjdhfks sjdhfkjdh the jhghgdfhghjf} \\ \hline
\end{tabularx}

\end{document}

在此处输入图片描述

相关内容