TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have problems creating a background for a scope envionment Here is part of the code I used for a beamer slide:



\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={
    },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} }

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
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);

\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$};

 \draw[fill=red] (-1.1,1.3) rectangle (1.3,-0.3);
%Scope 2... etc
share|improve this answer

Your Answer


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.