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 have problems creating a background for a scope envionment Here is part of the code I used for a beamer slide:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,calc,backgrounds}

\begin{document}
\begin{frame}[plain]    

\begin{tikzpicture}[scale=2, overlay, remember picture]
\coordinate[shift={(4.5cm,-3.5cm)}] (Anchor) at (current page.north west);

\only<2>{\begin{scope}[shift={(Anchor)},/tikz/background rectangle/.style={
        fill=yellow,
        draw=black
    },show background rectangle]
\draw[thin,->] (0,0) node (origin) [below] {$0$} -- (0,1) node (yaxis) [above] {$y$};
\draw[thin,->] (-1,0) node (xaxisL) {} -- (1,0) node (xaxisR) [right] {$x$};
\end{scope} }
\end{tikzpicture}
\end{frame}
\end{document}

Edited for clarification: Because of problem of background when overlay specification is active, i.e. \begin{tikzpicture}[overlay, show background...], This is the reason why I want to see if there is a simple way to put the background inside a scope environment. There isn't unfortunately and one have to draw their own background within scope it seems.

share|improve this question
    
There is nothing being drawn on the first slide. Can you please draw everything like 2 scopes and describe the problem as ...I want the first scope disappear on slide x and make the scope 2 background appear as y color.... even include an image. Right now, only you know what you want to do and it's too localized for us to get a hold of it. –  percusse Mar 20 '12 at 14:13
    
@percusse Thanks, well I nailed the problem, but still no solution. Basically, the BACKGROUND tool in tikz does not work with overlays. If overlay option is used, i.e. \begin{tikzpicture}[overlay,show background rectangle,...] the background fills the whole page. Without the overlay option I cannot position the subplot in the slide arbitrarily. –  Mobius Pizza Mar 20 '12 at 14:25
    
I found out how to use pgfonlayer to make my own background. Thanks anyway –  Mobius Pizza Mar 20 '12 at 14:47
    
I wish I could understand what your problem was. I will delete my answer and can you please wrap up your solution with a small working code. Others can benefit from this. –  percusse Mar 20 '12 at 14:53
    
Thanks for your help anyway, I am trying to 'answer my own question' but the system won't let me for another 6 hours :) –  Mobius Pizza Mar 20 '12 at 14:57
add comment

1 Answer 1

up vote 0 down vote accepted

In the end I put a custom pgfonlayer background on every scope. This relinquish the need to rely on TikZ background library and hence allow overlay option to work.

\begin{tikzpicture}[scale=2,remember picture,overlay]
\coordinate[shift={(4cm,-3.5cm)}] (Anchor) at (current page.north west);

\only<1>{
\begin{scope}[shift={(Anchor)}] 
\draw[thin,->] (0,0) node (origin) [below] {$0$} -- (0,1) node (yaxis) [above] {$y$};
\draw[thin,->] (-1,0) node (xaxisL) {} -- (1,0) node (xaxisR) [right] {$x$};

\begin{pgfonlayer}{background} 
 \draw[fill=red] (-1.1,1.3) rectangle (1.3,-0.3);
\end{pgfonlayer}
\end{scope}}
%Scope 2... etc
\end{tikzpicture}
share|improve this answer
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.