我使用多行包和 ltablex 包来处理多页表。我遇到了一个问题,当行跨度的单元格跨页时,水平线就画不出来 http://web-engineering.com.ua/Main.pdf
如您所见,第一页底部的 hline 和第二页开头的 hline 不存在。我使用 \cline 来绘制线条。问题是我不想在页面的最后一行对 \hline 进行硬编码,因为当表格前的文本发生更改时,合并单元格上会绘制线条 http://web-engineering.com.ua/Main1.pdf
我怎样才能强制在每页的开始和结束处画线?
\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
我已经简化为简单,longtable
因为我知道这样更好(并且您没有提供 MWE),但我相信您使用的包是在 LT 上构建的。
Longtable 不会像 as 那样弄乱它\cline
的做法,这有点棘手,不像它不添加任何垂直空间,它添加了负空间,这样行\hline
cline
\hline
套印相邻单元格。这样做是为了使垂直线不显示间隙,这不是问题,\hline
因为线是全宽的,所以可以填充任何间隙。
对于 longtable 来说,效果最好不是反转空格和叠印,而是添加小线段来填充任何垂直线段,因为它们与未绘制水平线段的部分相交。请参见下面示例开头的cline
正方形。vrule
\hhline
满足此要求的合理接口可能是允许分页的包版本hhline
,但是下面的代码手动执行了此操作,
更新垂直线的定位取决于是否加载了数组包。下面的代码已被修复为(仅)适用于数组包间距,否则您会得到锯齿状的线条。
\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}
更新基本代码相同,但\hhline
界面类似(只需使用-
:
或~
)
\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}