How do I draw a path of grey background on the nodes of tikz?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite
1












I would like to draw a path of grey along the tiks nodes of my lattices. I tried with drawing double line and filling them, but it didn't look right. Then I found this:



How do I draw a path of grey background through elements of a matrix?



It seem cleaner than what I did, but the problem of look stay the same. I'll post what I have now.



documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackage[french]babel
usepackageamsthm
usepackageamsmath
usepackageamssymb
usepackageurl
usepackageenumitem
usepackagexcolor
usepackagecolor
usepackagehyperref
usepackagefancyhdr
usepackagetitlesec
usepackagetikz
usetikzlibraryshapes
usepackage[margin=1.3in]geometry
setlengthskipfootins1cm

begindocument

begincenter
begintikzpicture[node distance=2cm, strip/.style=draw=gray, rounded corners=1mm, line width=1.5cm, opacity=0.5, line cap=round ]

tikzset
every node/.style=
draw=black, circle, circle,minimum size=1cm, fill=orange, fill opacity=0.8, text opacity=1


% First, locate each of the nodes and name them
node (void) at (0,0) $varnothing$;

node [above of=void] (y) $y$;
node [left of=y] (x) $x$;
node [right of=y] (z) $z$;

node [above of=x] (xy) $xy$;
node [above of=y] (xz) $xz$;
node [above of=z] (yz) $yz$;

node [above of=xz] (xyz) $xyz$;

%Testfield
draw [double distance = 1.3cm, thin, opacity=0.5, line cap=round] (void) -- (x) -- (xy) -- (xyz);

% First, locate each of the nodes and name them
node (void) at (0,0) $varnothing$;

node [above of=void] (y) $y$;
node [left of=y] (x) $x$;
node [right of=y] (z) $z$;

node [above of=x] (xy) $xy$;
node [above of=y] (xz) $xz$;
node [above of=z] (yz) $yz$;

node [above of=xz] (xyz) $xyz$;

% Now draw the lines:
draw [black, thick] (void) -- (x);
draw [black, thick] (void) -- (y);
draw [black, thick] (void) -- (z);

draw [black, thick] (x) -- (xy);
draw [black, thick] (y) -- (xy);

draw [black, thick] (x) -- (xz);
draw [black, thick] (z) -- (xz);

draw [black, thick] (y) -- (yz);
draw [black, thick] (z) -- (yz);

draw [black, thick] (xy) -- (xyz);
draw [black, thick] (xz) -- (xyz);
draw [black, thick] (yz) -- (xyz);

endtikzpicture
endcenter

enddocument


I also used some shenanigans so that the grey is in the background, but I was planning on cleaning that up when I had what I wanted.







share|improve this question


















  • 1




    Welcome to new site of TeX.SE. Please, can you add your complete code starting from documentclass?
    – Sebastiano
    Aug 9 at 20:41






  • 2




    Try draw[strip,transform canvas=xshift=-0.5mm] (void.south east) -- (x.south) -- (xy.north) -- (xyz.north east);
    – marmot
    Aug 9 at 20:48











  • It's a lot better! But they still aren't quite aligned.
    – ZelteHonor
    Aug 9 at 20:52














up vote
3
down vote

favorite
1












I would like to draw a path of grey along the tiks nodes of my lattices. I tried with drawing double line and filling them, but it didn't look right. Then I found this:



How do I draw a path of grey background through elements of a matrix?



It seem cleaner than what I did, but the problem of look stay the same. I'll post what I have now.



documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackage[french]babel
usepackageamsthm
usepackageamsmath
usepackageamssymb
usepackageurl
usepackageenumitem
usepackagexcolor
usepackagecolor
usepackagehyperref
usepackagefancyhdr
usepackagetitlesec
usepackagetikz
usetikzlibraryshapes
usepackage[margin=1.3in]geometry
setlengthskipfootins1cm

begindocument

begincenter
begintikzpicture[node distance=2cm, strip/.style=draw=gray, rounded corners=1mm, line width=1.5cm, opacity=0.5, line cap=round ]

tikzset
every node/.style=
draw=black, circle, circle,minimum size=1cm, fill=orange, fill opacity=0.8, text opacity=1


% First, locate each of the nodes and name them
node (void) at (0,0) $varnothing$;

node [above of=void] (y) $y$;
node [left of=y] (x) $x$;
node [right of=y] (z) $z$;

node [above of=x] (xy) $xy$;
node [above of=y] (xz) $xz$;
node [above of=z] (yz) $yz$;

node [above of=xz] (xyz) $xyz$;

%Testfield
draw [double distance = 1.3cm, thin, opacity=0.5, line cap=round] (void) -- (x) -- (xy) -- (xyz);

% First, locate each of the nodes and name them
node (void) at (0,0) $varnothing$;

node [above of=void] (y) $y$;
node [left of=y] (x) $x$;
node [right of=y] (z) $z$;

node [above of=x] (xy) $xy$;
node [above of=y] (xz) $xz$;
node [above of=z] (yz) $yz$;

node [above of=xz] (xyz) $xyz$;

% Now draw the lines:
draw [black, thick] (void) -- (x);
draw [black, thick] (void) -- (y);
draw [black, thick] (void) -- (z);

draw [black, thick] (x) -- (xy);
draw [black, thick] (y) -- (xy);

draw [black, thick] (x) -- (xz);
draw [black, thick] (z) -- (xz);

draw [black, thick] (y) -- (yz);
draw [black, thick] (z) -- (yz);

draw [black, thick] (xy) -- (xyz);
draw [black, thick] (xz) -- (xyz);
draw [black, thick] (yz) -- (xyz);

endtikzpicture
endcenter

enddocument


I also used some shenanigans so that the grey is in the background, but I was planning on cleaning that up when I had what I wanted.







share|improve this question


















  • 1




    Welcome to new site of TeX.SE. Please, can you add your complete code starting from documentclass?
    – Sebastiano
    Aug 9 at 20:41






  • 2




    Try draw[strip,transform canvas=xshift=-0.5mm] (void.south east) -- (x.south) -- (xy.north) -- (xyz.north east);
    – marmot
    Aug 9 at 20:48











  • It's a lot better! But they still aren't quite aligned.
    – ZelteHonor
    Aug 9 at 20:52












up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





I would like to draw a path of grey along the tiks nodes of my lattices. I tried with drawing double line and filling them, but it didn't look right. Then I found this:



How do I draw a path of grey background through elements of a matrix?



It seem cleaner than what I did, but the problem of look stay the same. I'll post what I have now.



documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackage[french]babel
usepackageamsthm
usepackageamsmath
usepackageamssymb
usepackageurl
usepackageenumitem
usepackagexcolor
usepackagecolor
usepackagehyperref
usepackagefancyhdr
usepackagetitlesec
usepackagetikz
usetikzlibraryshapes
usepackage[margin=1.3in]geometry
setlengthskipfootins1cm

begindocument

begincenter
begintikzpicture[node distance=2cm, strip/.style=draw=gray, rounded corners=1mm, line width=1.5cm, opacity=0.5, line cap=round ]

tikzset
every node/.style=
draw=black, circle, circle,minimum size=1cm, fill=orange, fill opacity=0.8, text opacity=1


% First, locate each of the nodes and name them
node (void) at (0,0) $varnothing$;

node [above of=void] (y) $y$;
node [left of=y] (x) $x$;
node [right of=y] (z) $z$;

node [above of=x] (xy) $xy$;
node [above of=y] (xz) $xz$;
node [above of=z] (yz) $yz$;

node [above of=xz] (xyz) $xyz$;

%Testfield
draw [double distance = 1.3cm, thin, opacity=0.5, line cap=round] (void) -- (x) -- (xy) -- (xyz);

% First, locate each of the nodes and name them
node (void) at (0,0) $varnothing$;

node [above of=void] (y) $y$;
node [left of=y] (x) $x$;
node [right of=y] (z) $z$;

node [above of=x] (xy) $xy$;
node [above of=y] (xz) $xz$;
node [above of=z] (yz) $yz$;

node [above of=xz] (xyz) $xyz$;

% Now draw the lines:
draw [black, thick] (void) -- (x);
draw [black, thick] (void) -- (y);
draw [black, thick] (void) -- (z);

draw [black, thick] (x) -- (xy);
draw [black, thick] (y) -- (xy);

draw [black, thick] (x) -- (xz);
draw [black, thick] (z) -- (xz);

draw [black, thick] (y) -- (yz);
draw [black, thick] (z) -- (yz);

draw [black, thick] (xy) -- (xyz);
draw [black, thick] (xz) -- (xyz);
draw [black, thick] (yz) -- (xyz);

endtikzpicture
endcenter

enddocument


I also used some shenanigans so that the grey is in the background, but I was planning on cleaning that up when I had what I wanted.







share|improve this question














I would like to draw a path of grey along the tiks nodes of my lattices. I tried with drawing double line and filling them, but it didn't look right. Then I found this:



How do I draw a path of grey background through elements of a matrix?



It seem cleaner than what I did, but the problem of look stay the same. I'll post what I have now.



documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackage[french]babel
usepackageamsthm
usepackageamsmath
usepackageamssymb
usepackageurl
usepackageenumitem
usepackagexcolor
usepackagecolor
usepackagehyperref
usepackagefancyhdr
usepackagetitlesec
usepackagetikz
usetikzlibraryshapes
usepackage[margin=1.3in]geometry
setlengthskipfootins1cm

begindocument

begincenter
begintikzpicture[node distance=2cm, strip/.style=draw=gray, rounded corners=1mm, line width=1.5cm, opacity=0.5, line cap=round ]

tikzset
every node/.style=
draw=black, circle, circle,minimum size=1cm, fill=orange, fill opacity=0.8, text opacity=1


% First, locate each of the nodes and name them
node (void) at (0,0) $varnothing$;

node [above of=void] (y) $y$;
node [left of=y] (x) $x$;
node [right of=y] (z) $z$;

node [above of=x] (xy) $xy$;
node [above of=y] (xz) $xz$;
node [above of=z] (yz) $yz$;

node [above of=xz] (xyz) $xyz$;

%Testfield
draw [double distance = 1.3cm, thin, opacity=0.5, line cap=round] (void) -- (x) -- (xy) -- (xyz);

% First, locate each of the nodes and name them
node (void) at (0,0) $varnothing$;

node [above of=void] (y) $y$;
node [left of=y] (x) $x$;
node [right of=y] (z) $z$;

node [above of=x] (xy) $xy$;
node [above of=y] (xz) $xz$;
node [above of=z] (yz) $yz$;

node [above of=xz] (xyz) $xyz$;

% Now draw the lines:
draw [black, thick] (void) -- (x);
draw [black, thick] (void) -- (y);
draw [black, thick] (void) -- (z);

draw [black, thick] (x) -- (xy);
draw [black, thick] (y) -- (xy);

draw [black, thick] (x) -- (xz);
draw [black, thick] (z) -- (xz);

draw [black, thick] (y) -- (yz);
draw [black, thick] (z) -- (yz);

draw [black, thick] (xy) -- (xyz);
draw [black, thick] (xz) -- (xyz);
draw [black, thick] (yz) -- (xyz);

endtikzpicture
endcenter

enddocument


I also used some shenanigans so that the grey is in the background, but I was planning on cleaning that up when I had what I wanted.









share|improve this question













share|improve this question




share|improve this question








edited Aug 9 at 22:32









Thruston

24.4k23987




24.4k23987










asked Aug 9 at 20:40









ZelteHonor

162




162







  • 1




    Welcome to new site of TeX.SE. Please, can you add your complete code starting from documentclass?
    – Sebastiano
    Aug 9 at 20:41






  • 2




    Try draw[strip,transform canvas=xshift=-0.5mm] (void.south east) -- (x.south) -- (xy.north) -- (xyz.north east);
    – marmot
    Aug 9 at 20:48











  • It's a lot better! But they still aren't quite aligned.
    – ZelteHonor
    Aug 9 at 20:52












  • 1




    Welcome to new site of TeX.SE. Please, can you add your complete code starting from documentclass?
    – Sebastiano
    Aug 9 at 20:41






  • 2




    Try draw[strip,transform canvas=xshift=-0.5mm] (void.south east) -- (x.south) -- (xy.north) -- (xyz.north east);
    – marmot
    Aug 9 at 20:48











  • It's a lot better! But they still aren't quite aligned.
    – ZelteHonor
    Aug 9 at 20:52







1




1




Welcome to new site of TeX.SE. Please, can you add your complete code starting from documentclass?
– Sebastiano
Aug 9 at 20:41




Welcome to new site of TeX.SE. Please, can you add your complete code starting from documentclass?
– Sebastiano
Aug 9 at 20:41




2




2




Try draw[strip,transform canvas=xshift=-0.5mm] (void.south east) -- (x.south) -- (xy.north) -- (xyz.north east);
– marmot
Aug 9 at 20:48





Try draw[strip,transform canvas=xshift=-0.5mm] (void.south east) -- (x.south) -- (xy.north) -- (xyz.north east);
– marmot
Aug 9 at 20:48













It's a lot better! But they still aren't quite aligned.
– ZelteHonor
Aug 9 at 20:52




It's a lot better! But they still aren't quite aligned.
– ZelteHonor
Aug 9 at 20:52










3 Answers
3






active

oldest

votes

















up vote
6
down vote













The correct answer is the one by J. Leon V., who does what Zarko did in his nice answer, namely used the centers. Here are some additional suggestions:



  • Put the contour on the background.

  • Blur the boundary a bit.

  • Simplify the connections.

Here is the result.



documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds
usepackageamssymb
begindocument
begintikzpicture[node distance=2cm]
tikzsetstrip/.style=draw=gray!40, rounded corners=1mm, line width=1.5cm,opacity=0.5,
line cap=round,on background layer,
postaction=draw=gray!50,opacity=0.5,rounded corners=1mm, line width=1.46cm,line
cap=round,
postaction=draw=gray!60,opacity=0.5,rounded corners=1mm, line width=1.42cm,line
cap=round,
postaction=draw=gray!70,opacity=0.5,rounded corners=1mm, line width=1.38cm,line
cap=round,
postaction=draw=gray!80,opacity=0.5,rounded corners=1mm, line width=1.34cm,line
cap=round

tikzset
every node/.style=
draw=black, circle, circle,minimum size=1cm, fill=orange, fill opacity=0.8, text opacity=1



% First, locate each of the nodes and name them
node (void) at (0,0) $varnothing$;

node [above of=void] (y) $y$;
node [left of=y] (x) $x$;
node [right of=y] (z) $z$;

node [above of=x] (xy) $xy$;
node [above of=y] (xz) $xz$;
node [above of=z] (yz) $yz$;

node [above of=xz] (xyz) $xyz$;

%Testfield

% I guess in Zarko's nice answer ,transform canvas=xshift=-0.5mm
% was for the bounding box. It would actually have been easier to use
% overlay, which just interrupts the bounding box
draw[strip] (void.center)
-- (x.center) -- (xy.center) --
(xyz.center);

% First, locate each of the nodes and name them
node (void) at (0,0) $varnothing$;

node [above of=void] (y) $y$;
node [left of=y] (x) $x$;
node [right of=y] (z) $z$;

node [above of=x] (xy) $xy$;
node [above of=y] (xz) $xz$;
node [above of=z] (yz) $yz$;

node [above of=xz] (xyz) $xyz$;

% Now draw the lines:
beginscope[black, thick]
draw (void) edge (x) edge (y) edge (z);
draw (x) -- (xy) -- (y);
draw (x) -- (xz) -- (z);
draw (y) -- (yz) -- (z);
draw (xyz) edge (xy) edge (xz) edge (yz);
endscope

endtikzpicture
enddocument


enter image description here






