2

I am trying to use the 'transparent' package, as shown in this answer:

\documentclass{article}
\usepackage{color}
\usepackage{transparent}
\begin{document}
  \colorbox{red}{%
    Black text in a red box %
    \transparent{1.0}%
    \colorbox{blue}{%
      and now a blue box is added%
    }
  }

  \colorbox{red}{%
    Black text in a red box %
    \transparent{0.5}%
    \colorbox{blue}{%
      and now a transparent blue box is added%
    }
  }
\end{document}

But it seems not to work with current TeX or pdflatex. Is there an approach that works with pdflatex?

enter image description here


Edit: After compiling a few times (from TeXMaker), suddenly I can see the tranparency, although I did not change the .tex file nor the pdflatex command. Is this a bug?

6
  • 1
    it's not a bug, it's a feature: Package transparent Warning: Rerun to get transparencies right. ;-) You have to run (at least) twice.
    – user31729
    Mar 4, 2016 at 13:41
  • Oh alright. At best confusing...
    – Emit Taste
    Mar 4, 2016 at 13:43
  • Here, at my end, compiling it twice was enough.
    – AlexG
    Mar 4, 2016 at 13:45
  • I'm sure I ran it at least four times before the change was effective, but well, it works now
    – Emit Taste
    Mar 4, 2016 at 13:46
  • @EmitTaste: A small side note: The chosen colours are awful ;-)
    – user31729
    Mar 4, 2016 at 13:48

1 Answer 1

3

From the transparent manual:

2.3 Transparency The setting for the different transparency values must be added to the page resources. In the first run the values are recorded in the .aux file. In the second run the values are set and transparency is available.

This means, that the first run writes information to the .aux and the second run grabs those values and sets the whole feature up.

Compile twice

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .