maybe a duplicate of how to overlay a tikz picture with another
but there is no solution
ive been trying to overlay a tikzpicture with another This code does not work
\setbox0=\vbox{\hbox{%
\begin{tikzpicture}
% ...
\end{tizpicture}%
}}
%The width of the following picture is {\the\wd0}.
\box0
\hspace*{-\the\wd0}
\begin{tikzpicture}
% ...
\end{tizpicture}%
maybe it is of interest that the first picture is externalized?
If i used overlay
the whole picture is randomly cropped to a 1000th or so.
Thanks guys for your support. Here is the mwe:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{external}
\usepackage{scalefnt}
\tikzexternalize
\begin{document}
\tikzset{external/only named=true} % prevent unnamed graphics from externalizing - that is needed since externalizing strips annotations
{\scalefont{0.25}
\tikzsetnextfilename{test}
\begin{tikzpicture}
\draw (-1,0) -- (1,0);
\draw[blue] (0,-1) -- (0,1);
\node at (5,5) {A};
\end{tikzpicture}
} % scalefont
{\scalefont{0.25}
\llap{
\begin{tikzpicture}
\draw[red] (-1,0) -- (1,0);
\draw (0,-1) -- (0,1);
\node at (-5,-5) {B};
\end{tikzpicture}
} % llap
} % scalefont
\end{document}
As you can see: The pictures are not overlayed I want to achieve that the 'cross' of both pictures is at the exact same coordinate. In the end, only the black/blue cross would be shown (since red/black would be overlayed) And both nodes would be shown as well (since none of them is overlayed)
Second edit:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{external}
\usepackage{scalefnt}
\begin{document}
{\scalefont{0.25}
\begin{tikzpicture}[remember picture]
\draw (-1,0) -- (1,0);
\draw[blue] (0,-1) -- (0,1);
\node at (5,5) {A};
\end{tikzpicture}
} % scalefont
{\scalefont{0.25}
\llap{
\begin{tikzpicture}[remember picture,overlay]
\draw[red] (-1,0) -- (1,0);
\draw (0,-1) -- (0,1);
\node at (-5,-5) {B};
\end{tikzpicture}
} % llap
} % scalefont
\end{document}
overlay and remember does not work either (at least as I intend)
Edit 3: thanks AlexG
\documentclass{standalone}
\usepackage[table,dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\begin{document}
\tikzset{external/only named=true}
\makebox[0pt][l]{
\tikzsetnextfilename{tt}
\begin{tikzpicture}
\useasboundingbox (-10,-10) -- (10,10);
\node[draw=green] at (0,0) {};
\end{tikzpicture}
} % makebox
\begin{tikzpicture}
\useasboundingbox (-10,-10) -- (10,10);
\node[draw=green] at (0,0) {};
\end{tikzpicture}
\end{document}
It yields
backgrounds
library and draw eachtikzpicture
on a different layer. If you could provide a more specific MWE, we should be able to help.\box0
first inserts, then purges the box content. The following\wd0
returns zero. Better set box width to zero before inserting it,\wd0=0pt\box0
, and remove\hspace...
.\hspace*{-\the\wd0}
is\hspace{0pt}
but yo don't need teh low level primitives you could have used\sbox
and\usebox
no need to vbox/hbox etc. or simpler just do\begin{tikzpicture}...\end{tikzpicture}\llap{\begin{tikzpicture}...\end{tikzpicture}}