分页时将多行文本居中并放置在 longtabu 中的每一页上

分页时将多行文本居中并放置在 longtabu 中的每一页上

因此,问题是:这可能吗?

我需要使用某种长表(我使用longtabu),​​多行 9 行,有些行包含 parbox。

当分页符出现在多行中间时,我希望多行的文本出现在两个页面上(分页符之前和之后),并根据其行垂直居中:

这就是我想要得到的

抱歉,使用的是西里尔字母。

似乎垂直居中文本的最佳技巧multirows是使用不可见的线条(例如使用\cline{3-9}而不是\hline)但这会破坏 tex 的所有自动化并且看起来不太正常。


编辑:这是示例代码,取自这个问题(很接近)。您可以看到,\multirow分页符无法正常工作。再次使用示例代码:

  1. 我可以使用\multirow分页符吗?我是否必须使用其他命令/包来制作多行?
  2. 是否有机会让\multirow文本同时出现在两个页面上:分页符之前和之后?

\documentclass{article}

%%%%%%%%%%%%%%%%%%%%%%
% Package Inclusions %
%%%%%%%%%%%%%%%%%%%%%%

\usepackage{tabu}
\usepackage{longtable}
\usepackage{seqsplit}
\usepackage{geometry}
\usepackage{pdflscape}
\usepackage{xparse}
\usepackage{array}
\usepackage{xstring}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{amssymb,amsfonts,textcomp}
\usepackage{multirow}
\usepackage{lipsum}

%used to print Spanish characters in the text
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage[english]{babel}

%%%%%%%%%%%%%%%%%%%%%%
%   Configurations   %
%%%%%%%%%%%%%%%%%%%%%%

\geometry{
      top=0.50in,            
      inner=0.75in,
      outer=0.75in,
      bottom=0.50in,
      headheight=3ex,      
      headsep=6ex,          
    }

\setlength{\LTpre}{1pt} % removes the white space before a long table
\setlength{\LTpost}{1pt} % removes the white space after a long table
\pagestyle{empty} % stops the page number from showing on each page
\tabulinesep=1mm


%%%%%%%%%%%%%%%%%%%%%%
% Start Report       %
%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{landscape}
\Large
{\textbf{Test Report}}
\small

\begin{longtabu} to 9.5in {
    |X[1.5,l,m]|
    X[4,l,m]|
    X[2.5,l,m]|
    X[2,l,m]|
    X[2,l,m]|
    X[2,l,m]|
    X[2,l,m]|
    X[3,l,m]|
    X[2,l,m]|
    X[8,l,m]|
    }
    \hline

    \multicolumn{4}{|l|}{\textbf{Customer Name:}} &
    \multicolumn{5}{l|}{\textbf{Well Name:}} &
    \multicolumn{1}{l|}{\textbf{Job Date:}}

    \\

    \multicolumn{4}{|l|}{test} &
    \multicolumn{5}{l|}{test well} &
    \multicolumn{1}{l|}{22/08/2014}


    \\\hline

    \multicolumn{4}{|l|}{\textbf{Customer Representative:}} &
    \multicolumn{3}{l|}{\textbf{County/Parish:}} &
    \multicolumn{2}{l|}{\textbf{State:}} &
    \multicolumn{1}{l|}{\textbf{Job Category:}}

    \\\cline{5-9}

    \multicolumn{4}{|l|}{Health} &
    \multicolumn{3}{c|}{test} &
    \multicolumn{2}{c|}{Texas} &
    \multicolumn{1}{l|}{Wash Fill/Sand Removal} \\ \hline

    \multicolumn{1}{|c|}{\multirow{3}{*}{\centering\textbf{Time}}} &
    \multicolumn{1}{c|} {\multirow{3}{*}{\centering\textbf{Activity Name}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{Tubing Depth}}} &
    \multicolumn{2}{c|}{\centering\textbf{Pressure}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm} {\centering\textbf{Tubing Weight}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}
{\centering\textbf{Liquid Rate}}}&
    \multicolumn{1}{c|}{\multirow{2}{3cm}{\centering\textbf{Flow black Rate / Liquid Type}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{N2 Rate}}}&
    \multicolumn{1}{c|}{\multirow{3}{*}{\centering\textbf{Activity Info}}} \\\cline{4-5}
    & & & 
    \centering\scriptsize\textbf{Circulation} &
    \centering\scriptsize\textbf{Wellhead} &
    & & & & \\\cline{3-9}
    & &
    \centering\scriptsize\textbf{Start/End} &
    \centering\scriptsize\textbf{(psi)} &
    \centering\scriptsize\textbf{(psi)} &
    \centering\scriptsize\textbf{(lbs)} &
    \centering\scriptsize\textbf{(bbl/min)} &
    \centering\scriptsize\textbf{(bbl)/Name} &
    \centering\scriptsize\textbf{(SCF/min)} & 
\\\hline %cline{3-9}
 \endhead
    \multicolumn{3}{l}{Continued on next page ...} \\ 
    \endfoot
    \endlastfoot
    & & & & & & & & &\\\hline
\end{longtabu}



\begin{longtabu} to 9.88 in {
    |X[1.5,l,m]|
    X[4,l,m]|
}
\hline   
\multirow{9}{*}{test1} 
&1 \\ \cline{2-2}    
&2 \\ \cline{2-2}
&3 \\ \cline{2-2}
&4 \\ \cline{2-2}
&5 \\ \cline{2-2}
&6 \\ \cline{2-2}
&7 \\ \cline{2-2}
&8 \\ \cline{2-2}
&9 \\ \cline{1-2}
\hline   
\multirow{9}{*}{test2} 
&1 \\ \cline{2-2}    
&2 \\ \cline{2-2}
&3 \\ \cline{2-2}
&4 \\ \cline{2-2}
&5 \\ \cline{2-2}
&6 \\ \cline{2-2}
&7 \\ \cline{2-2}
&8 \\ \cline{2-2}
&9 \\ \cline{1-2}
\hline   
\multirow{9}{*}{test3} 
&1 \\ \cline{2-2}    
&2 \\ \cline{2-2}
&3 \\ \cline{2-2}
&4 \\ \cline{2-2}
&5 \\ \cline{2-2}
&6 \\ \cline{2-2}
&7 \\ \cline{2-2}
&8 \\ \cline{2-2}
&9 \\ \cline{1-2}
\hline   
\multirow{19}{*}{test4} 
&1 \\ \cline{2-2}    
&2 \\ \cline{2-2}
&3 \\ \cline{2-2}
&4 \\ \cline{2-2}
&5 \\ \cline{2-2}
&6 \\ \cline{2-2}
&7 \\ \cline{2-2}
&8 \\ \cline{2-2}
&9 \\ \cline{2-2}
&10 \\ \cline{2-2}
&11 \\ \cline{2-2}
&12 \\ \cline{2-2}
&13 \\ \cline{2-2}
&14 \\ \cline{1-2}
&5 \\ \cline{2-2}
&6 \\ \cline{2-2}
&7 \\ \cline{2-2}
&8 \\ \cline{2-2}
&9 \\ \cline{2-2}
\hline   
\end{longtabu}

\end{landscape}
\end{document}

答案1

如果大卫·卡莱尔没能找到解决方案这里,我怀疑有一个……

如果您不想手动调整它(即,当您的文档快要完成时,将多行块分成两个小块,以便其中一个放在第一页,另一个放在第二页),我建议将整个多行块自动放在第二页。

multirow包文档第 3.6 节与 longtable 一起使用:

... 遗漏 ... 您希望防止分页符出现在此条目的中间。您可以通过使用 而\\*不是 来结束中间行来实现此目的\\

... 省略 ... 但是, 中有一个错误,如果 后面跟着一个,longtable则会导致不起作用\\*\cline

... omissis ...有一个重新定义的multirow包选项,因此当后面跟着时也会起作用 。代码来自 David Carlisle。longtable\cline\\*\cline

\documentclass{article}

%%%%%%%%%%%%%%%%%%%%%%
% Package Inclusions %
%%%%%%%%%%%%%%%%%%%%%%

\usepackage{tabu}
\usepackage{longtable}

\usepackage{seqsplit}
\usepackage{geometry}
\usepackage{pdflscape}
\usepackage{xparse}
\usepackage{array}
\usepackage{xstring}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{amssymb,amsfonts,textcomp}
\usepackage[longtable]{multirow}
\usepackage{lipsum}

%used to print Spanish characters in the text
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage[english]{babel}

%%%%%%%%%%%%%%%%%%%%%%
%   Configurations   %
%%%%%%%%%%%%%%%%%%%%%%

\geometry{
      top=0.50in,            
      inner=0.75in,
      outer=0.75in,
      bottom=0.50in,
      headheight=3ex,      
      headsep=6ex,          
    }

\setlength{\LTpre}{1pt} % removes the white space before a long table
\setlength{\LTpost}{1pt} % removes the white space after a long table
\pagestyle{empty} % stops the page number from showing on each page
\tabulinesep=1mm


%%%%%%%%%%%%%%%%%%%%%%
% Start Report       %
%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{landscape}
\Large
{\textbf{Test Report}}
\small

