Menu

#425 tikz transparency problem with background package

v1.0 (example)
closed-wont-fix
nobody
None
5
2019-01-22
2017-04-14
No

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}

Discussion

  • Henri Menke

    Henri Menke - 2019-01-22

    The background package uses a tikzpicture internally to place the background, so you are effectively nesting tikzpictures which is known to cause problems. Honestly, my solution would be to disallow nesting altogether, which would make your code throw a hard error.

     
  • Henri Menke

    Henri Menke - 2019-01-22
    • status: open --> closed-wont-fix
     
    • Geoff Russell

      Geoff Russell - 2019-01-23

      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
  • Henri Menke

    Henri Menke - 2019-01-22

    Nested tikzpictures are not supported. TikZ will now generate a warning if this is detected.

     
MongoDB Logo MongoDB