4

I'm looking for a semi transparent black background on certain table rows in a pdf document.

I have tried to apply https://tex.stackexchange.com/a/62528/23302 and it works if I use pdflatex. But I have to use XeLaTeX; however, it produces error message

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

My tex file is:

%% 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}
1
  • The transparent package makes a fairly clear warning: Package transparent Warning: Loading aborted, because pdfTeX is not running in PDF mode. so the problem is unrelated to tables/colortbl you need to find an implementation of transparency that works with xetex, so depends on the capability of the xdvipdfmx dvi driver, mostly Commented Dec 1, 2015 at 15:36

0

You must log in to answer this question.

Browse other questions tagged .