I've having an "intermittent" problem with opacity settings when using tikz to make a background. Sometimes it works and then I make some "unrelated" change and it starts to fail.
Here is the smallest example I could build to illustrate the problem ... it should have a transparent
white box on a red background, but the box is opaque.
Many thanks,
Geoff Russell
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,calc}
\usepackage[tmargin=30mm,bmargin=50mm]{geometry}
\usepackage[contents={},opacity=1,scale=1]{background}
\usepackage{lipsum}
\AddEverypageHook{
\backgroundsetup{
position=current page.north,anchor=below,angle=0,
contents={%
\begin{tikzpicture}[remember picture,overlay]
\node[opacity=1,rectangle,minimum width=150mm,color=black,text opacity=1,minimum height=70mm,fill=red] at (current page.north) (xx) {Node};
\node[rectangle,minimum width=50mm,opacity=0.5,color=black,text opacity=1,minimum height=20mm,fill=white] at (xx.center) {Overlay};
\end{tikzpicture}
}}%
\BgMaterial}
\begin{document}
\null
\vskip80mm
\lipsum[5]
\end{document}
The
backgroundpackage uses atikzpictureinternally to place the background, so you are effectively nestingtikzpictures which is known to cause problems. Honestly, my solution would be to disallow nesting altogether, which would make your code throw a hard error.Thanks for your attention on this issue. In the weeks after I lodged that
bug description, I rewrote my code to work quite differently and robustly
... and not
to require nested pictures.
Cheers,
Geoff
Last edit: Stefan Pinnow 2019-01-23
Nested tikzpictures are not supported. TikZ will now generate a warning if this is detected.