1

I use multirow package and ltablex package for multipage tables. I have a problem, when cell with rowspan breaks between pages. Then horizontal lines are not drawn http://web-engineering.com.ua/Main.pdf

As you can see there, hline on bottom of first page and hline on start of second page does not exists. I use \cline for drawing line. The problem is that I do not want to hardcode \hline in the last row ot the page, because when text before the table is changed, lines will be drawn over the merged cell http://web-engineering.com.ua/Main1.pdf

How can I force lines to be drawn at the beginning and ending of each page?

\begin{document}
\section{Section}

\setlength{\newtblsparewidth}{\linewidth-2\tabcolsep-2\tabcolsep-2\tabcolsep-2\tabcolsep-2\tabcolsep}
\setlength{\newtblstarfactor}{\newtblsparewidth / \real{4}}

\begin{tabularx}{\linewidth}{l|l|l|X|}\nobreakhline 
\multicolumn{1}{|m{0.13\newtblsparewidth}}{\multirow{9}{0.13\newtblsparewidth}{\textbf{tt}}} & 
\multicolumn{1}{|m{0.35\newtblsparewidth}}{eadi=<gale\_smrvue>} & 
\multicolumn{1}{|m{0.15\newtblsparewidth}}{} & 
\multicolumn{1}{|m{0.37\newtblsparewidth}|}{} \\ \cline{2-4} 

\multicolumn{1}{|l}{} & \multicolumn{1}{|m{0.35\newtblsparewidth}}{zhim=<zpayw>[,<cckd>][,<ssr>]} & 
\multicolumn{1}{|m{0.15\newtblsparewidth}}{} & 
\multicolumn{1}{|m{0.37\newtblsparewidth}|}{} \\ \cline{2-4} 

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.35\newtblsparewidth}}{kcep=<btgzqgb>[,<klmxacfq>]} & 
\multicolumn{1}{|m{0.15\newtblsparewidth}}{Fit

FvlB

FbmH,hrr

FlvV,cnhg

FaoBH,llu

FjvBV,ijen
} & \multicolumn{1}{|m{0.37\newtblsparewidth}|}{} \\ \cline{2-4} 

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.35\newtblsparewidth}}{uvemlwsx=<gmjy>,<lfd>,<wc>,<id>} & 
\multicolumn{1}{|m{0.15\newtblsparewidth}}{} & \multicolumn{1}{|m{0.37\newtblsparewidth}|}{} \\ \cline{2-4} 

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.35\newtblsparewidth}}{faxjuwoz=osuwwayo|xwgvd|zxnb} & 
\multicolumn{1}{|m{0.15\newtblsparewidth}}{} & 
\multicolumn{1}{|m{0.37\newtblsparewidth}|}{} \\ \cline{2-4} 

\multicolumn{1}{|l}{} & \multicolumn{1}{|m{0.35\newtblsparewidth}}{oarfeqjem=<gakx>} & 
\multicolumn{1}{|m{0.15\newtblsparewidth}}{} & 
\multicolumn{1}{|m{0.37\newtblsparewidth}|}{} \\ \cline{2-4} 

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.35\newtblsparewidth}}{vajuwpzmk=<taur>} & 
\multicolumn{1}{|m{0.15\newtblsparewidth}}{} & 
\multicolumn{1}{|m{0.37\newtblsparewidth}|}{} \\ \cline{2-4} 

\multicolumn{1}{|l}{} & \multicolumn{1}{|m{0.35\newtblsparewidth}}{vajuwpzmk=<taur>} & 
\multicolumn{1}{|m{0.15\newtblsparewidth}}{} & 
\multicolumn{1}{|m{0.37\newtblsparewidth}|}{} \\ \cline{2-4}

\multicolumn{1}{|l}{} & 
\multicolumn{1}{|m{0.35\newtblsparewidth}}{vajuwpzmk=<taur>} & 
\multicolumn{1}{|m{0.15\newtblsparewidth}}{} & 
\multicolumn{1}{|m{0.37\newtblsparewidth}|}{
Id sqpvuv\{hdu\}, jvet aoi eadthy xvy skwlefrhyix tcsb ag nlbreq\{ajt, uqsr, mqjwn, vat, mi, ru,\} flx. ayn aemygedw aem qyadippy zm lvmehv(1/72 wcai). 

Oayvflulp xitky sanghd fhpq cc vkxrnxzowvt ah a qexom qy limrqp aw 100\% zyen. Tagi leaayban yw ggmaldb xua Ajdma Aubxsag/Rlatnt. Ie rudt uaqs, qx ydicegx aepaqqus nanzz gm slempx, Ahgpxad oablrfarpj hp ax:

V(kt)=V\(lysk\_fed\)\(aqi{}\)72.0/(qggx\_mwvpl)

Twb dbtsla{hmys\_fjqyu} wacaxmlnt sl fpgv ac wddqaw ‘Pprdbpwhznf/Patj Dirwuaf/Rpmqvcwqcz’ ngdadcsu (gukd bj Aqhdaap auw PDF-XCjazmw Vqhymy).
} \\ \hline

\end{tabularx}

\end{document}
1
  • The question (and certainly the answer so far) doesn't really involve moving cells or rowspan, but is about cline in multi-page tables. You might want to consider changing the title, to help the archives. Feb 17, 2012 at 13:54

