为什么透明在 XeLaTeX 中不能很好地发挥作用以及我该如何修复它?

为什么透明在 XeLaTeX 中不能很好地发挥作用以及我该如何修复它?

我正在寻找 pdf 文档中某些表格行的半透明黑色背景。

我曾尝试申请 https://tex.stackexchange.com/a/62528/23302 如果我使用 pdflatex,它就可以正常工作。但我必须使用 XeLaTeX;然而,它会产生错误消息

! Undefined control sequence.
\CT@do@color ...mc \kern -\@tempdimb \transparent
                                                  {0.5}\leaders \vrule \hski...
l.36 \rowcolor{black}Date &
                            Value\tabularnewline

我的 tex 文件是:

%% LyX 2.0.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass{article}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{transparent,colortbl}

\makeatletter
\def\CT@@do@color{%
  \global\let\CT@do@color\relax
        \@tempdima\wd\z@
        \advance\@tempdima\@tempdimb
        \advance\@tempdima\@tempdimc
        \kern-\@tempdimb
\transparent{0.5}%
        \leaders\vrule
                \hskip\@tempdima\@plus  1fill
        \kern-\@tempdimc
        \hskip-\wd\z@ \@plus -1fill }
\makeatother

\makeatother

\begin{document}
\begin{tabular}{|c|c|}
\hline 
\rowcolor{black}Date & Value\tabularnewline
\hline 
\hline 
Nov & 1\tabularnewline
\hline 
Jun & 2\tabularnewline
\hline 
Apr & 3\tabularnewline
\hline 
Jan & 4\tabularnewline
\hline 
\end{tabular}
\end{document}

相关内容