\cellcolor
我使用with编写了一个带有彩色单元格的文档tabu
。不幸的是,它不再起作用了。这是一个 MWE:
\documentclass{scrartcl}
\usepackage{tabu}
\usepackage[table]{xcolor}
%\usepackage{colortbl}
\begin{document}
Colored table:
\begin{tabular}{l}
\hline
\cellcolor{green}Colored\\
\hline
\end{tabular}
Uncolored table although it should be green, too:
\begin{tabu} to \columnwidth {l}
\hline
\cellcolor{green}Colored\\
\hline
\end{tabu}
\end{document}
我正在使用以下LuaTeX
版本:
This is LuaTeX, Version 1.10.0 (TeX Live 2019/W32TeX) (format=lualatex 2020.1.30) 4 FEB 2020 12:20
并另外进行了测试pdflatex
:
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/W32TeX) (preloaded format=pdflatex 2020.1.30) 4 FEB 2020 12:12
任何想法如何解决这一问题?
答案1
新的 LaTeX3 软件包tabularray
是过时软件包的替代品tabu
。您可以使用环境轻松设置单元格、行或列的颜色tblr
:
\documentclass{scrartcl}
\usepackage{xcolor}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{
width = 0.5\linewidth,
colspec = {|X|X|},
}
\hline
\SetCell{teal8} Colored & \SetCell{blue8} Colored \\
\hline
\SetRow{purple8} Colored & Colored \\
\hline
\end{tblr}
\end{document}