利用colortbl宏包设置表行颜色时,如何使表线以及合并内容正常显示,不被颜色所覆盖?

2020-05-27 14:05发布

## 编译环境 操作系统 * [x] Windows 10 * [ ] macOS * [ ] Linux `若需勾选,请把[ ]改成[x]` Tex发行版 * [x] TexLive `2020`...

## 编译环境 操作系统 * [x] Windows 10 * [ ] macOS * [ ] Linux `若需勾选,请把[ ]改成[x]` Tex发行版 * [x] TexLive `2020` * [ ] MikTeX `版本号` * [ ] CTeX `若需勾选,请把[ ]改成[x]` ## 我的问题 想要实现如下效果的一种的表格: ![](https://wenda.latexstudio.net/data/attach/200527/cWDi0Xd9.jpg) 我写的过程如下: ``` \documentclass{article} \usepackage[table]{xcolor} \usepackage{multirow} \usepackage{makecell} \usepackage{array} \begin{document} \begin{tabular}{|c|c|c|c|>{\scriptsize}m{6cm}|} \hline \rowcolor{yellow} & \multicolumn{2}{c|}{\thead{Is this person \\interested \\in the news?}} & \multirowthead{2}{Where does he/she get \\most of the news \\(online, TV, etc.)?} & \multirow{2}*{\makecell{What does he/she think?\\(Write the person's name on all the responses.)}}\\ \cline{1-3} \rowcolor{yellow} & Yes & No & & \\ \hline \end{tabular} \end{document} ``` 编译后效果如下: ![](https://wenda.latexstudio.net/data/attach/200527/XIZ9woR4.png) 发现后一行的颜色填充命令`\rowcolor{yellow}`覆盖了前一行的表线`\cline{1-3}`以及合并的内容,请问有没有什么好的方案来解决一下这个问题,使得**表线**和**合并内容**能够正常显示?*最小工作示例已打包至附件mwe.zip(不知什么原因,附件一直处于上传中,可能无法下载附件了)。*
2条回答
yuxtech.github.
2020-05-27 14:47
在群里我已经发了截图给你说明了,如果非要解决的话,可以这样 ```tex \documentclass{article} \usepackage[table]{xcolor} \usepackage{multirow} \usepackage{makecell} \usepackage{array} \begin{document} \rowcolors[\Xhline{0.2pt}]{1}{yellow}{yellow} \begin{tabular}{|c|c|c|c|>{\scriptsize}m{6cm}|} & \multicolumn{2}{c|}{\thead{Is this person \\interested \\in the news?}} & \multirowthead{-2}{Where does he/she get \\most of the news \\(online, TV, etc.)?} & \multirow{2}*{\makecell{What does he/she think?\\(Write the person's name on all the responses.)}}\\ &Yes & No & & \\ \end{tabular} \end{document} ```tex

一周热门 更多>