I'm trying to put together a composite tikz picture made up of sub tikz pictures - placing the subpictures in seperate tex files (they may have lots of lines of code), and then using \input to bring them together in the main. I've hit a specific problem which I've set out in a MWE.
My first question is, is this a sensible way to go about building a composite picture in tikz? It seems sensible to me as it works in Overleaf, and gives lots of control. But I think there might be issues with properties from the main tikz feeding through to the sub pictures.
My second question is why in the MWE below does the imported picture change post import. THere are two files, main and picture. If you compile picture.tex, the black circle is right in the centre of the triangles, as expected with the code. But when main is compiled, the black dot moves up crossing one of the lines. Why is this happening? (I can't see anything that would make it happen? I've tried the scaling and the location on page, and neither seem to change it). How might I fix it? Perhaps there is a quick fix, or perhaps I need to do it all differently. Many thanks for any help!
%%%%%%% main.tex%%%%%%%%
\documentclass[tikz]{standalone}
\usepackage{standalone}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\newcommand\scaling{0.3}
\begin{document}
\begin{tikzpicture}[node distance=3.5cm and 2cm]
\node[draw] at ( 0 , 0) [label={[scale = \scaling, name=TopLeft]\input{Picture} }] (TV1) {Picture};
%\node[below = of TV1, label={[scale=\scaling*2,name=Net] \input{Picture} }] (Net1) {Bottom Picture};
\end{tikzpicture}
\end{document}
%%%%%% Picture.tex %%%%%
\documentclass[tikz]{standalone}
\usepackage{standalone}
\usetikzlibrary{calc}
%%%%%%%%%%%
\begin{document}
\begin{tikzpicture}
\newcommand\height{0.8660}
\coordinate (A) at (1,0);
\coordinate (B) at (0.5,\height);
\coordinate (C) at (1.5,\height);
\coordinate (D) at (0,0);
\coordinate (E) at (2,0);
\coordinate (F) at (1,2*\height);
\draw[thick,dashed] (A) -- (B) -- (C) -- cycle;
\draw[thick,dashed] (D) -- (E) -- (F) -- cycle;
\node[draw,shape=circle,fill] (Orig) at ($0.333*(A)+0.333*(B)+0.333*(C)$) {\ \ };
\end{tikzpicture}
\end{document}
tikpictureenvironments. You can compile the embedded standalone to a pdf and include the pdf via\includegraphics, or work with\saveboxes. – May 07 '20 at 15:53\saveboxmethod is described here, where you get reminded once more that nestingtikzpictures is not a good idea. (In principle one could set the pgf keys one by one and see if this cures the problem, but this is really cumbersome.) I think that the pdf inclusion method is probably slightly better if you do not intend to change the picture very often since it is somewhat faster. Finally let me mention that you could store the smaller picture in apic(which cannot be put in a label but placed at will). – May 07 '20 at 20:48