\begin{longtabu} to 9.5in {
    |X[1.5,l,m]|
    X[4,l,m]|
    X[2.5,l,m]|
    X[2,l,m]|
    X[2,l,m]|
    X[2,l,m]|
    X[2,l,m]|
    X[3,l,m]|
    X[2,l,m]|
    X[8,l,m]|
    }
    \hline

    \multicolumn{4}{|l|}{\textbf{Customer Name:}} &
    \multicolumn{5}{l|}{\textbf{Well Name:}} &
    \multicolumn{1}{l|}{\textbf{Job Date:}}

    \\

    \multicolumn{4}{|l|}{test} &
    \multicolumn{5}{l|}{test well} &
    \multicolumn{1}{l|}{22/08/2014}


    \\\hline

    \multicolumn{4}{|l|}{\textbf{Customer Representative:}} &
    \multicolumn{3}{l|}{\textbf{County/Parish:}} &
    \multicolumn{2}{l|}{\textbf{State:}} &
    \multicolumn{1}{l|}{\textbf{Job Category:}}

    \\\cline{5-9}

    \multicolumn{4}{|l|}{Health} &
    \multicolumn{3}{c|}{test} &
    \multicolumn{2}{c|}{Texas} &
    \multicolumn{1}{l|}{Wash Fill/Sand Removal} \\ \hline

    \multicolumn{1}{|c|}{\multirow{3}{*}{\centering\textbf{Time}}} &
    \multicolumn{1}{c|} {\multirow{3}{*}{\centering\textbf{Activity Name}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{Tubing Depth}}} &
    \multicolumn{2}{c|}{\centering\textbf{Pressure}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm} {\centering\textbf{Tubing Weight}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}
{\centering\textbf{Liquid Rate}}}&
    \multicolumn{1}{c|}{\multirow{2}{3cm}{\centering\textbf{Flow black Rate / Liquid Type}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{N2 Rate}}}&
    \multicolumn{1}{c|}{\multirow{3}{*}{\centering\textbf{Activity Info}}} \\\cline{4-5}
    & & & 
    \centering\scriptsize\textbf{Circulation} &
    \centering\scriptsize\textbf{Wellhead} &
    & & & & \\\cline{3-9}
    & &
    \centering\scriptsize\textbf{Start/End} &
    \centering\scriptsize\textbf{(psi)} &
    \centering\scriptsize\textbf{(psi)} &
    \centering\scriptsize\textbf{(lbs)} &
    \centering\scriptsize\textbf{(bbl/min)} &
    \centering\scriptsize\textbf{(bbl)/Name} &
    \centering\scriptsize\textbf{(SCF/min)} & 
\\\hline %cline{3-9}
 \endhead
 \multicolumn{3}{l}{Continued on next page\ldots} \\ 
 \endfoot
 \endlastfoot
 & & & & & & & & &\\\hline
\end{longtabu}


\begin{longtabu} to 9.88 in {
    |X[1.5,l,m]|
    X[4,l,m]|
}
\hline   
\endhead
\multicolumn{2}{l}{Continued on next page\ldots} \\ 
\endfoot
\endlastfoot
\multirow{9}{*}{test1} 
&1 \\ \cline{2-2}    
&2 \\ \cline{2-2}
&3 \\ \cline{2-2}
&4 \\ \cline{2-2}
&5 \\ \cline{2-2}
&6 \\ \cline{2-2}
&7 \\ \cline{2-2}
&8 \\ \cline{2-2}
&9 \\ \cline{1-2}
\hline   
\multirow{9}{*}{test2} 
&1 \\ \cline{2-2}    
&2 \\ \cline{2-2}
&3 \\ \cline{2-2}
&4 \\ \cline{2-2}
&5 \\ \cline{2-2}
&6 \\ \cline{2-2}
&7 \\ \cline{2-2}
&8 \\ \cline{2-2}
&9 \\ \cline{1-2}
\hline   
\multirow{9}{*}{test3} 
&1 \\ \cline{2-2}    
&2 \\ \cline{2-2}
&3 \\ \cline{2-2}
&4 \\ \cline{2-2}
&5 \\ \cline{2-2}
&6 \\ \cline{2-2}
&7 \\ \cline{2-2}
&8 \\ \cline{2-2}
&9 \\ \cline{1-2}
\hline   
\multirow{19}{*}{test4} 
&1 \\* \cline{2-2}    
&2 \\* \cline{2-2}
&3 \\* \cline{2-2}
&4 \\* \cline{2-2}
&5 \\* \cline{2-2}
&6 \\* \cline{2-2}
&7 \\* \cline{2-2}
&8 \\* \cline{2-2}
&9 \\* \cline{2-2}
&10 \\* \cline{2-2}
&11 \\* \cline{2-2}
&12 \\* \cline{2-2}
&13 \\* \cline{2-2}
&14 \\* \cline{2-2}
&15 \\* \cline{2-2}
&16 \\* \cline{2-2}
&17 \\* \cline{2-2}
&18 \\* \cline{2-2}
&19 \\* \cline{2-2}
\hline   
\end{longtabu}

\end{landscape}
\end{document}

第一页:

在此处输入图片描述

第二页:

在此处输入图片描述

相关内容