Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using the colortbl package to color table cells. I've combined this w/ the xcolor package to define my own colors. However, it appears that xcolor does not support transparency. I saw the package transparent, but it is oriented toward text and I wasn't able to set the transparency level of a defined color. Are there any packages that support alpha color channels?

share|improve this question

migrated from stackoverflow.com May 18 '12 at 18:39

This question came from our site for professional and enthusiast programmers.

    
You could do that either with PSTricks or with PGF/TikZ. A similar problem was discussed here: latex-community.org/forum/viewtopic.php?f=5&t=697 –  Mica Oct 28 '09 at 23:48
    
Yes, I saw that page, it doesn't really seem to address my question. Does anyone know how I could use TikZ to do this? I'd like to stick w/ pdflatex. –  Peter Oct 29 '09 at 3:46
    
    
Thanks, I saw that one as well, but he does not actually color cells in that table using TikZ as far as I can see. He uses colortbl which to the best of my knowledge doesn't accept colors w/ alpha channels –  Peter Oct 29 '09 at 18:12
3  
colortbl doesn't really care (much) what the color command is it just arranges to put a normal TeX rule behind the table cell and inser a "colour command" at suitable points to affect the color. so basically if tikz or pstricks or anything allows you to define a transparent colour such that (say) \color{something}\hrule makes a rule of transparent colour something then the same shoud work in colortbl. –  David Carlisle May 18 '12 at 18:58
show 2 more comments

1 Answer

up vote 5 down vote accepted

The following shows colortbl transparent panels allowing the coloured box behind the table to show through.

enter image description here

\documentclass{article}

\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.6}%
        \leaders\vrule
                \hskip\@tempdima\@plus  1fill
        \kern-\@tempdimc
        \hskip-\wd\z@ \@plus -1fill }
\makeatother

\begin{document}






\noindent\colorbox[rgb]{1,.5,.5}{\Large\strut \hspace{2in}}\hspace{-.5in}
\begin{tabular}{lll}
\rowcolor{blue} a & b & c\\
                aa&bb&cc\\
\rowcolor{yellow}1&2&3\\
                11&22&33
\end{tabular}
\end{document}
share|improve this answer
    
this workaround doesn't work with tabularx –  user24679 Jan 21 '13 at 14:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.