[Tex/LaTex] How to get tikzpictures to overlap on the same page

boxespositioningtikz-pgf

I have two complex TikZ drawings that need to overlap (appear on the same page). I can't put them into one tikzpicture, because different scale parameters need to be applied to them. Minimal example:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,fit}
\begin{document}
\begin{tikzpicture}[inner sep=0pt, outer sep=0pt, scale=2]
  \node (image) {\includegraphics{example-image}};
  \fill [white]
    (0,1) circle [radius=1];
\end{tikzpicture}
\begin{tikzpicture}[overlay, remember picture, scale=1]
  \fill [red]
    (0,0) circle [radius=1];
\end{tikzpicture}
\end{document}

This is what I get:

enter image description here

This is what I actually need:

enter image description here

The overlay option doesn't seem to work as expected. Using (current page.center) in the second tikzpicture doesn't work either. What am I doing wrong?

Best Answer

You can superpose two different tikzpicures if you have some reference from the first one. In this case, as you already have a image node in your first picture, just adding remember picture option to it, this image node will be available outside of it. Therefore, you can use it as reference inside the second tikzpicture.

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,fit}
\begin{document}
\begin{tikzpicture}[inner sep=0pt, outer sep=0pt, scale=2, remember picture]
  \node (image) {\includegraphics{example-image}};
  \fill [white]
    (0,1) circle [radius=1];
\end{tikzpicture}
\begin{tikzpicture}[overlay, remember picture, scale=1]
  \fill [red]
    (image) circle [radius=1];
\end{tikzpicture}
\end{document}

enter image description here