使用三线表时,表格颜色把线遮挡住了怎么办?我使用的是Windows10 安装的发行版是TEXlive2021,使用的编辑器是TEXMAKER,使用的编译命令是pdflatex。
代码如下:
\documentclass{article}
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\begin{document}
\begin{table}[!h]
\begin{tabular}{
>{\columncolor[HTML]{FFFFC7}}c c
>{\columncolor[HTML]{CDEFCC}}c c}
\hline
Optimizations & targets & indicators & targets \\ \hline
\cellcolor[HTML]{FFFFC7} & & FPC(0.2341) & 12.3\% \\ \cline{3-4}
\cellcolor[HTML]{FFFFC7} & & MR(0.4730) & 21.4\% \\ \cline{3-4}
\multirow{-3}{*}{\cellcolor[HTML]{FFFFC7}Equity} & \multirow{-3}{*}{50\%} & FPSC(0.1329) & -5.2\% \\ \hline
\cellcolor[HTML]{FFFFC7} & & WC(0.1552) & 7.8\% \\ \cline{3-4}
\cellcolor[HTML]{FFFFC7} & & GE(0.2157) & 11.5\% \\ \cline{3-4}
\cellcolor[HTML]{FFFFC7} & & NTC(0.1314) & -4.8\% \\ \cline{3-4}
\multirow{-4}{*}{\cellcolor[HTML]{FFFFC7}Sustainability} & \multirow{-4}{*}{50\%} & AL(0.4125) & 19.7\% \\ \hline
\end{tabular}
\end{table}
\end{document}
提问时代码放到代码块中
首先确保你用的是 texlive 2021 并且更新过全部宏包,
\documentclass{article}
\usepackage{tabularray}
\usepackage{xcolor}
\begin{document}
\begin{tblr}{
column{1} = {c, yellow9},
column{2, 4} = {c},
column{3} = {c, green9},
cell{2}{1, 2} = {r = 3}{c},
cell{5}{1, 2} = {r = 4}{c},
hlines,
cell{2 - 7}{2, 4} = {mode = math},
}
Optimizations & targets & indicators & targets \\
Equity & 50\% & FPC(0.2341) & 12.3\% \\
& & MR & 21.4\\
& & FPSC & -5.2 \\
Sustainablity & 50\% & WC & 7.8\% \\
& & GE(2.157) & 11.5\\
& & NTC(0.1314) & -4.8\\
& & AL(0.4125) & 19.7\%
\end{tblr}
\end{document}
具体参数和用法可以命令行运行 texdoc tabularray
来查看 tabularray 的宏包文档