1 Answer 1

3

I have simplified down to simply longtable as I know that better (and you didn't supply a MWE) but I believe the packages you are using build on LT.

Longtable doesn't mess with \cline the way it does with \hline as cline is a bit trickier, unlike \hline it does not add any vertical space, it adds negative space so that the line overprints the adjacent cells. It does this so that vertical lines do not show a gap, this isn't a problem for \hline as the line is full width so fills any gaps.

For longtable it would work best not to reverse space and overprint, and instead add small line fragments to fill in any vertical rules as they cross where parts where the cline is not drawing a horizontal rule. See the square vrule at the start of the example below.

Probably a reasonable interface to this requirement would be a version of \hhline from the hhline package that allowed page breaks, however the code below does this by hand,

UPDATE Positioning of vertical lines differs depending on whether the array package is loaded or not. the code below has been fixed to (only) work with the array package spacing, Otherwise you would get jagged lines.

\documentclass{article}

\usepackage{array,longtable}


\makeatletter


\def\mylinex{%
  \omit
  \vrule \@width \arrayrulewidth \@height \arrayrulewidth
   \hfill
  \vrule \@width \arrayrulewidth \@height \arrayrulewidth&%
  \omit\span\omit
  \leaders\hrule \@height\arrayrulewidth\hfill\cr}

\def\myline{%
  \noalign{\nobreak}%
  \mylinex
  \noalign{\penalty-\@lowpenalty\vskip-\arrayrulewidth}%
  \mylinex
  \noalign{\nobreak}%
}


\makeatother
\textheight5\baselineskip

\begin{document}



\begin{longtable}{|l|l|l}\hline 
aaa&bb&cc\\
w aaa&bb&cc\\
\cline{2-3}
x aaa&bb&cc\\
\myline
y aaa&bb&cc\\
\myline
a aaa&bb&cc\\
b aaa&bb&cc\\
c aaa&bb&cc\\
aaa&bb&cc\\
aaa&bb&cc\\
aaa&bb&cc\\
aaa&bb&cc\\
\end{longtable}

\end{document}

enter image description here

UPDATE Same basic code but with a \hhline like interface (just use - : or ~)

\documentclass{article}

\usepackage{array,longtable,hhline}


\makeatletter

\def\LTHH@let#1{\futurelet\@tempb\LTHH@loop}


\def\LTHH@loop{%
  \ifx\@tempb`\edef\next##1{%
  \the\toks@\cr
  \noalign{\penalty-\@lowpenalty\vskip-\arrayrulewidth}%
  \omit
  \the\toks@\cr
  \noalign{\nobreak}%
  }\else\let\next\LTHH@let
  \ifx\@tempb:\if@tempswa\HH@add{\hskip\doublerulesep}\fi\@tempswatrue
      \HH@add{\@tempc\vline\@tempc}\else
  \ifx\@tempb~\@tempswafalse
           \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi
              \HH@add{\hfil}\else
  \ifx\@tempb-\@tempswafalse
           \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi
              \HH@add{\leaders\hrule\@height\arrayrulewidth\hfil}\else
  \errortoken
  \fi\fi\fi\fi
  \next}


\def\ltcline#1{%
  \noalign{\nobreak}%
  \omit\@firstamptrue\@tempswafalse
  \xdef\@tempc{\ifx\extrarowheight\HH@undef\hskip-.5\arrayrulewidth\fi}%
  \HH@xexpast\relax#1*0x\@@\toks@{}%
  \expandafter\LTHH@let\@tempa`%
}


\makeatother


\arrayrulewidth2pt
\textheight5\baselineskip
\pdfpageheight4\textheight

\begin{document}



\begin{longtable}{|l|l|l|l|l|}
\hline 
aaa&bb&cc&dd&ee\\
\ltcline{:~:--:~:-:}
w aaa&bb&cc&dd&ee\\
\cline{2-3}
x aaa&bb&cc&dd&ee\\
\ltcline{:~:--:~:-:}
y aaa&bb&cc&dd&ee\\
\ltcline{:~:--:~:-:}
a aaa&bb&cc&dd&ee\\
b aaa&bb&cc&dd&ee\\
c aaa&bb&cc&dd&ee\\
d aaa&bb&cc&dd&ee\\
e aaa&bb&cc&dd&ee\\
\hline
\end{longtable}

\end{document}

enter image description here

7
  • Thanks for quick response. When I try this example, I get line just over 2 cells, but in different cases, number of cells is different. Unfortunatelly, I am not so experinced in TeX, so can you modify your suggestion for arbitrary number of cells, or give me a possibility to set number of cells as in \cline Thanks.
    – Andrew
    Feb 17, 2012 at 10:21
  • 1
    I may try to work up a better interface but if you take it as written and change \omit\span\omit to \omit\span\omit\span\omit\span\omit\span\omit it will span 5 columns rather than 2, just add a span and omit for each column the line has to span. Feb 17, 2012 at 12:06
  • 1
    oh you accepted it as it was:-) but I just did an hhline interface, see updated answer Feb 17, 2012 at 13:40
  • [Text]: web-engineering.com.ua/3yoZL.png
    – Andrew
    Feb 17, 2012 at 15:57
  • sorry I don't understand? Feb 17, 2012 at 16:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .