TikZ: What EXACTLY does the the |- notation for arrows do?












21















I am currently trying to work out how the perpendicular arrows work, and I fail.



Taking:



draw [arrow] (node1) -- node[sloped, above] {Caption} (node1 |- node2.north west);


I suspected that the notation meant:

Draw an arrow from node 1, to the north-west corner of node 2.

Make the arrow perpendicular to node 1.



Further attempts to draw arrows told me: No, that's not it. I have sadly failed to figure out what exactly the notation is supposed to be doing though! Is there any "explanation for dummies" that will lead me to understand what exactly



node1 |-


Is supposed to do?



Thanks!










share|improve this question





























    21















    I am currently trying to work out how the perpendicular arrows work, and I fail.



    Taking:



    draw [arrow] (node1) -- node[sloped, above] {Caption} (node1 |- node2.north west);


    I suspected that the notation meant:

    Draw an arrow from node 1, to the north-west corner of node 2.

    Make the arrow perpendicular to node 1.



    Further attempts to draw arrows told me: No, that's not it. I have sadly failed to figure out what exactly the notation is supposed to be doing though! Is there any "explanation for dummies" that will lead me to understand what exactly



    node1 |-


    Is supposed to do?



    Thanks!










    share|improve this question



























      21












      21








      21


      6






      I am currently trying to work out how the perpendicular arrows work, and I fail.



      Taking:



      draw [arrow] (node1) -- node[sloped, above] {Caption} (node1 |- node2.north west);


      I suspected that the notation meant:

      Draw an arrow from node 1, to the north-west corner of node 2.

      Make the arrow perpendicular to node 1.



      Further attempts to draw arrows told me: No, that's not it. I have sadly failed to figure out what exactly the notation is supposed to be doing though! Is there any "explanation for dummies" that will lead me to understand what exactly



      node1 |-


      Is supposed to do?



      Thanks!










      share|improve this question
















      I am currently trying to work out how the perpendicular arrows work, and I fail.



      Taking:



      draw [arrow] (node1) -- node[sloped, above] {Caption} (node1 |- node2.north west);


      I suspected that the notation meant:

      Draw an arrow from node 1, to the north-west corner of node 2.

      Make the arrow perpendicular to node 1.



      Further attempts to draw arrows told me: No, that's not it. I have sadly failed to figure out what exactly the notation is supposed to be doing though! Is there any "explanation for dummies" that will lead me to understand what exactly



      node1 |-


      Is supposed to do?



      Thanks!







      tikz-arrows






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '17 at 11:55







      Layna

















      asked Nov 15 '17 at 11:25









      LaynaLayna

      22717




      22717






















          2 Answers
          2






          active

          oldest

          votes


















          32














          There are two different places to use -|/|-:





          1. In a coordinate specification.



            This is what you have used, the general form is



            (a -| b)


            where a and b are named nodes or coordinates. This means the coordinate that is at the y-coordinate of a, and x-coordinate of b. Similarly, (a |- b) has the x-coordinate of a and y-coordinate of b.



            For example, the following code draws a horizontal arrow from a at (0,0) to (1,0).



            documentclass[border=10pt]{standalone}
            usepackage{tikz}
            begin{document}
            begin{tikzpicture}
            coordinate (a) at (0,0);
            coordinate (b) at (1,1);

            draw [->] (a) -- (a -| b);
            end{tikzpicture}
            end{document}


            You can also use this as



            coordinate (c) at (a -| b);


            and then draw [->] (a) -- (c); does the same as the above.




          2. As a path specification.



            This is used between two coordinates, in place of --.



            With draw [->] (a) -| (b); the arrow goes horizontally from a, then vertically up to b. (And with |- it would be vertically first, then horizontally.)



            output of code



            documentclass[border=10pt]{standalone}
            usepackage{tikz}
            begin{document}
            begin{tikzpicture}
            coordinate (a) at (0,0);
            coordinate (b) at (1,1);

            draw [->] (a) -| (b);
            end{tikzpicture}
            end{document}







          share|improve this answer



















          • 6





            The analogy between the coordinate and path specifications can be seen by noting that draw (a) -| (b); is equivalent to draw (a) -- (a-|b) -- (b) ;.

            – Andrey R
            Nov 15 '17 at 22:11



















          3














          If $a$ is a coordinate/node at position $(a_x, a_y)$ and $b$ is at $(b_x, b_y)$ then



          $ a |- b := (a_x, b_y) $

          $a -| b := (a_y, b_x) $


          They're just shorthands for combining the x/y coordinates of two points.



          EDIT: Huh, doesn't MathJAX work here? Then again, raw $ ... $ notation should be clear to TeX users, so I'll leave it as it is.






          share|improve this answer





















          • 1





            This is already mentioned in Torbjorn's answer no?

            – percusse
            Nov 15 '17 at 14:10






          • 2





            No, MathJax doesn't work. See tex.meta.stackexchange.com/questions/1272/… and linked questions.

            – Torbjørn T.
            Nov 15 '17 at 14:36











          • The second line should be a-|b := (b_x, a_y)...

            – Paul Gaborit
            7 mins ago











          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%2f401425%2ftikz-what-exactly-does-the-the-notation-for-arrows-do%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          32














          There are two different places to use -|/|-:





          1. In a coordinate specification.



            This is what you have used, the general form is



            (a -| b)


            where a and b are named nodes or coordinates. This means the coordinate that is at the y-coordinate of a, and x-coordinate of b. Similarly, (a |- b) has the x-coordinate of a and y-coordinate of b.



            For example, the following code draws a horizontal arrow from a at (0,0) to (1,0).



            documentclass[border=10pt]{standalone}
            usepackage{tikz}
            begin{document}
            begin{tikzpicture}
            coordinate (a) at (0,0);
            coordinate (b) at (1,1);

            draw [->] (a) -- (a -| b);
            end{tikzpicture}
            end{document}


            You can also use this as



            coordinate (c) at (a -| b);


            and then draw [->] (a) -- (c); does the same as the above.




          2. As a path specification.



            This is used between two coordinates, in place of --.



            With draw [->] (a) -| (b); the arrow goes horizontally from a, then vertically up to b. (And with |- it would be vertically first, then horizontally.)



            output of code



            documentclass[border=10pt]{standalone}
            usepackage{tikz}
            begin{document}
            begin{tikzpicture}
            coordinate (a) at (0,0);
            coordinate (b) at (1,1);

            draw [->] (a) -| (b);
            end{tikzpicture}
            end{document}







          share|improve this answer



















          • 6





            The analogy between the coordinate and path specifications can be seen by noting that draw (a) -| (b); is equivalent to draw (a) -- (a-|b) -- (b) ;.

            – Andrey R
            Nov 15 '17 at 22:11
















          32














          There are two different places to use -|/|-:





          1. In a coordinate specification.



            This is what you have used, the general form is



            (a -| b)


            where a and b are named nodes or coordinates. This means the coordinate that is at the y-coordinate of a, and x-coordinate of b. Similarly, (a |- b) has the x-coordinate of a and y-coordinate of b.



            For example, the following code draws a horizontal arrow from a at (0,0) to (1,0).



            documentclass[border=10pt]{standalone}
            usepackage{tikz}
            begin{document}
            begin{tikzpicture}
            coordinate (a) at (0,0);
            coordinate (b) at (1,1);

            draw [->] (a) -- (a -| b);
            end{tikzpicture}
            end{document}


            You can also use this as



            coordinate (c) at (a -| b);


            and then draw [->] (a) -- (c); does the same as the above.




          2. As a path specification.



            This is used between two coordinates, in place of --.



            With draw [->] (a) -| (b); the arrow goes horizontally from a, then vertically up to b. (And with |- it would be vertically first, then horizontally.)



            output of code



            documentclass[border=10pt]{standalone}
            usepackage{tikz}
            begin{document}
            begin{tikzpicture}
            coordinate (a) at (0,0);
            coordinate (b) at (1,1);

            draw [->] (a) -| (b);
            end{tikzpicture}
            end{document}







          share|improve this answer



















          • 6





            The analogy between the coordinate and path specifications can be seen by noting that draw (a) -| (b); is equivalent to draw (a) -- (a-|b) -- (b) ;.

            – Andrey R
            Nov 15 '17 at 22:11














          32












          32








          32







          There are two different places to use -|/|-:





          1. In a coordinate specification.



            This is what you have used, the general form is



            (a -| b)


            where a and b are named nodes or coordinates. This means the coordinate that is at the y-coordinate of a, and x-coordinate of b. Similarly, (a |- b) has the x-coordinate of a and y-coordinate of b.



            For example, the following code draws a horizontal arrow from a at (0,0) to (1,0).



            documentclass[border=10pt]{standalone}
            usepackage{tikz}
            begin{document}
            begin{tikzpicture}
            coordinate (a) at (0,0);
            coordinate (b) at (1,1);

            draw [->] (a) -- (a -| b);
            end{tikzpicture}
            end{document}


            You can also use this as



            coordinate (c) at (a -| b);


            and then draw [->] (a) -- (c); does the same as the above.




          2. As a path specification.



            This is used between two coordinates, in place of --.



            With draw [->] (a) -| (b); the arrow goes horizontally from a, then vertically up to b. (And with |- it would be vertically first, then horizontally.)



            output of code



            documentclass[border=10pt]{standalone}
            usepackage{tikz}
            begin{document}
            begin{tikzpicture}
            coordinate (a) at (0,0);
            coordinate (b) at (1,1);

            draw [->] (a) -| (b);
            end{tikzpicture}
            end{document}







          share|improve this answer













          There are two different places to use -|/|-:





          1. In a coordinate specification.



            This is what you have used, the general form is



            (a -| b)


            where a and b are named nodes or coordinates. This means the coordinate that is at the y-coordinate of a, and x-coordinate of b. Similarly, (a |- b) has the x-coordinate of a and y-coordinate of b.



            For example, the following code draws a horizontal arrow from a at (0,0) to (1,0).



            documentclass[border=10pt]{standalone}
            usepackage{tikz}
            begin{document}
            begin{tikzpicture}
            coordinate (a) at (0,0);
            coordinate (b) at (1,1);

            draw [->] (a) -- (a -| b);
            end{tikzpicture}
            end{document}


            You can also use this as



            coordinate (c) at (a -| b);


            and then draw [->] (a) -- (c); does the same as the above.




          2. As a path specification.



            This is used between two coordinates, in place of --.



            With draw [->] (a) -| (b); the arrow goes horizontally from a, then vertically up to b. (And with |- it would be vertically first, then horizontally.)



            output of code



            documentclass[border=10pt]{standalone}
            usepackage{tikz}
            begin{document}
            begin{tikzpicture}
            coordinate (a) at (0,0);
            coordinate (b) at (1,1);

            draw [->] (a) -| (b);
            end{tikzpicture}
            end{document}








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 15 '17 at 11:38









          Torbjørn T.Torbjørn T.

          157k13253442




          157k13253442








          • 6





            The analogy between the coordinate and path specifications can be seen by noting that draw (a) -| (b); is equivalent to draw (a) -- (a-|b) -- (b) ;.

            – Andrey R
            Nov 15 '17 at 22:11














          • 6





            The analogy between the coordinate and path specifications can be seen by noting that draw (a) -| (b); is equivalent to draw (a) -- (a-|b) -- (b) ;.

            – Andrey R
            Nov 15 '17 at 22:11








          6




          6





          The analogy between the coordinate and path specifications can be seen by noting that draw (a) -| (b); is equivalent to draw (a) -- (a-|b) -- (b) ;.

          – Andrey R
          Nov 15 '17 at 22:11





          The analogy between the coordinate and path specifications can be seen by noting that draw (a) -| (b); is equivalent to draw (a) -- (a-|b) -- (b) ;.

          – Andrey R
          Nov 15 '17 at 22:11











          3














          If $a$ is a coordinate/node at position $(a_x, a_y)$ and $b$ is at $(b_x, b_y)$ then



          $ a |- b := (a_x, b_y) $

          $a -| b := (a_y, b_x) $


          They're just shorthands for combining the x/y coordinates of two points.



          EDIT: Huh, doesn't MathJAX work here? Then again, raw $ ... $ notation should be clear to TeX users, so I'll leave it as it is.






          share|improve this answer





















          • 1





            This is already mentioned in Torbjorn's answer no?

            – percusse
            Nov 15 '17 at 14:10






          • 2





            No, MathJax doesn't work. See tex.meta.stackexchange.com/questions/1272/… and linked questions.

            – Torbjørn T.
            Nov 15 '17 at 14:36











          • The second line should be a-|b := (b_x, a_y)...

            – Paul Gaborit
            7 mins ago
















          3














          If $a$ is a coordinate/node at position $(a_x, a_y)$ and $b$ is at $(b_x, b_y)$ then



          $ a |- b := (a_x, b_y) $

          $a -| b := (a_y, b_x) $


          They're just shorthands for combining the x/y coordinates of two points.



          EDIT: Huh, doesn't MathJAX work here? Then again, raw $ ... $ notation should be clear to TeX users, so I'll leave it as it is.






          share|improve this answer





















          • 1





            This is already mentioned in Torbjorn's answer no?

            – percusse
            Nov 15 '17 at 14:10






          • 2





            No, MathJax doesn't work. See tex.meta.stackexchange.com/questions/1272/… and linked questions.

            – Torbjørn T.
            Nov 15 '17 at 14:36











          • The second line should be a-|b := (b_x, a_y)...

            – Paul Gaborit
            7 mins ago














          3












          3








          3







          If $a$ is a coordinate/node at position $(a_x, a_y)$ and $b$ is at $(b_x, b_y)$ then



          $ a |- b := (a_x, b_y) $

          $a -| b := (a_y, b_x) $


          They're just shorthands for combining the x/y coordinates of two points.



          EDIT: Huh, doesn't MathJAX work here? Then again, raw $ ... $ notation should be clear to TeX users, so I'll leave it as it is.






          share|improve this answer















          If $a$ is a coordinate/node at position $(a_x, a_y)$ and $b$ is at $(b_x, b_y)$ then



          $ a |- b := (a_x, b_y) $

          $a -| b := (a_y, b_x) $


          They're just shorthands for combining the x/y coordinates of two points.



          EDIT: Huh, doesn't MathJAX work here? Then again, raw $ ... $ notation should be clear to TeX users, so I'll leave it as it is.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 17 mins ago









          AndréC

          9,28111447




          9,28111447










          answered Nov 15 '17 at 14:05









          BristolBristol

          665515




          665515








          • 1





            This is already mentioned in Torbjorn's answer no?

            – percusse
            Nov 15 '17 at 14:10






          • 2





            No, MathJax doesn't work. See tex.meta.stackexchange.com/questions/1272/… and linked questions.

            – Torbjørn T.
            Nov 15 '17 at 14:36











          • The second line should be a-|b := (b_x, a_y)...

            – Paul Gaborit
            7 mins ago














          • 1





            This is already mentioned in Torbjorn's answer no?

            – percusse
            Nov 15 '17 at 14:10






          • 2





            No, MathJax doesn't work. See tex.meta.stackexchange.com/questions/1272/… and linked questions.

            – Torbjørn T.
            Nov 15 '17 at 14:36











          • The second line should be a-|b := (b_x, a_y)...

            – Paul Gaborit
            7 mins ago








          1




          1





          This is already mentioned in Torbjorn's answer no?

          – percusse
          Nov 15 '17 at 14:10





          This is already mentioned in Torbjorn's answer no?

          – percusse
          Nov 15 '17 at 14:10




          2




          2





          No, MathJax doesn't work. See tex.meta.stackexchange.com/questions/1272/… and linked questions.

          – Torbjørn T.
          Nov 15 '17 at 14:36





          No, MathJax doesn't work. See tex.meta.stackexchange.com/questions/1272/… and linked questions.

          – Torbjørn T.
          Nov 15 '17 at 14:36













          The second line should be a-|b := (b_x, a_y)...

          – Paul Gaborit
          7 mins ago





          The second line should be a-|b := (b_x, a_y)...

          – Paul Gaborit
          7 mins ago


















          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%2f401425%2ftikz-what-exactly-does-the-the-notation-for-arrows-do%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

          Accessing regular linux commands in Huawei's Dopra Linux

          Can't connect RFCOMM socket: Host is down

          Kernel panic - not syncing: Fatal Exception in Interrupt