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.
Best Answer
In the end I put a custom
pgfonlayer
background on everyscope
. This relinquish the need to rely on TikZbackground
library and hence allowoverlay
option to work.