0

A Tikz picture has four nodes and each node has a new tikz picture, an inheritance problem coming. I have four Tikz pictures where each is inside a node and each node has size of 4cm times 4cm (square) but this size is inherited to other nodes where node size only ~1mm as shown in Bad Demo below with big black circles. So

How can I overwrite Tikz node settings in the inner nodes?

Bad Demo Four tikz pictures jammed together bad

enter image description here

Four tikz pictures with larger node but node style inherited, how to overwrite it?

enter image description here

where my goal is to have each node of size 4cm and each single tikz picture inside each node -- by this I try to make my tikz pictures more accessible and visually pleasing.

MWE

\documentclass[english]{article}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document} \begin{tikzpicture}

\nodeminimum size=4cm[label=(a) $x_1+x_2$]{ \begin{tikzpicture}[x=2cm, y=2cm] \coordinate [label=$x_1$] (1) at (0,0); \coordinate [label=$x_2$] (2) at (1,0); \node[draw=none,circle,inner sep=1pt,fill=black] (11) at (1){}; \node[circle,inner sep=1pt,fill=black] (22) at (2){}; \end{tikzpicture} };

\node(q2)[right =of q1,label=(b) $x_1+x_1x_2+x_2x_3$]{ \begin{tikzpicture}[x=2cm, y=2cm] \coordinate [label=$x_1$] (1) at (0,0); \coordinate [label=$x_1x_2$] (2) at (1,0); \coordinate [label=$x_2x_3$] (3) at (2,0); \draw (1)--(2)--(3); \node [circle,fill=black,inner sep=1pt] (11) at (1){}; \node [circle,fill=black,inner sep=1pt] (22) at (2){}; \node [circle,fill=black,inner sep=1pt] (33) at (3){}; \end{tikzpicture} };

\node(q3)[below =of q1,label=(c) $x_1x_2x_3+x_1+x_2+x_3$]{ \begin{tikzpicture}[x=2cm, y=2cm] \coordinate [label=left:$x_1$] (1) at (0,0); \coordinate [label=right:$x_2$] (2) at (2,0); \coordinate [label=below:$x_3$] (3) at (1,-2); \coordinate [label=right:$x_1x_2x_3$] (123) at (1,-1); \draw (1)--(123)--(2); \draw (3)--(123); \end{tikzpicture} };

\node(q4)[right =of q3,label=(d) $x_1x_2x_3+x_1x_2+x_2x_3+x_2x_3$]{ \begin{tikzpicture}[x=2cm, y=2cm] \coordinate [label=left:$x_1$] (1) at (0,0); \coordinate [label=right:$x_2$] (2) at (2,0); \coordinate [label=below:$x_3$] (3) at (1,-2); \coordinate [label=right:$x_1x_2x_3$] (123) at (1,-0.8); \draw (1)--(123)--(2)--(1); \draw (3)--(123); \draw (1)--(3); \draw (3)--(2); \end{tikzpicture} }; \end{tikzpicture} \end{document}

where [minimum size=4cm] creates the two big circles, its removal returns the jammed pictures in the beginning.

Trials

Trial 1: scope is suggested to avoid the overwriting but LaTeX Error: Environment scope is undefined, why?

enter image description here

hhh
  • 8,743
  • 2
    Don't use tikz picture inside tikz picture. Use scope instead. Don't use a scope inside a node but shift the scope to the node. – Tarass Jun 11 '16 at 03:06
  • Don't nest TikZ pictures. It is expected to break as @Tarass indicates. – cfr Jun 11 '16 at 03:11
  • 1
    Those look as if they should be subfigures or something rather than putting the captions within the pictures. – cfr Jun 11 '16 at 03:14
  • http://tex.stackexchange.com/questions/47377/proper-nesting-of-tikzpicture-environments-reset-all-pgf-values-to-their-defaul, http://tex.stackexchange.com/questions/46818/what-are-most-important-variables-set-at-the-beginning-of-a-tikzpicture-of-a-sc, http://tex.stackexchange.com/questions/47359/how-to-typeset-a-tikz-picture-inside-a-node, http://tex.stackexchange.com/questions/46598/problem-with-overlay-when-a-tikzpicture-is-inside-another-tikzpicture, http://tex.stackexchange.com/questions/47359/how-to-typeset-a-tikz-picture-inside-a-node etc. – cfr Jun 11 '16 at 03:32
  • @Tarass can you clarify Don't use a scope inside a node but shift the scope to the node.? What does the latter mean? Trial 1 demonstrate the former, not suggested, how to overcome this? – hhh Jun 11 '16 at 20:48
  • 1
    You want \begin{scope}[shift={(x,y)}] \node etc. \end{scope}, not \node at (x,y) {\begin{scope} this doesn't work \end{scope}}; – Torbjørn T. Jun 12 '16 at 07:02

0 Answers0