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 am trying to display a "forbidden sign" in the background of two tikzpictures (much like some kind of watermark). However, in the following MWE the "forbidden sign" is cut-off at some seemingly arbitrary horizontal line.

\documentclass{scrartcl}

\usepackage{tikz}
\usetikzlibrary{backgrounds,shapes}

\begin{document}
\noindent
  \begin{tikzpicture}
    \draw[green] (0.0, -5.0) rectangle (10.0, 0.0);
  \end{tikzpicture}\\
  \begin{tikzpicture}
    \draw[blue] (0.0, -5.0) rectangle (10.0, 0.0);
    \begin{pgfonlayer}{background}
      \begin{scope}[opacity=0.5,transparency group,overlay]
        \draw node[forbidden sign,
                   minimum size=5cm,
                   line width=2ex,
                   draw=red,
                   fill=white] at (5.0,0.0) {Test};
      \end{scope}
    \end{pgfonlayer}
  \end{tikzpicture}
\end{document}

Do you have any idea how I can fix this behaviour?

share|improve this question
2  
You need to remove overlay –  Alain Matthes Jun 19 '12 at 16:32
    
@Altermundus: I think it is not sufficient in this case simply removing overlay. That was my first attempt, but then the pictures were not more near. –  Claudio Fiandrino Jun 19 '12 at 16:36
    
When I remove overlay, the "forbidden sign" does not span the first tikzpicture. –  Aton Jun 19 '12 at 16:41
    
I would like to say : remove from the node option but I don't know exactly what result is desired. –  Alain Matthes Jun 19 '12 at 16:47
    
Why don't you use directly a watermark as given in the manual? It's much more simpler. –  percusse Jun 19 '12 at 16:52
show 1 more comment

1 Answer

up vote 1 down vote accepted

It seems difficult to use overlay with transparency group

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{backgrounds,shapes}
\pgfdeclarelayer{myback}    
\pgfsetlayers{myback,main}
\newsavebox{\mybox}   
\begin{document}
\parindent=0pt 

\savebox{\mybox}{%
\begin{tikzpicture}[transparency group,opacity=.5]
        \node[forbidden sign,
              minimum size=5cm,
              line width=2ex,
              draw=red,
              fill=white]  {};
\end{tikzpicture}} 

  \begin{tikzpicture}
    \draw[green] (0.0, -5.0) rectangle (10.0, 0.0);
  \end{tikzpicture}\\ \baselineskip=0pt     
 \begin{tikzpicture}[remember picture,overlay]
    \draw[blue] (0.0, -5.0) rectangle (10.0, 0.0);
      \begin{pgfonlayer}{myback}
    \node[inner sep=0pt] (s) at (5,0){\usebox\mybox};
    \end{pgfonlayer} 
  \end{tikzpicture}

\end{document}  

enter image description here

share|improve this answer
    
but there is other ways to get this. –  Alain Matthes Jun 19 '12 at 16:50
    
That is almost the result I would like to achieve. However I would like the two intersections of the line and the circle to have the same color. That is why I tried using "transparency group" in the first place. See pgfmanual, section 20.4 "Transparency Groups". –  Aton Jun 19 '12 at 16:54
    
A list of requests at the beginning of the first question is a better way to get a good answer :) Do you need two pictures ? –  Alain Matthes Jun 19 '12 at 16:59
    
Thanks for your answer! That seems to work. You mentioned that there are ``other ways to get this''. Could you elaborate on that? For clarification: in general I would like to be able to place watermark-like tikzpictures anywhere on the page relative to an existing-node. Btw, I searched the pgfmanual for 'watermark' but did not find a solution. –  Aton Jun 19 '12 at 18:58
    
There are some packages to place a picture on a page (eso-pic,watermark etc.) Here the problem seems to be a conflict between remember picture, overlay and transparency group. Finally it's difficult to avoid this problem because you need remember picture and overlay to place a picture in a page. Perhaps you need to wait another solution. –  Alain Matthes Jun 19 '12 at 19:24
show 3 more comments

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.