我正在使用 rmarkdown 创建一个包含多个彩色单元格且一些单元格分成多行的长表:
---
header-includes:
- \usepackage{pdflscape}
- \usepackage{longtable}
- \usepackage{colortbl}
- \usepackage{multirow}
output:
pdf_document:
latex_engine: xelatex
---
\begin{landscape}
\centering
\footnotesize
\setlength{\tabcolsep}{2pt}
\begin{longtable} {p{0.08\linewidth} >{\raggedright}p{0.1\linewidth} p{0.05\linewidth} p{0.04\linewidth} p{0.05\linewidth} >{\raggedright}p{0.08\linewidth} >{\raggedright}p{0.1\linewidth}p{00.06\linewidth} p{0.06\linewidth}p{0.06\linewidth}p{0.06\linewidth} p{0.12\linewidth}p{0.12\linewidth}}
First author, Year & Population & Mean age & Participants (n) & Follow up (years) & Analysis & Outcome & 1st & 2nd & 3rd & 4th & Other significant & Non-significant \\
\multirow{3}{*}{Ryu 2009} & \multirow{3}{*}{Men, age
30-59} & \multirow{3}{*}{37} & \multirow{3}{*}{10685} & \multirow{3}{*}{3.8} & \multirow{3}{*}{} & \multirow{3}{0.1\linewidth}{Incident
CKD (eGFR60)} & {\cellcolor[rgb]{0.706,0.561,1}} & {\cellcolor[rgb]{0.706,0.561,1}} & \multirow{3}{*}{~} & \multirow{3}{*}{~} & \multirow{3}{*}{HOMA-IR} & {\cellcolor[rgb]{1,1,0.4}}\textit{Obesity} \\
& & & & & & & {\cellcolor[rgb]{0.706,0.561,1}} & {\cellcolor[rgb]{0.706,0.561,1}} & & & & {\cellcolor[rgb]{1,0.498,0.38}}\textit{Hypertension} \\
& & & & & & & \multirow{-3}{*}{{\cellcolor[rgb]{0.706,0.561,1}}Low HDL} & \multirow{-3}{*}{{\cellcolor[rgb]{0.706,0.561,1}}Triglycerides} & & & & {\cellcolor[rgb]{0.675,0.957,0.635}}\textit{Fasting glucose} \\
\end{longtable}
\end{landscape}
我如何去除多行单元格(在本例中为包含“低 HDL”和“甘油三酯”的单元格)之间的空格,以使它们的颜色看起来不间断?