What is the meaning of option 'by' in TikZ Intersections
Pg 65 of the PGF Manual, shows different operations with the intersections
library in TikZ. But I am not able to understand the code. What is the meaning of the option by
here.
The explanation given is:
The name intersections takes an optional argument
by, which lets you specify names for the coordinates and options for them. This creates more compact code.
This is not clear.
tikz-pgf intersections
|
show 2 more comments
Pg 65 of the PGF Manual, shows different operations with the intersections
library in TikZ. But I am not able to understand the code. What is the meaning of the option by
here.
The explanation given is:
The name intersections takes an optional argument
by, which lets you specify names for the coordinates and options for them. This creates more compact code.
This is not clear.
tikz-pgf intersections
1
forget the label and read as "name intersection of D and E by C"... So, C is the name of the intersection of D and E paths.
– koleygr
Mar 7 at 15:37
1
If you do not use theby
option, then name of the intersection will be(intersection-1)
etc.by=...
lets you name the intersection in a more convenient manner.
– daleif
Mar 7 at 15:37
@koleygr do you have any examples of theand options for them
part?
– daleif
Mar 7 at 15:38
@daleif I don't... just tried to give a basic answer to the question but I don't use it often... Do you think that I should delete my comment? Seems somehow clear to me but I am not sure about that
– koleygr
Mar 7 at 15:41
3
fill [name intersections={of=curve 1 and curve 2, by={a,b,c,d}}]
if exist four intersections, orfill [name intersections={of=curve 1 and curve 2, name=i, total=t}]
. see tikz & pgf manual, page 142 (version 3.1).
– Zarko
Mar 7 at 15:50
|
show 2 more comments
Pg 65 of the PGF Manual, shows different operations with the intersections
library in TikZ. But I am not able to understand the code. What is the meaning of the option by
here.
The explanation given is:
The name intersections takes an optional argument
by, which lets you specify names for the coordinates and options for them. This creates more compact code.
This is not clear.
tikz-pgf intersections
Pg 65 of the PGF Manual, shows different operations with the intersections
library in TikZ. But I am not able to understand the code. What is the meaning of the option by
here.
The explanation given is:
The name intersections takes an optional argument
by, which lets you specify names for the coordinates and options for them. This creates more compact code.
This is not clear.
tikz-pgf intersections
tikz-pgf intersections
edited Mar 7 at 15:36
subham soni
asked Mar 7 at 15:29
subham sonisubham soni
4,28382983
4,28382983
1
forget the label and read as "name intersection of D and E by C"... So, C is the name of the intersection of D and E paths.
– koleygr
Mar 7 at 15:37
1
If you do not use theby
option, then name of the intersection will be(intersection-1)
etc.by=...
lets you name the intersection in a more convenient manner.
– daleif
Mar 7 at 15:37
@koleygr do you have any examples of theand options for them
part?
– daleif
Mar 7 at 15:38
@daleif I don't... just tried to give a basic answer to the question but I don't use it often... Do you think that I should delete my comment? Seems somehow clear to me but I am not sure about that
– koleygr
Mar 7 at 15:41
3
fill [name intersections={of=curve 1 and curve 2, by={a,b,c,d}}]
if exist four intersections, orfill [name intersections={of=curve 1 and curve 2, name=i, total=t}]
. see tikz & pgf manual, page 142 (version 3.1).
– Zarko
Mar 7 at 15:50
|
show 2 more comments
1
forget the label and read as "name intersection of D and E by C"... So, C is the name of the intersection of D and E paths.
– koleygr
Mar 7 at 15:37
1
If you do not use theby
option, then name of the intersection will be(intersection-1)
etc.by=...
lets you name the intersection in a more convenient manner.
– daleif
Mar 7 at 15:37
@koleygr do you have any examples of theand options for them
part?
– daleif
Mar 7 at 15:38
@daleif I don't... just tried to give a basic answer to the question but I don't use it often... Do you think that I should delete my comment? Seems somehow clear to me but I am not sure about that
– koleygr
Mar 7 at 15:41
3
fill [name intersections={of=curve 1 and curve 2, by={a,b,c,d}}]
if exist four intersections, orfill [name intersections={of=curve 1 and curve 2, name=i, total=t}]
. see tikz & pgf manual, page 142 (version 3.1).
– Zarko
Mar 7 at 15:50
1
1
forget the label and read as "name intersection of D and E by C"... So, C is the name of the intersection of D and E paths.
– koleygr
Mar 7 at 15:37
forget the label and read as "name intersection of D and E by C"... So, C is the name of the intersection of D and E paths.
– koleygr
Mar 7 at 15:37
1
1
If you do not use the
by
option, then name of the intersection will be (intersection-1)
etc. by=...
lets you name the intersection in a more convenient manner.– daleif
Mar 7 at 15:37
If you do not use the
by
option, then name of the intersection will be (intersection-1)
etc. by=...
lets you name the intersection in a more convenient manner.– daleif
Mar 7 at 15:37
@koleygr do you have any examples of the
and options for them
part?– daleif
Mar 7 at 15:38
@koleygr do you have any examples of the
and options for them
part?– daleif
Mar 7 at 15:38
@daleif I don't... just tried to give a basic answer to the question but I don't use it often... Do you think that I should delete my comment? Seems somehow clear to me but I am not sure about that
– koleygr
Mar 7 at 15:41
@daleif I don't... just tried to give a basic answer to the question but I don't use it often... Do you think that I should delete my comment? Seems somehow clear to me but I am not sure about that
– koleygr
Mar 7 at 15:41
3
3
fill [name intersections={of=curve 1 and curve 2, by={a,b,c,d}}]
if exist four intersections, or fill [name intersections={of=curve 1 and curve 2, name=i, total=t}]
. see tikz & pgf manual, page 142 (version 3.1).– Zarko
Mar 7 at 15:50
fill [name intersections={of=curve 1 and curve 2, by={a,b,c,d}}]
if exist four intersections, or fill [name intersections={of=curve 1 and curve 2, name=i, total=t}]
. see tikz & pgf manual, page 142 (version 3.1).– Zarko
Mar 7 at 15:50
|
show 2 more comments
3 Answers
3
active
oldest
votes
The relevant line is
path [name intersections={of=D and E, by={[label=above:$C$]C, [label=below:$C’$]C’}}];
Compare with this simpler version:
path [name intersections={of=D and E, by={C, C’}}];
Here the intersection points are computed and named C and C' ("name the intersection points of D and E by the names C and C'").
It is shortcut for
coordinate (C) at ...;
coordinate (C') at ...;
for some computed coordinates.
Adding the optional styling [label=above:$C$]C
is equivalent to
coordinate[label=above:$C$] (C) at ...;
and allows you to style the intersection point directly. It would be equivalent, though longer, to write
path [name intersections={of=D and E, by={C, C’}}];
node[above] at (C) {$C$};
node[below] at (C') {$C'$};
add a comment |
By default, intersections are named (intersection-1)
, (intersection-2)
, etc.
When you write by={a,b}
the first two intersections will be called (a)
and (b)
.
Let's look at the example on page 142, slightly modified. It displays the 9 intersections of two curves.
The total number of intersections is given by total
.
By writing by={a,b}
, the first 2 intersections now have two names:
(a)
or(intersection-1)
(b)
or(intersection-2)
(a)
is an alias of (intersection-1)
, the others do not have aliases and remain accessibles.
documentclass[border=5mm,tikz]{standalone}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
clip (-2,-2) rectangle (2,2);
draw [name path=curve 1] (-2,-1) .. controls (8,-1) and (-8,1) .. (2,1);
draw [name path=curve 2] (-1,-2) .. controls (-1,8) and (1,-8) .. (1,2);
fill [name intersections={of=curve 1 and curve 2, by={a,b}, total=t}]
[red, opacity=0.5, every node/.style={above left, black, opacity=1}]
foreach s in {1,...,t}{(intersection-s) circle (2pt) node {footnotesizes}};
draw[fill=blue!50,opacity=.5] (a) circle (4pt);
end{tikzpicture}
end{document}
I was looking for a way to name them like "Ai, total=t" (by using the answer here: tex.stackexchange.com/a/31399/120578) but I couldn't find a way about that "i" counter (This would improve your answer very much)
– koleygr
Mar 7 at 16:12
I didn't quite understand what you meant. Can you be more explicit?
– AndréC
Mar 7 at 16:15
I mean that it would be more useful if we could name all the intersections by using the internal counter of the tikz when finding them: the 1 of (intersection-1), the 2 of (intersection-2) and so on. This way if we could name that counter "i" and could use it while giving name with "by={Ci}" (instead of "by={C1,C2,...,Ct}" where many times t is unknown) we could then use the points as C1, C2, ... Ct... And this would be much better...
– koleygr
Mar 7 at 16:20
This is a request for code improvement to TikZ developers, at our TikZ user level the only thing we can do is follow the syntax ...
– AndréC
Mar 7 at 16:24
I said I was looking for something like this and I am not sure (yet) if this can't be done with the existing TikZ code... this is why I was looking to find some similar syntax like this request... But if not I would also agree that this would be a useful feature request.... Anyway you already have my +1...
– koleygr
Mar 7 at 16:31
|
show 17 more comments
Just for completeness. You can name the intersections by C-1
etc. by just using name=C
. What is perhaps also worth pointing out is that, if you want so sort the intersections along a straight line, then you have to draw the straight line pretending it is a curve.
documentclass{standalone}
usepackage{tikz}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
draw[name path=grid] [xstep=3,ystep=2] (9,8) grid (0,0);
draw[->, name path=line] (2,1) to[bend left=0] (7,7);
draw[name intersections={of=grid and line, sort by=line, name=C, total=t}]
foreach s in {1,...,t}{(C-s) node {s}};
end{tikzpicture}
end{document}
1
Wow! Thanks! Didn't knew that this works like this! Thanks (+1).
– koleygr
Mar 7 at 17:10
Nice explanation, but now we have a compound word, sort by! :P.
– manooooh
Mar 7 at 18:44
1
@manooooh As long as the user doesn't usebye
I guess it is fine. ;-)
– marmot
Mar 7 at 18:46
@marmot how doessort by
work in this case. Alsosort by=line
is only for the intersections on the line and what is the order of sorting ( ascending or descending )
– subham soni
Mar 8 at 1:07
@subhamsoni Yes, intersections are always between two paths, and you can order along one of them. The slight subtlety is that, if you order along a line that is drawn withdraw (X) -- (Y);
, sorting may not always work. And yes, sorting is ascending (which is why I added the arrow head in the example).
– marmot
Mar 8 at 1:14
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%2f478222%2fwhat-is-the-meaning-of-option-by-in-tikz-intersections%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The relevant line is
path [name intersections={of=D and E, by={[label=above:$C$]C, [label=below:$C’$]C’}}];
Compare with this simpler version:
path [name intersections={of=D and E, by={C, C’}}];
Here the intersection points are computed and named C and C' ("name the intersection points of D and E by the names C and C'").
It is shortcut for
coordinate (C) at ...;
coordinate (C') at ...;
for some computed coordinates.
Adding the optional styling [label=above:$C$]C
is equivalent to
coordinate[label=above:$C$] (C) at ...;
and allows you to style the intersection point directly. It would be equivalent, though longer, to write
path [name intersections={of=D and E, by={C, C’}}];
node[above] at (C) {$C$};
node[below] at (C') {$C'$};
add a comment |
The relevant line is
path [name intersections={of=D and E, by={[label=above:$C$]C, [label=below:$C’$]C’}}];
Compare with this simpler version:
path [name intersections={of=D and E, by={C, C’}}];
Here the intersection points are computed and named C and C' ("name the intersection points of D and E by the names C and C'").
It is shortcut for
coordinate (C) at ...;
coordinate (C') at ...;
for some computed coordinates.
Adding the optional styling [label=above:$C$]C
is equivalent to
coordinate[label=above:$C$] (C) at ...;
and allows you to style the intersection point directly. It would be equivalent, though longer, to write
path [name intersections={of=D and E, by={C, C’}}];
node[above] at (C) {$C$};
node[below] at (C') {$C'$};
add a comment |
The relevant line is
path [name intersections={of=D and E, by={[label=above:$C$]C, [label=below:$C’$]C’}}];
Compare with this simpler version:
path [name intersections={of=D and E, by={C, C’}}];
Here the intersection points are computed and named C and C' ("name the intersection points of D and E by the names C and C'").
It is shortcut for
coordinate (C) at ...;
coordinate (C') at ...;
for some computed coordinates.
Adding the optional styling [label=above:$C$]C
is equivalent to
coordinate[label=above:$C$] (C) at ...;
and allows you to style the intersection point directly. It would be equivalent, though longer, to write
path [name intersections={of=D and E, by={C, C’}}];
node[above] at (C) {$C$};
node[below] at (C') {$C'$};
The relevant line is
path [name intersections={of=D and E, by={[label=above:$C$]C, [label=below:$C’$]C’}}];
Compare with this simpler version:
path [name intersections={of=D and E, by={C, C’}}];
Here the intersection points are computed and named C and C' ("name the intersection points of D and E by the names C and C'").
It is shortcut for
coordinate (C) at ...;
coordinate (C') at ...;
for some computed coordinates.
Adding the optional styling [label=above:$C$]C
is equivalent to
coordinate[label=above:$C$] (C) at ...;
and allows you to style the intersection point directly. It would be equivalent, though longer, to write
path [name intersections={of=D and E, by={C, C’}}];
node[above] at (C) {$C$};
node[below] at (C') {$C'$};
answered Mar 7 at 15:50
Christoph FringsChristoph Frings
923211
923211
add a comment |
add a comment |
By default, intersections are named (intersection-1)
, (intersection-2)
, etc.
When you write by={a,b}
the first two intersections will be called (a)
and (b)
.
Let's look at the example on page 142, slightly modified. It displays the 9 intersections of two curves.
The total number of intersections is given by total
.
By writing by={a,b}
, the first 2 intersections now have two names:
(a)
or(intersection-1)
(b)
or(intersection-2)
(a)
is an alias of (intersection-1)
, the others do not have aliases and remain accessibles.
documentclass[border=5mm,tikz]{standalone}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
clip (-2,-2) rectangle (2,2);
draw [name path=curve 1] (-2,-1) .. controls (8,-1) and (-8,1) .. (2,1);
draw [name path=curve 2] (-1,-2) .. controls (-1,8) and (1,-8) .. (1,2);
fill [name intersections={of=curve 1 and curve 2, by={a,b}, total=t}]
[red, opacity=0.5, every node/.style={above left, black, opacity=1}]
foreach s in {1,...,t}{(intersection-s) circle (2pt) node {footnotesizes}};
draw[fill=blue!50,opacity=.5] (a) circle (4pt);
end{tikzpicture}
end{document}
I was looking for a way to name them like "Ai, total=t" (by using the answer here: tex.stackexchange.com/a/31399/120578) but I couldn't find a way about that "i" counter (This would improve your answer very much)
– koleygr
Mar 7 at 16:12
I didn't quite understand what you meant. Can you be more explicit?
– AndréC
Mar 7 at 16:15
I mean that it would be more useful if we could name all the intersections by using the internal counter of the tikz when finding them: the 1 of (intersection-1), the 2 of (intersection-2) and so on. This way if we could name that counter "i" and could use it while giving name with "by={Ci}" (instead of "by={C1,C2,...,Ct}" where many times t is unknown) we could then use the points as C1, C2, ... Ct... And this would be much better...
– koleygr
Mar 7 at 16:20
This is a request for code improvement to TikZ developers, at our TikZ user level the only thing we can do is follow the syntax ...
– AndréC
Mar 7 at 16:24
I said I was looking for something like this and I am not sure (yet) if this can't be done with the existing TikZ code... this is why I was looking to find some similar syntax like this request... But if not I would also agree that this would be a useful feature request.... Anyway you already have my +1...
– koleygr
Mar 7 at 16:31
|
show 17 more comments
By default, intersections are named (intersection-1)
, (intersection-2)
, etc.
When you write by={a,b}
the first two intersections will be called (a)
and (b)
.
Let's look at the example on page 142, slightly modified. It displays the 9 intersections of two curves.
The total number of intersections is given by total
.
By writing by={a,b}
, the first 2 intersections now have two names:
(a)
or(intersection-1)
(b)
or(intersection-2)
(a)
is an alias of (intersection-1)
, the others do not have aliases and remain accessibles.
documentclass[border=5mm,tikz]{standalone}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
clip (-2,-2) rectangle (2,2);
draw [name path=curve 1] (-2,-1) .. controls (8,-1) and (-8,1) .. (2,1);
draw [name path=curve 2] (-1,-2) .. controls (-1,8) and (1,-8) .. (1,2);
fill [name intersections={of=curve 1 and curve 2, by={a,b}, total=t}]
[red, opacity=0.5, every node/.style={above left, black, opacity=1}]
foreach s in {1,...,t}{(intersection-s) circle (2pt) node {footnotesizes}};
draw[fill=blue!50,opacity=.5] (a) circle (4pt);
end{tikzpicture}
end{document}
I was looking for a way to name them like "Ai, total=t" (by using the answer here: tex.stackexchange.com/a/31399/120578) but I couldn't find a way about that "i" counter (This would improve your answer very much)
– koleygr
Mar 7 at 16:12
I didn't quite understand what you meant. Can you be more explicit?
– AndréC
Mar 7 at 16:15
I mean that it would be more useful if we could name all the intersections by using the internal counter of the tikz when finding them: the 1 of (intersection-1), the 2 of (intersection-2) and so on. This way if we could name that counter "i" and could use it while giving name with "by={Ci}" (instead of "by={C1,C2,...,Ct}" where many times t is unknown) we could then use the points as C1, C2, ... Ct... And this would be much better...
– koleygr
Mar 7 at 16:20
This is a request for code improvement to TikZ developers, at our TikZ user level the only thing we can do is follow the syntax ...
– AndréC
Mar 7 at 16:24
I said I was looking for something like this and I am not sure (yet) if this can't be done with the existing TikZ code... this is why I was looking to find some similar syntax like this request... But if not I would also agree that this would be a useful feature request.... Anyway you already have my +1...
– koleygr
Mar 7 at 16:31
|
show 17 more comments
By default, intersections are named (intersection-1)
, (intersection-2)
, etc.
When you write by={a,b}
the first two intersections will be called (a)
and (b)
.
Let's look at the example on page 142, slightly modified. It displays the 9 intersections of two curves.
The total number of intersections is given by total
.
By writing by={a,b}
, the first 2 intersections now have two names:
(a)
or(intersection-1)
(b)
or(intersection-2)
(a)
is an alias of (intersection-1)
, the others do not have aliases and remain accessibles.
documentclass[border=5mm,tikz]{standalone}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
clip (-2,-2) rectangle (2,2);
draw [name path=curve 1] (-2,-1) .. controls (8,-1) and (-8,1) .. (2,1);
draw [name path=curve 2] (-1,-2) .. controls (-1,8) and (1,-8) .. (1,2);
fill [name intersections={of=curve 1 and curve 2, by={a,b}, total=t}]
[red, opacity=0.5, every node/.style={above left, black, opacity=1}]
foreach s in {1,...,t}{(intersection-s) circle (2pt) node {footnotesizes}};
draw[fill=blue!50,opacity=.5] (a) circle (4pt);
end{tikzpicture}
end{document}
By default, intersections are named (intersection-1)
, (intersection-2)
, etc.
When you write by={a,b}
the first two intersections will be called (a)
and (b)
.
Let's look at the example on page 142, slightly modified. It displays the 9 intersections of two curves.
The total number of intersections is given by total
.
By writing by={a,b}
, the first 2 intersections now have two names:
(a)
or(intersection-1)
(b)
or(intersection-2)
(a)
is an alias of (intersection-1)
, the others do not have aliases and remain accessibles.
documentclass[border=5mm,tikz]{standalone}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
clip (-2,-2) rectangle (2,2);
draw [name path=curve 1] (-2,-1) .. controls (8,-1) and (-8,1) .. (2,1);
draw [name path=curve 2] (-1,-2) .. controls (-1,8) and (1,-8) .. (1,2);
fill [name intersections={of=curve 1 and curve 2, by={a,b}, total=t}]
[red, opacity=0.5, every node/.style={above left, black, opacity=1}]
foreach s in {1,...,t}{(intersection-s) circle (2pt) node {footnotesizes}};
draw[fill=blue!50,opacity=.5] (a) circle (4pt);
end{tikzpicture}
end{document}
answered Mar 7 at 16:07
AndréCAndréC
1
1
I was looking for a way to name them like "Ai, total=t" (by using the answer here: tex.stackexchange.com/a/31399/120578) but I couldn't find a way about that "i" counter (This would improve your answer very much)
– koleygr
Mar 7 at 16:12
I didn't quite understand what you meant. Can you be more explicit?
– AndréC
Mar 7 at 16:15
I mean that it would be more useful if we could name all the intersections by using the internal counter of the tikz when finding them: the 1 of (intersection-1), the 2 of (intersection-2) and so on. This way if we could name that counter "i" and could use it while giving name with "by={Ci}" (instead of "by={C1,C2,...,Ct}" where many times t is unknown) we could then use the points as C1, C2, ... Ct... And this would be much better...
– koleygr
Mar 7 at 16:20
This is a request for code improvement to TikZ developers, at our TikZ user level the only thing we can do is follow the syntax ...
– AndréC
Mar 7 at 16:24
I said I was looking for something like this and I am not sure (yet) if this can't be done with the existing TikZ code... this is why I was looking to find some similar syntax like this request... But if not I would also agree that this would be a useful feature request.... Anyway you already have my +1...
– koleygr
Mar 7 at 16:31
|
show 17 more comments
I was looking for a way to name them like "Ai, total=t" (by using the answer here: tex.stackexchange.com/a/31399/120578) but I couldn't find a way about that "i" counter (This would improve your answer very much)
– koleygr
Mar 7 at 16:12
I didn't quite understand what you meant. Can you be more explicit?
– AndréC
Mar 7 at 16:15
I mean that it would be more useful if we could name all the intersections by using the internal counter of the tikz when finding them: the 1 of (intersection-1), the 2 of (intersection-2) and so on. This way if we could name that counter "i" and could use it while giving name with "by={Ci}" (instead of "by={C1,C2,...,Ct}" where many times t is unknown) we could then use the points as C1, C2, ... Ct... And this would be much better...
– koleygr
Mar 7 at 16:20
This is a request for code improvement to TikZ developers, at our TikZ user level the only thing we can do is follow the syntax ...
– AndréC
Mar 7 at 16:24
I said I was looking for something like this and I am not sure (yet) if this can't be done with the existing TikZ code... this is why I was looking to find some similar syntax like this request... But if not I would also agree that this would be a useful feature request.... Anyway you already have my +1...
– koleygr
Mar 7 at 16:31
I was looking for a way to name them like "Ai, total=t" (by using the answer here: tex.stackexchange.com/a/31399/120578) but I couldn't find a way about that "i" counter (This would improve your answer very much)
– koleygr
Mar 7 at 16:12
I was looking for a way to name them like "Ai, total=t" (by using the answer here: tex.stackexchange.com/a/31399/120578) but I couldn't find a way about that "i" counter (This would improve your answer very much)
– koleygr
Mar 7 at 16:12
I didn't quite understand what you meant. Can you be more explicit?
– AndréC
Mar 7 at 16:15
I didn't quite understand what you meant. Can you be more explicit?
– AndréC
Mar 7 at 16:15
I mean that it would be more useful if we could name all the intersections by using the internal counter of the tikz when finding them: the 1 of (intersection-1), the 2 of (intersection-2) and so on. This way if we could name that counter "i" and could use it while giving name with "by={Ci}" (instead of "by={C1,C2,...,Ct}" where many times t is unknown) we could then use the points as C1, C2, ... Ct... And this would be much better...
– koleygr
Mar 7 at 16:20
I mean that it would be more useful if we could name all the intersections by using the internal counter of the tikz when finding them: the 1 of (intersection-1), the 2 of (intersection-2) and so on. This way if we could name that counter "i" and could use it while giving name with "by={Ci}" (instead of "by={C1,C2,...,Ct}" where many times t is unknown) we could then use the points as C1, C2, ... Ct... And this would be much better...
– koleygr
Mar 7 at 16:20
This is a request for code improvement to TikZ developers, at our TikZ user level the only thing we can do is follow the syntax ...
– AndréC
Mar 7 at 16:24
This is a request for code improvement to TikZ developers, at our TikZ user level the only thing we can do is follow the syntax ...
– AndréC
Mar 7 at 16:24
I said I was looking for something like this and I am not sure (yet) if this can't be done with the existing TikZ code... this is why I was looking to find some similar syntax like this request... But if not I would also agree that this would be a useful feature request.... Anyway you already have my +1...
– koleygr
Mar 7 at 16:31
I said I was looking for something like this and I am not sure (yet) if this can't be done with the existing TikZ code... this is why I was looking to find some similar syntax like this request... But if not I would also agree that this would be a useful feature request.... Anyway you already have my +1...
– koleygr
Mar 7 at 16:31
|
show 17 more comments
Just for completeness. You can name the intersections by C-1
etc. by just using name=C
. What is perhaps also worth pointing out is that, if you want so sort the intersections along a straight line, then you have to draw the straight line pretending it is a curve.
documentclass{standalone}
usepackage{tikz}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
draw[name path=grid] [xstep=3,ystep=2] (9,8) grid (0,0);
draw[->, name path=line] (2,1) to[bend left=0] (7,7);
draw[name intersections={of=grid and line, sort by=line, name=C, total=t}]
foreach s in {1,...,t}{(C-s) node {s}};
end{tikzpicture}
end{document}
1
Wow! Thanks! Didn't knew that this works like this! Thanks (+1).
– koleygr
Mar 7 at 17:10
Nice explanation, but now we have a compound word, sort by! :P.
– manooooh
Mar 7 at 18:44
1
@manooooh As long as the user doesn't usebye
I guess it is fine. ;-)
– marmot
Mar 7 at 18:46
@marmot how doessort by
work in this case. Alsosort by=line
is only for the intersections on the line and what is the order of sorting ( ascending or descending )
– subham soni
Mar 8 at 1:07
@subhamsoni Yes, intersections are always between two paths, and you can order along one of them. The slight subtlety is that, if you order along a line that is drawn withdraw (X) -- (Y);
, sorting may not always work. And yes, sorting is ascending (which is why I added the arrow head in the example).
– marmot
Mar 8 at 1:14
add a comment |
Just for completeness. You can name the intersections by C-1
etc. by just using name=C
. What is perhaps also worth pointing out is that, if you want so sort the intersections along a straight line, then you have to draw the straight line pretending it is a curve.
documentclass{standalone}
usepackage{tikz}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
draw[name path=grid] [xstep=3,ystep=2] (9,8) grid (0,0);
draw[->, name path=line] (2,1) to[bend left=0] (7,7);
draw[name intersections={of=grid and line, sort by=line, name=C, total=t}]
foreach s in {1,...,t}{(C-s) node {s}};
end{tikzpicture}
end{document}
1
Wow! Thanks! Didn't knew that this works like this! Thanks (+1).
– koleygr
Mar 7 at 17:10
Nice explanation, but now we have a compound word, sort by! :P.
– manooooh
Mar 7 at 18:44
1
@manooooh As long as the user doesn't usebye
I guess it is fine. ;-)
– marmot
Mar 7 at 18:46
@marmot how doessort by
work in this case. Alsosort by=line
is only for the intersections on the line and what is the order of sorting ( ascending or descending )
– subham soni
Mar 8 at 1:07
@subhamsoni Yes, intersections are always between two paths, and you can order along one of them. The slight subtlety is that, if you order along a line that is drawn withdraw (X) -- (Y);
, sorting may not always work. And yes, sorting is ascending (which is why I added the arrow head in the example).
– marmot
Mar 8 at 1:14
add a comment |
Just for completeness. You can name the intersections by C-1
etc. by just using name=C
. What is perhaps also worth pointing out is that, if you want so sort the intersections along a straight line, then you have to draw the straight line pretending it is a curve.
documentclass{standalone}
usepackage{tikz}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
draw[name path=grid] [xstep=3,ystep=2] (9,8) grid (0,0);
draw[->, name path=line] (2,1) to[bend left=0] (7,7);
draw[name intersections={of=grid and line, sort by=line, name=C, total=t}]
foreach s in {1,...,t}{(C-s) node {s}};
end{tikzpicture}
end{document}
Just for completeness. You can name the intersections by C-1
etc. by just using name=C
. What is perhaps also worth pointing out is that, if you want so sort the intersections along a straight line, then you have to draw the straight line pretending it is a curve.
documentclass{standalone}
usepackage{tikz}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
draw[name path=grid] [xstep=3,ystep=2] (9,8) grid (0,0);
draw[->, name path=line] (2,1) to[bend left=0] (7,7);
draw[name intersections={of=grid and line, sort by=line, name=C, total=t}]
foreach s in {1,...,t}{(C-s) node {s}};
end{tikzpicture}
end{document}
answered Mar 7 at 16:53
marmotmarmot
108k5133251
108k5133251
1
Wow! Thanks! Didn't knew that this works like this! Thanks (+1).
– koleygr
Mar 7 at 17:10
Nice explanation, but now we have a compound word, sort by! :P.
– manooooh
Mar 7 at 18:44
1
@manooooh As long as the user doesn't usebye
I guess it is fine. ;-)
– marmot
Mar 7 at 18:46
@marmot how doessort by
work in this case. Alsosort by=line
is only for the intersections on the line and what is the order of sorting ( ascending or descending )
– subham soni
Mar 8 at 1:07
@subhamsoni Yes, intersections are always between two paths, and you can order along one of them. The slight subtlety is that, if you order along a line that is drawn withdraw (X) -- (Y);
, sorting may not always work. And yes, sorting is ascending (which is why I added the arrow head in the example).
– marmot
Mar 8 at 1:14
add a comment |
1
Wow! Thanks! Didn't knew that this works like this! Thanks (+1).
– koleygr
Mar 7 at 17:10
Nice explanation, but now we have a compound word, sort by! :P.
– manooooh
Mar 7 at 18:44
1
@manooooh As long as the user doesn't usebye
I guess it is fine. ;-)
– marmot
Mar 7 at 18:46
@marmot how doessort by
work in this case. Alsosort by=line
is only for the intersections on the line and what is the order of sorting ( ascending or descending )
– subham soni
Mar 8 at 1:07
@subhamsoni Yes, intersections are always between two paths, and you can order along one of them. The slight subtlety is that, if you order along a line that is drawn withdraw (X) -- (Y);
, sorting may not always work. And yes, sorting is ascending (which is why I added the arrow head in the example).
– marmot
Mar 8 at 1:14
1
1
Wow! Thanks! Didn't knew that this works like this! Thanks (+1).
– koleygr
Mar 7 at 17:10
Wow! Thanks! Didn't knew that this works like this! Thanks (+1).
– koleygr
Mar 7 at 17:10
Nice explanation, but now we have a compound word, sort by! :P.
– manooooh
Mar 7 at 18:44
Nice explanation, but now we have a compound word, sort by! :P.
– manooooh
Mar 7 at 18:44
1
1
@manooooh As long as the user doesn't use
bye
I guess it is fine. ;-)– marmot
Mar 7 at 18:46
@manooooh As long as the user doesn't use
bye
I guess it is fine. ;-)– marmot
Mar 7 at 18:46
@marmot how does
sort by
work in this case. Also sort by=line
is only for the intersections on the line and what is the order of sorting ( ascending or descending )– subham soni
Mar 8 at 1:07
@marmot how does
sort by
work in this case. Also sort by=line
is only for the intersections on the line and what is the order of sorting ( ascending or descending )– subham soni
Mar 8 at 1:07
@subhamsoni Yes, intersections are always between two paths, and you can order along one of them. The slight subtlety is that, if you order along a line that is drawn with
draw (X) -- (Y);
, sorting may not always work. And yes, sorting is ascending (which is why I added the arrow head in the example).– marmot
Mar 8 at 1:14
@subhamsoni Yes, intersections are always between two paths, and you can order along one of them. The slight subtlety is that, if you order along a line that is drawn with
draw (X) -- (Y);
, sorting may not always work. And yes, sorting is ascending (which is why I added the arrow head in the example).– marmot
Mar 8 at 1:14
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%2f478222%2fwhat-is-the-meaning-of-option-by-in-tikz-intersections%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
1
forget the label and read as "name intersection of D and E by C"... So, C is the name of the intersection of D and E paths.
– koleygr
Mar 7 at 15:37
1
If you do not use the
by
option, then name of the intersection will be(intersection-1)
etc.by=...
lets you name the intersection in a more convenient manner.– daleif
Mar 7 at 15:37
@koleygr do you have any examples of the
and options for them
part?– daleif
Mar 7 at 15:38
@daleif I don't... just tried to give a basic answer to the question but I don't use it often... Do you think that I should delete my comment? Seems somehow clear to me but I am not sure about that
– koleygr
Mar 7 at 15:41
3
fill [name intersections={of=curve 1 and curve 2, by={a,b,c,d}}]
if exist four intersections, orfill [name intersections={of=curve 1 and curve 2, name=i, total=t}]
. see tikz & pgf manual, page 142 (version 3.1).– Zarko
Mar 7 at 15:50