share|improve this answer





























    up vote
    5
    down vote













    The error you make is that you draw lines between nodes instead of coordinates.



    RESULT:



    enter image description here



    MWE:



    documentclassstandalone
    usepackagetikz
    usetikzlibrarybackgrounds
    usepackageamssymb
    begindocument
    begintikzpicture[
    %Environment config
    node distance=2cm,
    %Environment Styles
    strip/.style=
    draw=gray,
    rounded corners=1mm,
    line width=1.3cm,
    opacity=0.5, line cap=round
    ,
    every node/.style=
    draw=black,
    circle,
    minimum size=1cm,
    fill=orange,
    fill opacity=0.8,
    text opacity=1

    ]
    % First, locate each of the nodes and name them
    node (void) at (0,0) $varnothing$;
    node [above of=void] (y) $y$;
    node [left of=y] (x) $x$;
    node [right of=y] (z) $z$;
    node [above of=x] (xy) $xy$;
    node [above of=y] (xz) $xz$;
    node [above of=z] (yz) $yz$;
    node [above of=xz] (xyz) $xyz$;
    % Now draw the lines:
    draw [black, thick] % Here you draw a line between nodes, each line start and end in the shape
    (xz)
    edge (xyz)
    edge (x)
    edge (z)
    (y)
    edge (xy)
    edge (yz)
    edge (void)
    (void)
    -- (x)
    -- (xy)
    -- (xyz)
    -- (yz)
    -- (z)
    -- (void) ;

    draw[strip] % (nodename.center) gives a coordinate from the center of the node, and the line is continuous
    (void.center)
    -- (x.center)
    -- (xy.center)
    -- (xyz.center);

    endtikzpicture
    enddocument



    UPDATE



    To not shade the nodes the line is drawn in the background layer (as I observed in @marmot's answer, and then in the rest to not stay behind.):



    RESULT:
    enter image description here



    MWE:



    documentclassstandalone
    usepackagetikz
    usetikzlibrarybackgrounds
    usepackageamssymb
    begindocument
    begintikzpicture[
    %Environment config
    node distance=2cm,
    %Environment Styles
    strip/.style=
    draw=gray,
    rounded corners=1mm,
    line width=1.3cm,
    opacity=0.5, line cap=round
    ,
    every node/.style=
    draw=black,
    circle,
    minimum size=1cm,
    fill=orange,
    fill opacity=0.8,
    text opacity=1

    ]
    % First, locate each of the nodes and name them
    node (void) at (0,0) $varnothing$;
    node [above of=void] (y) $y$;
    node [left of=y] (x) $x$;
    node [right of=y] (z) $z$;
    node [above of=x] (xy) $xy$;
    node [above of=y] (xz) $xz$;
    node [above of=z] (yz) $yz$;
    node [above of=xz] (xyz) $xyz$;
    % Now draw the lines:
    draw [black, thick] % Here you draw a line between nodes, each line start and end in the shape
    (xz)
    edge (xyz)
    edge (x)
    edge (z)
    (y)
    edge (xy)
    edge (yz)
    edge (void)
    (void)
    -- (x)
    -- (xy)
    -- (xyz)
    -- (yz)
    -- (z)
    -- (void) ;
    beginscope[on background layer]
    draw[strip] % (nodename.center) gives a coordinate from the center of the node, and the line is continuous
    (void.center)
    -- (x.center)
    -- (xy.center)
    -- (xyz.center);
    endscope
    endtikzpicture
    enddocument





    share|improve this answer


















    • 1




      Done, and nice 3d marmot...
      – J Leon V.
      Aug 10 at 2:56

















    up vote
    4
    down vote













    Just for comparison, here is a Metapost alternative. Compile with lualatex for the luamplib support.



    enter image description here



    documentclass[border=5mm]standalone
    usepackageluatex85
    usepackageluamplib
    begindocument
    mplibtextextlabelenable
    beginmplibcode
    beginfig(1);

    path s, ss;
    s = unitsquare scaled 70.71 rotated 45;
    ss = s shifted 50 up;

    draw point 0 of s -- point 3 of s -- point 3 of ss -- point 2 of ss
    withpen pencircle scaled 32
    withcolor 3/4 white;

    draw s; draw ss;
    for i=0 upto 3:
    draw point i of s -- point i of ss;
    endfor

    vardef node(expr t, p) =
    fill fullcircle scaled 24 shifted p withcolor red + 1/2 green;
    draw fullcircle scaled 24 shifted p;
    label(t, p);
    enddef;

    node("$emptyset$", point 0 of s);
    node("$x$", point 3 of s);
    node("$z$", point 1 of s);
    node("$xz$", point 2 of s);
    node("$y$", point 0 of ss);
    node("$xy$", point 3 of ss);
    node("$yz$", point 1 of ss);
    node("$xyz$", point 2 of ss);

    endfig;
    endmplibcode
    enddocument


    Note that this one is quite hard to adapt to plain old mpost; the mplibtextextlabelenable setting makes it much simpler to create
    the node function, as the strings get compiled as TeX automatically.






    share|improve this answer






















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "85"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );








       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f445387%2fhow-do-i-draw-a-path-of-grey-background-on-the-nodes-of-tikz%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      6
      down vote













      The correct answer is the one by J. Leon V., who does what Zarko did in his nice answer, namely used the centers. Here are some additional suggestions:



      • Put the contour on the background.

      • Blur the boundary a bit.

      • Simplify the connections.

      Here is the result.



      documentclass[tikz,border=3.14mm]standalone
      usetikzlibrarybackgrounds
      usepackageamssymb
      begindocument
      begintikzpicture[node distance=2cm]
      tikzsetstrip/.style=draw=gray!40, rounded corners=1mm, line width=1.5cm,opacity=0.5,
      line cap=round,on background layer,
      postaction=draw=gray!50,opacity=0.5,rounded corners=1mm, line width=1.46cm,line
      cap=round,
      postaction=draw=gray!60,opacity=0.5,rounded corners=1mm, line width=1.42cm,line
      cap=round,
      postaction=draw=gray!70,opacity=0.5,rounded corners=1mm, line width=1.38cm,line
      cap=round,
      postaction=draw=gray!80,opacity=0.5,rounded corners=1mm, line width=1.34cm,line
      cap=round

      tikzset
      every node/.style=
      draw=black, circle, circle,minimum size=1cm, fill=orange, fill opacity=0.8, text opacity=1



      % First, locate each of the nodes and name them
      node (void) at (0,0) $varnothing$;

      node [above of=void] (y) $y$;
      node [left of=y] (x) $x$;
      node [right of=y] (z) $z$;

      node [above of=x] (xy) $xy$;
      node [above of=y] (xz) $xz$;
      node [above of=z] (yz) $yz$;

      node [above of=xz] (xyz) $xyz$;

      %Testfield

      % I guess in Zarko's nice answer ,transform canvas=xshift=-0.5mm
      % was for the bounding box. It would actually have been easier to use
      % overlay, which just interrupts the bounding box
      draw[strip] (void.center)
      -- (x.center) -- (xy.center) --
      (xyz.center);

      % First, locate each of the nodes and name them
      node (void) at (0,0) $varnothing$;

      node [above of=void] (y) $y$;
      node [left of=y] (x) $x$;
      node [right of=y] (z) $z$;

      node [above of=x] (xy) $xy$;
      node [above of=y] (xz) $xz$;
      node [above of=z] (yz) $yz$;

      node [above of=xz] (xyz) $xyz$;

      % Now draw the lines:
      beginscope[black, thick]
      draw (void) edge (x) edge (y) edge (z);
      draw (x) -- (xy) -- (y);
      draw (x) -- (xz) -- (z);
      draw (y) -- (yz) -- (z);
      draw (xyz) edge (xy) edge (xz) edge (yz);
      endscope

      endtikzpicture
      enddocument


      enter image description here






      share|improve this answer


























        up vote
        6
        down vote













        The correct answer is the one by J. Leon V., who does what Zarko did in his nice answer, namely used the centers. Here are some additional suggestions:



        • Put the contour on the background.

        • Blur the boundary a bit.

        • Simplify the connections.

        Here is the result.



        documentclass[tikz,border=3.14mm]standalone
        usetikzlibrarybackgrounds
        usepackageamssymb
        begindocument
        begintikzpicture[node distance=2cm]
        tikzsetstrip/.style=draw=gray!40, rounded corners=1mm, line width=1.5cm,opacity=0.5,
        line cap=round,on background layer,
        postaction=draw=gray!50,opacity=0.5,rounded corners=1mm, line width=1.46cm,line
        cap=round,
        postaction=draw=gray!60,opacity=0.5,rounded corners=1mm, line width=1.42cm,line
        cap=round,
        postaction=draw=gray!70,opacity=0.5,rounded corners=1mm, line width=1.38cm,line
        cap=round,
        postaction=draw=gray!80,opacity=0.5,rounded corners=1mm, line width=1.34cm,line
        cap=round

        tikzset
        every node/.style=
        draw=black, circle, circle,minimum size=1cm, fill=orange, fill opacity=0.8, text opacity=1



        % First, locate each of the nodes and name them
        node (void) at (0,0) $varnothing$;

        node [above of=void] (y) $y$;
        node [left of=y] (x) $x$;
        node [right of=y] (z) $z$;

        node [above of=x] (xy) $xy$;
        node [above of=y] (xz) $xz$;
        node [above of=z] (yz) $yz$;

        node [above of=xz] (xyz) $xyz$;

        %Testfield

        % I guess in Zarko's nice answer ,transform canvas=xshift=-0.5mm
        % was for the bounding box. It would actually have been easier to use
        % overlay, which just interrupts the bounding box
        draw[strip] (void.center)
        -- (x.center) -- (xy.center) --
        (xyz.center);

        % First, locate each of the nodes and name them
        node (void) at (0,0) $varnothing$;

        node [above of=void] (y) $y$;
        node [left of=y] (x) $x$;
        node [right of=y] (z) $z$;

        node [above of=x] (xy) $xy$;
        node [above of=y] (xz) $xz$;
        node [above of=z] (yz) $yz$;

        node [above of=xz] (xyz) $xyz$;

        % Now draw the lines:
        beginscope[black, thick]
        draw (void) edge (x) edge (y) edge (z);
        draw (x) -- (xy) -- (y);
        draw (x) -- (xz) -- (z);
        draw (y) -- (yz) -- (z);
        draw (xyz) edge (xy) edge (xz) edge (yz);
        endscope

        endtikzpicture
        enddocument


        enter image description here






        share|improve this answer
























          up vote
          6
          down vote










          up vote
          6
          down vote









          The correct answer is the one by J. Leon V., who does what Zarko did in his nice answer, namely used the centers. Here are some additional suggestions:



          • Put the contour on the background.

          • Blur the boundary a bit.

          • Simplify the connections.

          Here is the result.



          documentclass[tikz,border=3.14mm]standalone
          usetikzlibrarybackgrounds
          usepackageamssymb
          begindocument
          begintikzpicture[node distance=2cm]
          tikzsetstrip/.style=draw=gray!40, rounded corners=1mm, line width=1.5cm,opacity=0.5,
          line cap=round,on background layer,
          postaction=draw=gray!50,opacity=0.5,rounded corners=1mm, line width=1.46cm,line
          cap=round,
          postaction=draw=gray!60,opacity=0.5,rounded corners=1mm, line width=1.42cm,line
          cap=round,
          postaction=draw=gray!70,opacity=0.5,rounded corners=1mm, line width=1.38cm,line
          cap=round,
          postaction=draw=gray!80,opacity=0.5,rounded corners=1mm, line width=1.34cm,line
          cap=round

          tikzset
          every node/.style=
          draw=black, circle, circle,minimum size=1cm, fill=orange, fill opacity=0.8, text opacity=1



          % First, locate each of the nodes and name them
          node (void) at (0,0) $varnothing$;

          node [above of=void] (y) $y$;
          node [left of=y] (x) $x$;
          node [right of=y] (z) $z$;

          node [above of=x] (xy) $xy$;
          node [above of=y] (xz) $xz$;
          node [above of=z] (yz) $yz$;

          node [above of=xz] (xyz) $xyz$;

          %Testfield

          % I guess in Zarko's nice answer ,transform canvas=xshift=-0.5mm
          % was for the bounding box. It would actually have been easier to use
          % overlay, which just interrupts the bounding box
          draw[strip] (void.center)
          -- (x.center) -- (xy.center) --
          (xyz.center);

          % First, locate each of the nodes and name them
          node (void) at (0,0) $varnothing$;

          node [above of=void] (y) $y$;
          node [left of=y] (x) $x$;
          node [right of=y] (z) $z$;

          node [above of=x] (xy) $xy$;
          node [above of=y] (xz) $xz$;
          node [above of=z] (yz) $yz$;

          node [above of=xz] (xyz) $xyz$;

          % Now draw the lines:
          beginscope[black, thick]
          draw (void) edge (x) edge (y) edge (z);
          draw (x) -- (xy) -- (y);
          draw (x) -- (xz) -- (z);
          draw (y) -- (yz) -- (z);
          draw (xyz) edge (xy) edge (xz) edge (yz);
          endscope

          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer














          The correct answer is the one by J. Leon V., who does what Zarko did in his nice answer, namely used the centers. Here are some additional suggestions:



          • Put the contour on the background.

          • Blur the boundary a bit.

          • Simplify the connections.

          Here is the result.



          documentclass[tikz,border=3.14mm]standalone
          usetikzlibrarybackgrounds
          usepackageamssymb
          begindocument
          begintikzpicture[node distance=2cm]
          tikzsetstrip/.style=draw=gray!40, rounded corners=1mm, line width=1.5cm,opacity=0.5,
          line cap=round,on background layer,
          postaction=draw=gray!50,opacity=0.5,rounded corners=1mm, line width=1.46cm,line
          cap=round,
          postaction=draw=gray!60,opacity=0.5,rounded corners=1mm, line width=1.42cm,line
          cap=round,
          postaction=draw=gray!70,opacity=0.5,rounded corners=1mm, line width=1.38cm,line
          cap=round,
          postaction=draw=gray!80,opacity=0.5,rounded corners=1mm, line width=1.34cm,line
          cap=round

          tikzset
          every node/.style=
          draw=black, circle, circle,minimum size=1cm, fill=orange, fill opacity=0.8, text opacity=1



          % First, locate each of the nodes and name them
          node (void) at (0,0) $varnothing$;

          node [above of=void] (y) $y$;
          node [left of=y] (x) $x$;
          node [right of=y] (z) $z$;

          node [above of=x] (xy) $xy$;
          node [above of=y] (xz) $xz$;
          node [above of=z] (yz) $yz$;

          node [above of=xz] (xyz) $xyz$;

          %Testfield

          % I guess in Zarko's nice answer ,transform canvas=xshift=-0.5mm
          % was for the bounding box. It would actually have been easier to use
          % overlay, which just interrupts the bounding box
          draw[strip] (void.center)
          -- (x.center) -- (xy.center) --
          (xyz.center);

          % First, locate each of the nodes and name them
          node (void) at (0,0) $varnothing$;

          node [above of=void] (y) $y$;
          node [left of=y] (x) $x$;
          node [right of=y] (z) $z$;

          node [above of=x] (xy) $xy$;
          node [above of=y] (xz) $xz$;
          node [above of=z] (yz) $yz$;

          node [above of=xz] (xyz) $xyz$;

          % Now draw the lines:
          beginscope[black, thick]
          draw (void) edge (x) edge (y) edge (z);
          draw (x) -- (xy) -- (y);
          draw (x) -- (xz) -- (z);
          draw (y) -- (yz) -- (z);
          draw (xyz) edge (xy) edge (xz) edge (yz);
          endscope

          endtikzpicture
          enddocument


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 9 at 23:27

























          answered Aug 9 at 20:55









          marmot

          51.5k350112




          51.5k350112




















              up vote
              5
              down vote













              The error you make is that you draw lines between nodes instead of coordinates.



              RESULT:



              enter image description here



              MWE:



              documentclassstandalone
              usepackagetikz
              usetikzlibrarybackgrounds
              usepackageamssymb
              begindocument
              begintikzpicture[
              %Environment config
              node distance=2cm,
              %Environment Styles
              strip/.style=
              draw=gray,
              rounded corners=1mm,
              line width=1.3cm,
              opacity=0.5, line cap=round
              ,
              every node/.style=
              draw=black,
              circle,
              minimum size=1cm,
              fill=orange,
              fill opacity=0.8,
              text opacity=1

              ]
              % First, locate each of the nodes and name them
              node (void) at (0,0) $varnothing$;
              node [above of=void] (y) $y$;
              node [left of=y] (x) $x$;
              node [right of=y] (z) $z$;
              node [above of=x] (xy) $xy$;
              node [above of=y] (xz) $xz$;
              node [above of=z] (yz) $yz$;
              node [above of=xz] (xyz) $xyz$;
              % Now draw the lines:
              draw [black, thick] % Here you draw a line between nodes, each line start and end in the shape
              (xz)
              edge (xyz)
              edge (x)
              edge (z)
              (y)
              edge (xy)
              edge (yz)
              edge (void)
              (void)
              -- (x)
              -- (xy)
              -- (xyz)
              -- (yz)
              -- (z)
              -- (void) ;

              draw[strip] % (nodename.center) gives a coordinate from the center of the node, and the line is continuous
              (void.center)
              -- (x.center)
              -- (xy.center)
              -- (xyz.center);

              endtikzpicture
              enddocument



              UPDATE



              To not shade the nodes the line is drawn in the background layer (as I observed in @marmot's answer, and then in the rest to not stay behind.):



              RESULT:
              enter image description here



              MWE:



              documentclassstandalone
              usepackagetikz
              usetikzlibrarybackgrounds
              usepackageamssymb
              begindocument
              begintikzpicture[
              %Environment config
              node distance=2cm,
              %Environment Styles
              strip/.style=
              draw=gray,
              rounded corners=1mm,
              line width=1.3cm,
              opacity=0.5, line cap=round
              ,
              every node/.style=
              draw=black,
              circle,
              minimum size=1cm,
              fill=orange,
              fill opacity=0.8,
              text opacity=1

              ]
              % First, locate each of the nodes and name them
              node (void) at (0,0) $varnothing$;
              node [above of=void] (y) $y$;
              node [left of=y] (x) $x$;
              node [right of=y] (z) $z$;
              node [above of=x] (xy) $xy$;
              node [above of=y] (xz) $xz$;
              node [above of=z] (yz) $yz$;
              node [above of=xz] (xyz) $xyz$;
              % Now draw the lines:
              draw [black, thick] % Here you draw a line between nodes, each line start and end in the shape
              (xz)
              edge (xyz)
              edge (x)
              edge (z)
              (y)
              edge (xy)
              edge (yz)
              edge (void)
              (void)
              -- (x)
              -- (xy)
              -- (xyz)
              -- (yz)
              -- (z)
              -- (void) ;
              beginscope[on background layer]
              draw[strip] % (nodename.center) gives a coordinate from the center of the node, and the line is continuous
              (void.center)
              -- (x.center)
              -- (xy.center)
              -- (xyz.center);
              endscope
              endtikzpicture
              enddocument





              share|improve this answer


















              • 1




                Done, and nice 3d marmot...
                – J Leon V.
                Aug 10 at 2:56














              up vote
              5
              down vote













              The error you make is that you draw lines between nodes instead of coordinates.



              RESULT:



              enter image description here



              MWE:



              documentclassstandalone
              usepackagetikz
              usetikzlibrarybackgrounds
              usepackageamssymb
              begindocument
              begintikzpicture[
              %Environment config
              node distance=2cm,
              %Environment Styles
              strip/.style=
              draw=gray,
              rounded corners=1mm,
              line width=1.3cm,
              opacity=0.5, line cap=round
              ,
              every node/.style=
              draw=black,
              circle,
              minimum size=1cm,
              fill=orange,
              fill opacity=0.8,
              text opacity=1

              ]
              % First, locate each of the nodes and name them
              node (void) at (0,0) $varnothing$;
              node [above of=void] (y) $y$;
              node [left of=y] (x) $x$;
              node [right of=y] (z) $z$;
              node [above of=x] (xy) $xy$;
              node [above of=y] (xz) $xz$;
              node [above of=z] (yz) $yz$;
              node [above of=xz] (xyz) $xyz$;
              % Now draw the lines:
              draw [black, thick] % Here you draw a line between nodes, each line start and end in the shape
              (xz)
              edge (xyz)
              edge (x)
              edge (z)
              (y)
              edge (xy)
              edge (yz)
              edge (void)
              (void)
              -- (x)
              -- (xy)
              -- (xyz)
              -- (yz)
              -- (z)
              -- (void) ;

              draw[strip] % (nodename.center) gives a coordinate from the center of the node, and the line is continuous
              (void.center)
              -- (x.center)
              -- (xy.center)
              -- (xyz.center);

              endtikzpicture
              enddocument



              UPDATE



              To not shade the nodes the line is drawn in the background layer (as I observed in @marmot's answer, and then in the rest to not stay behind.):



              RESULT:
              enter image description here



              MWE:



              documentclassstandalone
              usepackagetikz
              usetikzlibrarybackgrounds
              usepackageamssymb
              begindocument
              begintikzpicture[
              %Environment config
              node distance=2cm,
              %Environment Styles
              strip/.style=
              draw=gray,
              rounded corners=1mm,
              line width=1.3cm,
              opacity=0.5, line cap=round
              ,
              every node/.style=
              draw=black,
              circle,
              minimum size=1cm,
              fill=orange,
              fill opacity=0.8,
              text opacity=1

              ]
              % First, locate each of the nodes and name them
              node (void) at (0,0) $varnothing$;
              node [above of=void] (y) $y$;
              node [left of=y] (x) $x$;
              node [right of=y] (z) $z$;
              node [above of=x] (xy) $xy$;
              node [above of=y] (xz) $xz$;
              node [above of=z] (yz) $yz$;
              node [above of=xz] (xyz) $xyz$;
              % Now draw the lines:
              draw [black, thick] % Here you draw a line between nodes, each line start and end in the shape
              (xz)
              edge (xyz)
              edge (x)
              edge (z)
              (y)
              edge (xy)
              edge (yz)
              edge (void)
              (void)
              -- (x)
              -- (xy)
              -- (xyz)
              -- (yz)
              -- (z)
              -- (void) ;
              beginscope[on background layer]
              draw[strip] % (nodename.center) gives a coordinate from the center of the node, and the line is continuous
              (void.center)
              -- (x.center)
              -- (xy.center)
              -- (xyz.center);
              endscope
              endtikzpicture
              enddocument





              share|improve this answer


















              • 1




                Done, and nice 3d marmot...
                – J Leon V.
                Aug 10 at 2:56












              up vote
              5
              down vote










              up vote
              5
              down vote









              The error you make is that you draw lines between nodes instead of coordinates.



              RESULT:



              enter image description here



              MWE:



              documentclassstandalone
              usepackagetikz
              usetikzlibrarybackgrounds
              usepackageamssymb
              begindocument
              begintikzpicture[
              %Environment config
              node distance=2cm,
              %Environment Styles
              strip/.style=
              draw=gray,
              rounded corners=1mm,
              line width=1.3cm,
              opacity=0.5, line cap=round
              ,
              every node/.style=
              draw=black,
              circle,
              minimum size=1cm,
              fill=orange,
              fill opacity=0.8,
              text opacity=1

              ]
              % First, locate each of the nodes and name them
              node (void) at (0,0) $varnothing$;
              node [above of=void] (y) $y$;
              node [left of=y] (x) $x$;
              node [right of=y] (z) $z$;
              node [above of=x] (xy) $xy$;
              node [above of=y] (xz) $xz$;
              node [above of=z] (yz) $yz$;
              node [above of=xz] (xyz) $xyz$;
              % Now draw the lines:
              draw [black, thick] % Here you draw a line between nodes, each line start and end in the shape
              (xz)
              edge (xyz)
              edge (x)
              edge (z)
              (y)
              edge (xy)
              edge (yz)
              edge (void)
              (void)
              -- (x)
              -- (xy)
              -- (xyz)
              -- (yz)
              -- (z)
              -- (void) ;

              draw[strip] % (nodename.center) gives a coordinate from the center of the node, and the line is continuous
              (void.center)
              -- (x.center)
              -- (xy.center)
              -- (xyz.center);

              endtikzpicture
              enddocument



              UPDATE



              To not shade the nodes the line is drawn in the background layer (as I observed in @marmot's answer, and then in the rest to not stay behind.):



              RESULT:
              enter image description here



              MWE:



              documentclassstandalone
              usepackagetikz
              usetikzlibrarybackgrounds
              usepackageamssymb
              begindocument
              begintikzpicture[
              %Environment config
              node distance=2cm,
              %Environment Styles
              strip/.style=
              draw=gray,
              rounded corners=1mm,
              line width=1.3cm,
              opacity=0.5, line cap=round
              ,
              every node/.style=
              draw=black,
              circle,
              minimum size=1cm,
              fill=orange,
              fill opacity=0.8,
              text opacity=1

              ]
              % First, locate each of the nodes and name them
              node (void) at (0,0) $varnothing$;
              node [above of=void] (y) $y$;
              node [left of=y] (x) $x$;
              node [right of=y] (z) $z$;
              node [above of=x] (xy) $xy$;
              node [above of=y] (xz) $xz$;
              node [above of=z] (yz) $yz$;
              node [above of=xz] (xyz) $xyz$;
              % Now draw the lines:
              draw [black, thick] % Here you draw a line between nodes, each line start and end in the shape
              (xz)
              edge (xyz)
              edge (x)
              edge (z)
              (y)
              edge (xy)
              edge (yz)
              edge (void)
              (void)
              -- (x)
              -- (xy)
              -- (xyz)
              -- (yz)
              -- (z)
              -- (void) ;
              beginscope[on background layer]
              draw[strip] % (nodename.center) gives a coordinate from the center of the node, and the line is continuous
              (void.center)
              -- (x.center)
              -- (xy.center)
              -- (xyz.center);
              endscope
              endtikzpicture
              enddocument





              share|improve this answer














              The error you make is that you draw lines between nodes instead of coordinates.



              RESULT:



              enter image description here



              MWE:



              documentclassstandalone
              usepackagetikz
              usetikzlibrarybackgrounds
              usepackageamssymb
              begindocument
              begintikzpicture[
              %Environment config
              node distance=2cm,
              %Environment Styles
              strip/.style=
              draw=gray,
              rounded corners=1mm,
              line width=1.3cm,
              opacity=0.5, line cap=round
              ,
              every node/.style=
              draw=black,
              circle,
              minimum size=1cm,
              fill=orange,
              fill opacity=0.8,
              text opacity=1

              ]
              % First, locate each of the nodes and name them
              node (void) at (0,0) $varnothing$;
              node [above of=void] (y) $y$;
              node [left of=y] (x) $x$;
              node [right of=y] (z) $z$;
              node [above of=x] (xy) $xy$;
              node [above of=y] (xz) $xz$;
              node [above of=z] (yz) $yz$;
              node [above of=xz] (xyz) $xyz$;
              % Now draw the lines:
              draw [black, thick] % Here you draw a line between nodes, each line start and end in the shape
              (xz)
              edge (xyz)
              edge (x)
              edge (z)
              (y)
              edge (xy)
              edge (yz)
              edge (void)
              (void)
              -- (x)
              -- (xy)
              -- (xyz)
              -- (yz)
              -- (z)
              -- (void) ;

              draw[strip] % (nodename.center) gives a coordinate from the center of the node, and the line is continuous
              (void.center)
              -- (x.center)
              -- (xy.center)
              -- (xyz.center);

              endtikzpicture
              enddocument



              UPDATE



              To not shade the nodes the line is drawn in the background layer (as I observed in @marmot's answer, and then in the rest to not stay behind.):



              RESULT:
              enter image description here



              MWE:



              documentclassstandalone
              usepackagetikz
              usetikzlibrarybackgrounds
              usepackageamssymb
              begindocument
              begintikzpicture[
              %Environment config
              node distance=2cm,
              %Environment Styles
              strip/.style=
              draw=gray,
              rounded corners=1mm,
              line width=1.3cm,
              opacity=0.5, line cap=round
              ,
              every node/.style=
              draw=black,
              circle,
              minimum size=1cm,
              fill=orange,
              fill opacity=0.8,
              text opacity=1

              ]
              % First, locate each of the nodes and name them
              node (void) at (0,0) $varnothing$;
              node [above of=void] (y) $y$;
              node [left of=y] (x) $x$;
              node [right of=y] (z) $z$;
              node [above of=x] (xy) $xy$;
              node [above of=y] (xz) $xz$;
              node [above of=z] (yz) $yz$;
              node [above of=xz] (xyz) $xyz$;
              % Now draw the lines:
              draw [black, thick] % Here you draw a line between nodes, each line start and end in the shape
              (xz)
              edge (xyz)
              edge (x)
              edge (z)
              (y)
              edge (xy)
              edge (yz)
              edge (void)
              (void)
              -- (x)
              -- (xy)
              -- (xyz)
              -- (yz)
              -- (z)
              -- (void) ;
              beginscope[on background layer]
              draw[strip] % (nodename.center) gives a coordinate from the center of the node, and the line is continuous
              (void.center)
              -- (x.center)
              -- (xy.center)
              -- (xyz.center);
              endscope
              endtikzpicture
              enddocument






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Aug 10 at 2:55

























              answered Aug 9 at 22:03









              J Leon V.

              5,122424




              5,122424







              • 1




                Done, and nice 3d marmot...
                – J Leon V.
                Aug 10 at 2:56












              • 1




                Done, and nice 3d marmot...
                – J Leon V.
                Aug 10 at 2:56







              1




              1




              Done, and nice 3d marmot...
              – J Leon V.
              Aug 10 at 2:56




              Done, and nice 3d marmot...
              – J Leon V.
              Aug 10 at 2:56










              up vote
              4
              down vote













              Just for comparison, here is a Metapost alternative. Compile with lualatex for the luamplib support.



              enter image description here



              documentclass[border=5mm]standalone
              usepackageluatex85
              usepackageluamplib
              begindocument
              mplibtextextlabelenable
              beginmplibcode
              beginfig(1);

              path s, ss;
              s = unitsquare scaled 70.71 rotated 45;
              ss = s shifted 50 up;

              draw point 0 of s -- point 3 of s -- point 3 of ss -- point 2 of ss
              withpen pencircle scaled 32
              withcolor 3/4 white;

              draw s; draw ss;
              for i=0 upto 3:
              draw point i of s -- point i of ss;
              endfor

              vardef node(expr t, p) =
              fill fullcircle scaled 24 shifted p withcolor red + 1/2 green;
              draw fullcircle scaled 24 shifted p;
              label(t, p);
              enddef;

              node("$emptyset$", point 0 of s);
              node("$x$", point 3 of s);
              node("$z$", point 1 of s);
              node("$xz$", point 2 of s);
              node("$y$", point 0 of ss);
              node("$xy$", point 3 of ss);
              node("$yz$", point 1 of ss);
              node("$xyz$", point 2 of ss);

              endfig;
              endmplibcode
              enddocument


              Note that this one is quite hard to adapt to plain old mpost; the mplibtextextlabelenable setting makes it much simpler to create
              the node function, as the strings get compiled as TeX automatically.






              share|improve this answer


























                up vote
                4
                down vote













                Just for comparison, here is a Metapost alternative. Compile with lualatex for the luamplib support.



                enter image description here



                documentclass[border=5mm]standalone
                usepackageluatex85
                usepackageluamplib
                begindocument
                mplibtextextlabelenable
                beginmplibcode
                beginfig(1);

                path s, ss;
                s = unitsquare scaled 70.71 rotated 45;
                ss = s shifted 50 up;

                draw point 0 of s -- point 3 of s -- point 3 of ss -- point 2 of ss
                withpen pencircle scaled 32
                withcolor 3/4 white;

                draw s; draw ss;
                for i=0 upto 3:
                draw point i of s -- point i of ss;
                endfor

                vardef node(expr t, p) =
                fill fullcircle scaled 24 shifted p withcolor red + 1/2 green;
                draw fullcircle scaled 24 shifted p;
                label(t, p);
                enddef;

                node("$emptyset$", point 0 of s);
                node("$x$", point 3 of s);
                node("$z$", point 1 of s);
                node("$xz$", point 2 of s);
                node("$y$", point 0 of ss);
                node("$xy$", point 3 of ss);
                node("$yz$", point 1 of ss);
                node("$xyz$", point 2 of ss);

                endfig;
                endmplibcode
                enddocument


                Note that this one is quite hard to adapt to plain old mpost; the mplibtextextlabelenable setting makes it much simpler to create
                the node function, as the strings get compiled as TeX automatically.






                share|improve this answer
























                  up vote
                  4
                  down vote










                  up vote
                  4
                  down vote









                  Just for comparison, here is a Metapost alternative. Compile with lualatex for the luamplib support.



                  enter image description here



                  documentclass[border=5mm]standalone
                  usepackageluatex85
                  usepackageluamplib
                  begindocument
                  mplibtextextlabelenable
                  beginmplibcode
                  beginfig(1);

                  path s, ss;
                  s = unitsquare scaled 70.71 rotated 45;
                  ss = s shifted 50 up;

                  draw point 0 of s -- point 3 of s -- point 3 of ss -- point 2 of ss
                  withpen pencircle scaled 32
                  withcolor 3/4 white;

                  draw s; draw ss;
                  for i=0 upto 3:
                  draw point i of s -- point i of ss;
                  endfor

                  vardef node(expr t, p) =
                  fill fullcircle scaled 24 shifted p withcolor red + 1/2 green;
                  draw fullcircle scaled 24 shifted p;
                  label(t, p);
                  enddef;

                  node("$emptyset$", point 0 of s);
                  node("$x$", point 3 of s);
                  node("$z$", point 1 of s);
                  node("$xz$", point 2 of s);
                  node("$y$", point 0 of ss);
                  node("$xy$", point 3 of ss);
                  node("$yz$", point 1 of ss);
                  node("$xyz$", point 2 of ss);

                  endfig;
                  endmplibcode
                  enddocument


                  Note that this one is quite hard to adapt to plain old mpost; the mplibtextextlabelenable setting makes it much simpler to create
                  the node function, as the strings get compiled as TeX automatically.






                  share|improve this answer














                  Just for comparison, here is a Metapost alternative. Compile with lualatex for the luamplib support.



                  enter image description here



                  documentclass[border=5mm]standalone
                  usepackageluatex85
                  usepackageluamplib
                  begindocument
                  mplibtextextlabelenable
                  beginmplibcode
                  beginfig(1);

                  path s, ss;
                  s = unitsquare scaled 70.71 rotated 45;
                  ss = s shifted 50 up;

                  draw point 0 of s -- point 3 of s -- point 3 of ss -- point 2 of ss
                  withpen pencircle scaled 32
                  withcolor 3/4 white;

                  draw s; draw ss;
                  for i=0 upto 3:
                  draw point i of s -- point i of ss;
                  endfor

                  vardef node(expr t, p) =
                  fill fullcircle scaled 24 shifted p withcolor red + 1/2 green;
                  draw fullcircle scaled 24 shifted p;
                  label(t, p);
                  enddef;

                  node("$emptyset$", point 0 of s);
                  node("$x$", point 3 of s);
                  node("$z$", point 1 of s);
                  node("$xz$", point 2 of s);
                  node("$y$", point 0 of ss);
                  node("$xy$", point 3 of ss);
                  node("$yz$", point 1 of ss);
                  node("$xyz$", point 2 of ss);

                  endfig;
                  endmplibcode
                  enddocument


                  Note that this one is quite hard to adapt to plain old mpost; the mplibtextextlabelenable setting makes it much simpler to create
                  the node function, as the strings get compiled as TeX automatically.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Aug 9 at 22:29

























                  answered Aug 9 at 22:24









                  Thruston

                  24.4k23987




                  24.4k23987






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f445387%2fhow-do-i-draw-a-path-of-grey-background-on-the-nodes-of-tikz%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      這個網誌中的熱門文章

                      How to combine Bézier curves to a surface?

                      Carbon dioxide

                      Why am i infinitely getting the same tweet with the Twitter Search API?