![由于表格线错误,pdflatex 输出的栅格化 PDF](https://linux22.com/image/331872/%E7%94%B1%E4%BA%8E%E8%A1%A8%E6%A0%BC%E7%BA%BF%E9%94%99%E8%AF%AF%EF%BC%8Cpdflatex%20%E8%BE%93%E5%87%BA%E7%9A%84%E6%A0%85%E6%A0%BC%E5%8C%96%20PDF.png)
答案1
重新绘制线条并不困难。您只需要足够合适的 \tikzmark/\pgfmarks——您可以使用一些计数器自动创建它们。您甚至可以在设置它们绘制背景之前在 tikz 命令中使用它们。在具有自动换行符的设置中,您应该将 -commands 放在\tikz
单元格内,以使它们不会因分页符而与标记分开。
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\tikz[overlay,remember picture]\fill[yellow,] ({pic cs:tabstart} |- {pic cs:a1}) rectangle ({pic cs:tabend} |- {pic cs:a2});
\tikzmark{tabstart}%
\begin{tabular}{l}
abcxxxxxxxxxxxxxxx \\\noalign{\pgfmark{a1}}
aa\rule[-1cm]{4pt}{2.5cm}xxxxxxxx\\\noalign{\pgfmark{a2}}
\end{tabular}%
\tikzmark{tabend}
\tikz[overlay,remember picture]\draw[red,] ({pic cs:tabstart} |- {pic cs:a1}) --({pic cs:tabend} |- {pic cs:a1});
\tikz[overlay,remember picture]\draw[green,]({pic cs:tabstart} |- {pic cs:a2}) --({pic cs:tabend} |- {pic cs:a2});
\end{document}