Placing anchor before and after text in multipart rectangle












8















In the following graph, i would like the arrows to be originated inside the box and not in the border, possibly aligned and next to the text (for example, right after the word "Pointer:".



image



Here is the code i used:



usetikzlibrary{shapes.multipart,arrows}
newcommand{npd}{nodepart{two}}
newcommand{npt}{nodepart{three}}
newcommand{npq}{nodepart{four}}
newcommand{npc}{nodepart{five}}

tikzstyle{fnode}=[rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners]

begin{tikzpicture}
node[fnode] (r1) at (0,0) {Pointer: npd Key npt Text text npq Pointers npc text};
draw [*->] (r1.one east) to (-2,2);
draw [*->] (r1.four east) to (3,0);
draw [*->] (r1.four west) to (-3,0);
end{tikzpicture}


I would also like (if possible) to use a syntax similar to the anchor one.
There are no predefined anchors to do this in the manual.
What is the easiest way to achive this result?










share|improve this question





























    8















    In the following graph, i would like the arrows to be originated inside the box and not in the border, possibly aligned and next to the text (for example, right after the word "Pointer:".



    image



    Here is the code i used:



    usetikzlibrary{shapes.multipart,arrows}
    newcommand{npd}{nodepart{two}}
    newcommand{npt}{nodepart{three}}
    newcommand{npq}{nodepart{four}}
    newcommand{npc}{nodepart{five}}

    tikzstyle{fnode}=[rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners]

    begin{tikzpicture}
    node[fnode] (r1) at (0,0) {Pointer: npd Key npt Text text npq Pointers npc text};
    draw [*->] (r1.one east) to (-2,2);
    draw [*->] (r1.four east) to (3,0);
    draw [*->] (r1.four west) to (-3,0);
    end{tikzpicture}


    I would also like (if possible) to use a syntax similar to the anchor one.
    There are no predefined anchors to do this in the manual.
    What is the easiest way to achive this result?










    share|improve this question



























      8












      8








      8








      In the following graph, i would like the arrows to be originated inside the box and not in the border, possibly aligned and next to the text (for example, right after the word "Pointer:".



      image



      Here is the code i used:



      usetikzlibrary{shapes.multipart,arrows}
      newcommand{npd}{nodepart{two}}
      newcommand{npt}{nodepart{three}}
      newcommand{npq}{nodepart{four}}
      newcommand{npc}{nodepart{five}}

      tikzstyle{fnode}=[rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners]

      begin{tikzpicture}
      node[fnode] (r1) at (0,0) {Pointer: npd Key npt Text text npq Pointers npc text};
      draw [*->] (r1.one east) to (-2,2);
      draw [*->] (r1.four east) to (3,0);
      draw [*->] (r1.four west) to (-3,0);
      end{tikzpicture}


      I would also like (if possible) to use a syntax similar to the anchor one.
      There are no predefined anchors to do this in the manual.
      What is the easiest way to achive this result?










      share|improve this question
















      In the following graph, i would like the arrows to be originated inside the box and not in the border, possibly aligned and next to the text (for example, right after the word "Pointer:".



      image



      Here is the code i used:



      usetikzlibrary{shapes.multipart,arrows}
      newcommand{npd}{nodepart{two}}
      newcommand{npt}{nodepart{three}}
      newcommand{npq}{nodepart{four}}
      newcommand{npc}{nodepart{five}}

      tikzstyle{fnode}=[rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners]

      begin{tikzpicture}
      node[fnode] (r1) at (0,0) {Pointer: npd Key npt Text text npq Pointers npc text};
      draw [*->] (r1.one east) to (-2,2);
      draw [*->] (r1.four east) to (3,0);
      draw [*->] (r1.four west) to (-3,0);
      end{tikzpicture}


      I would also like (if possible) to use a syntax similar to the anchor one.
      There are no predefined anchors to do this in the manual.
      What is the easiest way to achive this result?







      tikz-pgf node-connections






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 10 at 23:08









      Glorfindel

      219129




      219129










      asked Oct 30 '12 at 22:28









      antosecretantosecret

      366311




      366311






















          1 Answer
          1






          active

          oldest

          votes


















          4














          Here is a possible solution.



          You should specify an anchormark on the left or on the right of your pointer by means of anchormark; its definition is:



          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }


          Each anchormark should be uniquely identified (the mandatory argument of the command) and could be shifted (the first argument, optional, of the command) or the circle could be scaled (the third argument, optional again, of the command).



          Notice that with this kind of approach you should logically divide the moment in which you deploy the fnode and the markers and the moment in which you create the connections. You should also compile twice.



          The complete example:



          documentclass{article}
          usepackage{xparse}
          usepackage{tikz}

          usetikzlibrary{shapes.multipart,arrows}
          newcommand{npd}{nodepart{two}}
          newcommand{npt}{nodepart{three}}
          newcommand{npq}{nodepart{four}}
          newcommand{npc}{nodepart{five}}

          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }

          tikzset{fnode/.style={rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners}}

          tikzset{label style/.style={draw, rounded corners}}

          begin{document}
          % node deployment
          begin{tikzpicture}
          node[fnode] (r1) at (0,0) {Pointer:anchormark{first pointer}[0.075] npd Key npt Text text npq anchormark[-0.15cm]{pointer left}Pointers anchormark{pointer right}npc text};
          end{tikzpicture}
          % connection deployment
          begin{tikzpicture}[remember picture,overlay,-stealth]
          draw (first pointer.center) to (2,2.75) node[right,label style]{label};
          draw (pointer right.center) to (2,1) node[right,label style]{label};
          draw (pointer left.center) to (-5,1)node[left,label style]{label};
          end{tikzpicture}

          end{document}


          The result:



          enter image description here





          This advanced example shows how to deal with more modules. As said in the comment, by adding a [remember picture] to the tikzpicture where the nodes are deployed, in the connection phase it is possible to access their anchors. Another feature of the example is the use of the calc library to avoid absolute positioning in the connection phase.



          documentclass{article}
          usepackage{xparse}
          usepackage{tikz}

          usetikzlibrary{shapes.multipart,arrows,calc}
          newcommand{npd}{nodepart{two}}
          newcommand{npt}{nodepart{three}}
          newcommand{npq}{nodepart{four}}
          newcommand{npc}{nodepart{five}}

          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }

          tikzset{fnode/.style={rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners}}

          tikzset{label style/.style={draw, rounded corners}}

          begin{document}
          begin{tikzpicture}[remember picture]
          node[fnode] (r1) at (0,0) {Pointer:anchormark{first pointer}[0.075] npd Key npt Text text npq anchormark[-0.15cm]{pointer left}Pointers anchormark{pointer right}npc text};
          node[fnode] (r2) at (5,0) {Pointer:anchormark{second pointer}[0.075] npd Key npt Text text npq anchormark[-0.05cm]{second pointer left}Second pointernpc text};
          end{tikzpicture}
          begin{tikzpicture}[remember picture,overlay,-stealth]
          draw (first pointer.center) to ($(first pointer.center)+(2,1)$) node[right,label style] (mylabel){label};
          draw (pointer right.center) to (second pointer left);
          draw (pointer left.center) to ($(pointer left.center)+(-1,1)$)node[left,label style]{label};
          draw (second pointer.center) |-(mylabel);
          % just to connect r1 and r2
          draw(r1.south)|- ($(r1.south)!0.5!(r2.south)-(0,1)$)-|(r2.south);
          end{tikzpicture}
          end{document}


          The result:



          enter image description here






          share|improve this answer


























          • Thanks for the answer! It is a bit complicated (expecially for the separation between placing nodes and arrows, and the double compilation), but it does exactly what i wanted! Do you think it is possible to use this approach to define a custom type of node with the anchors builted in? This way I could use (for example) r1.FirstPointer without the double recompilation... I will study the manual and let you know if I manage to do it.

            – antosecret
            Oct 31 '12 at 12:48











          • Also, adding [remember picture] after the begin{tikzpicture} of the node definitions allows me to connect two such nodes.

            – antosecret
            Oct 31 '12 at 13:22











          • @antosecret: answering your first comment. Well, I think this approach isn't so complicated.. at least is less complicated than create a custom node with anchors immediately there: how to deal with the text then? Suppose to change Pointers with Second pointer: with this approach nothing changes, at maximum you fix the distance with the optional parameter, but if you have predefined anchors your text will go over the the circle. Anyway, I'll edit my answer with another example (also to show with two fnodes how to connect them).

            – Claudio Fiandrino
            Nov 2 '12 at 17:24











          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          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%2f79781%2fplacing-anchor-before-and-after-text-in-multipart-rectangle%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          Here is a possible solution.



          You should specify an anchormark on the left or on the right of your pointer by means of anchormark; its definition is:



          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }


          Each anchormark should be uniquely identified (the mandatory argument of the command) and could be shifted (the first argument, optional, of the command) or the circle could be scaled (the third argument, optional again, of the command).



          Notice that with this kind of approach you should logically divide the moment in which you deploy the fnode and the markers and the moment in which you create the connections. You should also compile twice.



          The complete example:



          documentclass{article}
          usepackage{xparse}
          usepackage{tikz}

          usetikzlibrary{shapes.multipart,arrows}
          newcommand{npd}{nodepart{two}}
          newcommand{npt}{nodepart{three}}
          newcommand{npq}{nodepart{four}}
          newcommand{npc}{nodepart{five}}

          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }

          tikzset{fnode/.style={rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners}}

          tikzset{label style/.style={draw, rounded corners}}

          begin{document}
          % node deployment
          begin{tikzpicture}
          node[fnode] (r1) at (0,0) {Pointer:anchormark{first pointer}[0.075] npd Key npt Text text npq anchormark[-0.15cm]{pointer left}Pointers anchormark{pointer right}npc text};
          end{tikzpicture}
          % connection deployment
          begin{tikzpicture}[remember picture,overlay,-stealth]
          draw (first pointer.center) to (2,2.75) node[right,label style]{label};
          draw (pointer right.center) to (2,1) node[right,label style]{label};
          draw (pointer left.center) to (-5,1)node[left,label style]{label};
          end{tikzpicture}

          end{document}


          The result:



          enter image description here





          This advanced example shows how to deal with more modules. As said in the comment, by adding a [remember picture] to the tikzpicture where the nodes are deployed, in the connection phase it is possible to access their anchors. Another feature of the example is the use of the calc library to avoid absolute positioning in the connection phase.



          documentclass{article}
          usepackage{xparse}
          usepackage{tikz}

          usetikzlibrary{shapes.multipart,arrows,calc}
          newcommand{npd}{nodepart{two}}
          newcommand{npt}{nodepart{three}}
          newcommand{npq}{nodepart{four}}
          newcommand{npc}{nodepart{five}}

          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }

          tikzset{fnode/.style={rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners}}

          tikzset{label style/.style={draw, rounded corners}}

          begin{document}
          begin{tikzpicture}[remember picture]
          node[fnode] (r1) at (0,0) {Pointer:anchormark{first pointer}[0.075] npd Key npt Text text npq anchormark[-0.15cm]{pointer left}Pointers anchormark{pointer right}npc text};
          node[fnode] (r2) at (5,0) {Pointer:anchormark{second pointer}[0.075] npd Key npt Text text npq anchormark[-0.05cm]{second pointer left}Second pointernpc text};
          end{tikzpicture}
          begin{tikzpicture}[remember picture,overlay,-stealth]
          draw (first pointer.center) to ($(first pointer.center)+(2,1)$) node[right,label style] (mylabel){label};
          draw (pointer right.center) to (second pointer left);
          draw (pointer left.center) to ($(pointer left.center)+(-1,1)$)node[left,label style]{label};
          draw (second pointer.center) |-(mylabel);
          % just to connect r1 and r2
          draw(r1.south)|- ($(r1.south)!0.5!(r2.south)-(0,1)$)-|(r2.south);
          end{tikzpicture}
          end{document}


          The result:



          enter image description here






          share|improve this answer


























          • Thanks for the answer! It is a bit complicated (expecially for the separation between placing nodes and arrows, and the double compilation), but it does exactly what i wanted! Do you think it is possible to use this approach to define a custom type of node with the anchors builted in? This way I could use (for example) r1.FirstPointer without the double recompilation... I will study the manual and let you know if I manage to do it.

            – antosecret
            Oct 31 '12 at 12:48











          • Also, adding [remember picture] after the begin{tikzpicture} of the node definitions allows me to connect two such nodes.

            – antosecret
            Oct 31 '12 at 13:22











          • @antosecret: answering your first comment. Well, I think this approach isn't so complicated.. at least is less complicated than create a custom node with anchors immediately there: how to deal with the text then? Suppose to change Pointers with Second pointer: with this approach nothing changes, at maximum you fix the distance with the optional parameter, but if you have predefined anchors your text will go over the the circle. Anyway, I'll edit my answer with another example (also to show with two fnodes how to connect them).

            – Claudio Fiandrino
            Nov 2 '12 at 17:24
















          4














          Here is a possible solution.



          You should specify an anchormark on the left or on the right of your pointer by means of anchormark; its definition is:



          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }


          Each anchormark should be uniquely identified (the mandatory argument of the command) and could be shifted (the first argument, optional, of the command) or the circle could be scaled (the third argument, optional again, of the command).



          Notice that with this kind of approach you should logically divide the moment in which you deploy the fnode and the markers and the moment in which you create the connections. You should also compile twice.



          The complete example:



          documentclass{article}
          usepackage{xparse}
          usepackage{tikz}

          usetikzlibrary{shapes.multipart,arrows}
          newcommand{npd}{nodepart{two}}
          newcommand{npt}{nodepart{three}}
          newcommand{npq}{nodepart{four}}
          newcommand{npc}{nodepart{five}}

          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }

          tikzset{fnode/.style={rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners}}

          tikzset{label style/.style={draw, rounded corners}}

          begin{document}
          % node deployment
          begin{tikzpicture}
          node[fnode] (r1) at (0,0) {Pointer:anchormark{first pointer}[0.075] npd Key npt Text text npq anchormark[-0.15cm]{pointer left}Pointers anchormark{pointer right}npc text};
          end{tikzpicture}
          % connection deployment
          begin{tikzpicture}[remember picture,overlay,-stealth]
          draw (first pointer.center) to (2,2.75) node[right,label style]{label};
          draw (pointer right.center) to (2,1) node[right,label style]{label};
          draw (pointer left.center) to (-5,1)node[left,label style]{label};
          end{tikzpicture}

          end{document}


          The result:



          enter image description here





          This advanced example shows how to deal with more modules. As said in the comment, by adding a [remember picture] to the tikzpicture where the nodes are deployed, in the connection phase it is possible to access their anchors. Another feature of the example is the use of the calc library to avoid absolute positioning in the connection phase.



          documentclass{article}
          usepackage{xparse}
          usepackage{tikz}

          usetikzlibrary{shapes.multipart,arrows,calc}
          newcommand{npd}{nodepart{two}}
          newcommand{npt}{nodepart{three}}
          newcommand{npq}{nodepart{four}}
          newcommand{npc}{nodepart{five}}

          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }

          tikzset{fnode/.style={rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners}}

          tikzset{label style/.style={draw, rounded corners}}

          begin{document}
          begin{tikzpicture}[remember picture]
          node[fnode] (r1) at (0,0) {Pointer:anchormark{first pointer}[0.075] npd Key npt Text text npq anchormark[-0.15cm]{pointer left}Pointers anchormark{pointer right}npc text};
          node[fnode] (r2) at (5,0) {Pointer:anchormark{second pointer}[0.075] npd Key npt Text text npq anchormark[-0.05cm]{second pointer left}Second pointernpc text};
          end{tikzpicture}
          begin{tikzpicture}[remember picture,overlay,-stealth]
          draw (first pointer.center) to ($(first pointer.center)+(2,1)$) node[right,label style] (mylabel){label};
          draw (pointer right.center) to (second pointer left);
          draw (pointer left.center) to ($(pointer left.center)+(-1,1)$)node[left,label style]{label};
          draw (second pointer.center) |-(mylabel);
          % just to connect r1 and r2
          draw(r1.south)|- ($(r1.south)!0.5!(r2.south)-(0,1)$)-|(r2.south);
          end{tikzpicture}
          end{document}


          The result:



          enter image description here






          share|improve this answer


























          • Thanks for the answer! It is a bit complicated (expecially for the separation between placing nodes and arrows, and the double compilation), but it does exactly what i wanted! Do you think it is possible to use this approach to define a custom type of node with the anchors builted in? This way I could use (for example) r1.FirstPointer without the double recompilation... I will study the manual and let you know if I manage to do it.

            – antosecret
            Oct 31 '12 at 12:48











          • Also, adding [remember picture] after the begin{tikzpicture} of the node definitions allows me to connect two such nodes.

            – antosecret
            Oct 31 '12 at 13:22











          • @antosecret: answering your first comment. Well, I think this approach isn't so complicated.. at least is less complicated than create a custom node with anchors immediately there: how to deal with the text then? Suppose to change Pointers with Second pointer: with this approach nothing changes, at maximum you fix the distance with the optional parameter, but if you have predefined anchors your text will go over the the circle. Anyway, I'll edit my answer with another example (also to show with two fnodes how to connect them).

            – Claudio Fiandrino
            Nov 2 '12 at 17:24














          4












          4








          4







          Here is a possible solution.



          You should specify an anchormark on the left or on the right of your pointer by means of anchormark; its definition is:



          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }


          Each anchormark should be uniquely identified (the mandatory argument of the command) and could be shifted (the first argument, optional, of the command) or the circle could be scaled (the third argument, optional again, of the command).



          Notice that with this kind of approach you should logically divide the moment in which you deploy the fnode and the markers and the moment in which you create the connections. You should also compile twice.



          The complete example:



          documentclass{article}
          usepackage{xparse}
          usepackage{tikz}

          usetikzlibrary{shapes.multipart,arrows}
          newcommand{npd}{nodepart{two}}
          newcommand{npt}{nodepart{three}}
          newcommand{npq}{nodepart{four}}
          newcommand{npc}{nodepart{five}}

          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }

          tikzset{fnode/.style={rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners}}

          tikzset{label style/.style={draw, rounded corners}}

          begin{document}
          % node deployment
          begin{tikzpicture}
          node[fnode] (r1) at (0,0) {Pointer:anchormark{first pointer}[0.075] npd Key npt Text text npq anchormark[-0.15cm]{pointer left}Pointers anchormark{pointer right}npc text};
          end{tikzpicture}
          % connection deployment
          begin{tikzpicture}[remember picture,overlay,-stealth]
          draw (first pointer.center) to (2,2.75) node[right,label style]{label};
          draw (pointer right.center) to (2,1) node[right,label style]{label};
          draw (pointer left.center) to (-5,1)node[left,label style]{label};
          end{tikzpicture}

          end{document}


          The result:



          enter image description here





          This advanced example shows how to deal with more modules. As said in the comment, by adding a [remember picture] to the tikzpicture where the nodes are deployed, in the connection phase it is possible to access their anchors. Another feature of the example is the use of the calc library to avoid absolute positioning in the connection phase.



          documentclass{article}
          usepackage{xparse}
          usepackage{tikz}

          usetikzlibrary{shapes.multipart,arrows,calc}
          newcommand{npd}{nodepart{two}}
          newcommand{npt}{nodepart{three}}
          newcommand{npq}{nodepart{four}}
          newcommand{npc}{nodepart{five}}

          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }

          tikzset{fnode/.style={rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners}}

          tikzset{label style/.style={draw, rounded corners}}

          begin{document}
          begin{tikzpicture}[remember picture]
          node[fnode] (r1) at (0,0) {Pointer:anchormark{first pointer}[0.075] npd Key npt Text text npq anchormark[-0.15cm]{pointer left}Pointers anchormark{pointer right}npc text};
          node[fnode] (r2) at (5,0) {Pointer:anchormark{second pointer}[0.075] npd Key npt Text text npq anchormark[-0.05cm]{second pointer left}Second pointernpc text};
          end{tikzpicture}
          begin{tikzpicture}[remember picture,overlay,-stealth]
          draw (first pointer.center) to ($(first pointer.center)+(2,1)$) node[right,label style] (mylabel){label};
          draw (pointer right.center) to (second pointer left);
          draw (pointer left.center) to ($(pointer left.center)+(-1,1)$)node[left,label style]{label};
          draw (second pointer.center) |-(mylabel);
          % just to connect r1 and r2
          draw(r1.south)|- ($(r1.south)!0.5!(r2.south)-(0,1)$)-|(r2.south);
          end{tikzpicture}
          end{document}


          The result:



          enter image description here






          share|improve this answer















          Here is a possible solution.



          You should specify an anchormark on the left or on the right of your pointer by means of anchormark; its definition is:



          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }


          Each anchormark should be uniquely identified (the mandatory argument of the command) and could be shifted (the first argument, optional, of the command) or the circle could be scaled (the third argument, optional again, of the command).



          Notice that with this kind of approach you should logically divide the moment in which you deploy the fnode and the markers and the moment in which you create the connections. You should also compile twice.



          The complete example:



          documentclass{article}
          usepackage{xparse}
          usepackage{tikz}

          usetikzlibrary{shapes.multipart,arrows}
          newcommand{npd}{nodepart{two}}
          newcommand{npt}{nodepart{three}}
          newcommand{npq}{nodepart{four}}
          newcommand{npc}{nodepart{five}}

          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }

          tikzset{fnode/.style={rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners}}

          tikzset{label style/.style={draw, rounded corners}}

          begin{document}
          % node deployment
          begin{tikzpicture}
          node[fnode] (r1) at (0,0) {Pointer:anchormark{first pointer}[0.075] npd Key npt Text text npq anchormark[-0.15cm]{pointer left}Pointers anchormark{pointer right}npc text};
          end{tikzpicture}
          % connection deployment
          begin{tikzpicture}[remember picture,overlay,-stealth]
          draw (first pointer.center) to (2,2.75) node[right,label style]{label};
          draw (pointer right.center) to (2,1) node[right,label style]{label};
          draw (pointer left.center) to (-5,1)node[left,label style]{label};
          end{tikzpicture}

          end{document}


          The result:



          enter image description here





          This advanced example shows how to deal with more modules. As said in the comment, by adding a [remember picture] to the tikzpicture where the nodes are deployed, in the connection phase it is possible to access their anchors. Another feature of the example is the use of the calc library to avoid absolute positioning in the connection phase.



          documentclass{article}
          usepackage{xparse}
          usepackage{tikz}

          usetikzlibrary{shapes.multipart,arrows,calc}
          newcommand{npd}{nodepart{two}}
          newcommand{npt}{nodepart{three}}
          newcommand{npq}{nodepart{four}}
          newcommand{npc}{nodepart{five}}

          NewDocumentCommand{anchormark}{O{0.15 cm} m O{0.05}}{%
          tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1] node[draw,fill=black,circle,scale=#3] (#2) {};
          }

          tikzset{fnode/.style={rectangle split, rectangle split part align={left,left,left,center,left}, rectangle split parts=5, draw, minimum width =2.75cm, rounded corners}}

          tikzset{label style/.style={draw, rounded corners}}

          begin{document}
          begin{tikzpicture}[remember picture]
          node[fnode] (r1) at (0,0) {Pointer:anchormark{first pointer}[0.075] npd Key npt Text text npq anchormark[-0.15cm]{pointer left}Pointers anchormark{pointer right}npc text};
          node[fnode] (r2) at (5,0) {Pointer:anchormark{second pointer}[0.075] npd Key npt Text text npq anchormark[-0.05cm]{second pointer left}Second pointernpc text};
          end{tikzpicture}
          begin{tikzpicture}[remember picture,overlay,-stealth]
          draw (first pointer.center) to ($(first pointer.center)+(2,1)$) node[right,label style] (mylabel){label};
          draw (pointer right.center) to (second pointer left);
          draw (pointer left.center) to ($(pointer left.center)+(-1,1)$)node[left,label style]{label};
          draw (second pointer.center) |-(mylabel);
          % just to connect r1 and r2
          draw(r1.south)|- ($(r1.south)!0.5!(r2.south)-(0,1)$)-|(r2.south);
          end{tikzpicture}
          end{document}


          The result:



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 2 '12 at 17:47

























          answered Oct 31 '12 at 10:14









          Claudio FiandrinoClaudio Fiandrino

          52.5k11153308




          52.5k11153308













          • Thanks for the answer! It is a bit complicated (expecially for the separation between placing nodes and arrows, and the double compilation), but it does exactly what i wanted! Do you think it is possible to use this approach to define a custom type of node with the anchors builted in? This way I could use (for example) r1.FirstPointer without the double recompilation... I will study the manual and let you know if I manage to do it.

            – antosecret
            Oct 31 '12 at 12:48











          • Also, adding [remember picture] after the begin{tikzpicture} of the node definitions allows me to connect two such nodes.

            – antosecret
            Oct 31 '12 at 13:22











          • @antosecret: answering your first comment. Well, I think this approach isn't so complicated.. at least is less complicated than create a custom node with anchors immediately there: how to deal with the text then? Suppose to change Pointers with Second pointer: with this approach nothing changes, at maximum you fix the distance with the optional parameter, but if you have predefined anchors your text will go over the the circle. Anyway, I'll edit my answer with another example (also to show with two fnodes how to connect them).

            – Claudio Fiandrino
            Nov 2 '12 at 17:24



















          • Thanks for the answer! It is a bit complicated (expecially for the separation between placing nodes and arrows, and the double compilation), but it does exactly what i wanted! Do you think it is possible to use this approach to define a custom type of node with the anchors builted in? This way I could use (for example) r1.FirstPointer without the double recompilation... I will study the manual and let you know if I manage to do it.

            – antosecret
            Oct 31 '12 at 12:48











          • Also, adding [remember picture] after the begin{tikzpicture} of the node definitions allows me to connect two such nodes.

            – antosecret
            Oct 31 '12 at 13:22











          • @antosecret: answering your first comment. Well, I think this approach isn't so complicated.. at least is less complicated than create a custom node with anchors immediately there: how to deal with the text then? Suppose to change Pointers with Second pointer: with this approach nothing changes, at maximum you fix the distance with the optional parameter, but if you have predefined anchors your text will go over the the circle. Anyway, I'll edit my answer with another example (also to show with two fnodes how to connect them).

            – Claudio Fiandrino
            Nov 2 '12 at 17:24

















          Thanks for the answer! It is a bit complicated (expecially for the separation between placing nodes and arrows, and the double compilation), but it does exactly what i wanted! Do you think it is possible to use this approach to define a custom type of node with the anchors builted in? This way I could use (for example) r1.FirstPointer without the double recompilation... I will study the manual and let you know if I manage to do it.

          – antosecret
          Oct 31 '12 at 12:48





          Thanks for the answer! It is a bit complicated (expecially for the separation between placing nodes and arrows, and the double compilation), but it does exactly what i wanted! Do you think it is possible to use this approach to define a custom type of node with the anchors builted in? This way I could use (for example) r1.FirstPointer without the double recompilation... I will study the manual and let you know if I manage to do it.

          – antosecret
          Oct 31 '12 at 12:48













          Also, adding [remember picture] after the begin{tikzpicture} of the node definitions allows me to connect two such nodes.

          – antosecret
          Oct 31 '12 at 13:22





          Also, adding [remember picture] after the begin{tikzpicture} of the node definitions allows me to connect two such nodes.

          – antosecret
          Oct 31 '12 at 13:22













          @antosecret: answering your first comment. Well, I think this approach isn't so complicated.. at least is less complicated than create a custom node with anchors immediately there: how to deal with the text then? Suppose to change Pointers with Second pointer: with this approach nothing changes, at maximum you fix the distance with the optional parameter, but if you have predefined anchors your text will go over the the circle. Anyway, I'll edit my answer with another example (also to show with two fnodes how to connect them).

          – Claudio Fiandrino
          Nov 2 '12 at 17:24





          @antosecret: answering your first comment. Well, I think this approach isn't so complicated.. at least is less complicated than create a custom node with anchors immediately there: how to deal with the text then? Suppose to change Pointers with Second pointer: with this approach nothing changes, at maximum you fix the distance with the optional parameter, but if you have predefined anchors your text will go over the the circle. Anyway, I'll edit my answer with another example (also to show with two fnodes how to connect them).

          – Claudio Fiandrino
          Nov 2 '12 at 17:24


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f79781%2fplacing-anchor-before-and-after-text-in-multipart-rectangle%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents