TikZ: What EXACTLY does the the |- notation for arrows do?
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
add a comment |
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
add a comment |
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
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
tikz-arrows
edited Nov 15 '17 at 11:55
Layna
asked Nov 15 '17 at 11:25
LaynaLayna
22717
22717
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
There are two different places to use -|
/|-
:
In a coordinate specification.
This is what you have used, the general form is
(a -| b)
where
a
andb
are namednode
s orcoordinate
s. This means the coordinate that is at the y-coordinate ofa
, and x-coordinate ofb
. Similarly,(a |- b)
has the x-coordinate ofa
and y-coordinate ofb
.
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.
As a path specification.
This is used between two coordinates, in place of
--
.
With
draw [->] (a) -| (b);
the arrow goes horizontally froma
, then vertically up tob
. (And with|-
it would be vertically first, then horizontally.)
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}
6
The analogy between the coordinate and path specifications can be seen by noting thatdraw (a) -| (b);
is equivalent todraw (a) -- (a-|b) -- (b) ;
.
– Andrey R
Nov 15 '17 at 22:11
add a comment |
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.
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 bea-|b := (b_x, a_y)
...
– Paul Gaborit
7 mins ago
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
There are two different places to use -|
/|-
:
In a coordinate specification.
This is what you have used, the general form is
(a -| b)
where
a
andb
are namednode
s orcoordinate
s. This means the coordinate that is at the y-coordinate ofa
, and x-coordinate ofb
. Similarly,(a |- b)
has the x-coordinate ofa
and y-coordinate ofb
.
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.
As a path specification.
This is used between two coordinates, in place of
--
.
With
draw [->] (a) -| (b);
the arrow goes horizontally froma
, then vertically up tob
. (And with|-
it would be vertically first, then horizontally.)
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}
6
The analogy between the coordinate and path specifications can be seen by noting thatdraw (a) -| (b);
is equivalent todraw (a) -- (a-|b) -- (b) ;
.
– Andrey R
Nov 15 '17 at 22:11
add a comment |
There are two different places to use -|
/|-
:
In a coordinate specification.
This is what you have used, the general form is
(a -| b)
where
a
andb
are namednode
s orcoordinate
s. This means the coordinate that is at the y-coordinate ofa
, and x-coordinate ofb
. Similarly,(a |- b)
has the x-coordinate ofa
and y-coordinate ofb
.
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.
As a path specification.
This is used between two coordinates, in place of
--
.
With
draw [->] (a) -| (b);
the arrow goes horizontally froma
, then vertically up tob
. (And with|-
it would be vertically first, then horizontally.)
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}
6
The analogy between the coordinate and path specifications can be seen by noting thatdraw (a) -| (b);
is equivalent todraw (a) -- (a-|b) -- (b) ;
.
– Andrey R
Nov 15 '17 at 22:11
add a comment |
There are two different places to use -|
/|-
:
In a coordinate specification.
This is what you have used, the general form is
(a -| b)
where
a
andb
are namednode
s orcoordinate
s. This means the coordinate that is at the y-coordinate ofa
, and x-coordinate ofb
. Similarly,(a |- b)
has the x-coordinate ofa
and y-coordinate ofb
.
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.
As a path specification.
This is used between two coordinates, in place of
--
.
With
draw [->] (a) -| (b);
the arrow goes horizontally froma
, then vertically up tob
. (And with|-
it would be vertically first, then horizontally.)
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}
There are two different places to use -|
/|-
:
In a coordinate specification.
This is what you have used, the general form is
(a -| b)
where
a
andb
are namednode
s orcoordinate
s. This means the coordinate that is at the y-coordinate ofa
, and x-coordinate ofb
. Similarly,(a |- b)
has the x-coordinate ofa
and y-coordinate ofb
.
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.
As a path specification.
This is used between two coordinates, in place of
--
.
With
draw [->] (a) -| (b);
the arrow goes horizontally froma
, then vertically up tob
. (And with|-
it would be vertically first, then horizontally.)
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}
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 thatdraw (a) -| (b);
is equivalent todraw (a) -- (a-|b) -- (b) ;
.
– Andrey R
Nov 15 '17 at 22:11
add a comment |
6
The analogy between the coordinate and path specifications can be seen by noting thatdraw (a) -| (b);
is equivalent todraw (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
add a comment |
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.
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 bea-|b := (b_x, a_y)
...
– Paul Gaborit
7 mins ago
add a comment |
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.
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 bea-|b := (b_x, a_y)
...
– Paul Gaborit
7 mins ago
add a comment |
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.
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.
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 bea-|b := (b_x, a_y)
...
– Paul Gaborit
7 mins ago
add a comment |
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 bea-|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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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