What is the meaning of option 'by' in TikZ IntersectionsTikZ: Intersection of two linesHow does TikZ sort intersections?Is there a way to clear paths previously defined with name path global in TikZHow to calculate intersections of a line defined by a segment and an ellipse in tikzPGF/TikZ: Relative coordinates behaving unexpectedName tikz pic as if it was a nodeTikz: node in margin right to other node interacts with tcbtheoremTikZ: Making names of intersections globaldef mypath … versus path [name path = mypath] … ;Visibility of path names declared in foreach loopsThe scope of a node nameUsing functions like sine, cosine and tangent to calculate coordinates in Tikz

What does "^L" mean in C?

How to generate binary array whose elements with values 1 are randomly drawn

Is it correct to say "which country do you like the most?"

How could an airship be repaired midflight?

Open new file while keeping the focus on the the current buffer

Suggestions on how to spend Shaabath (constructively) alone

HP P840 HDD RAID 5 many strange drive failures

Bash - pair each line of file

Why is indicated airspeed rather than ground speed used during the takeoff roll?

Deletion of copy-ctor & copy-assignment - public, private or protected?

Violin - Can double stops be played when the strings are not next to each other?

Naive Monte Carlo, MCMC and their use in Bayesian Theory

World War I as a war of liberals against authoritarians?

PTIJ What is the inyan of the Konami code in Uncle Moishy's song?

Is it true that good novels will automatically sell themselves on Amazon (and so on) and there is no need for one to waste time promoting?

While on vacation my taxi took a longer route, possibly to scam me out of money. How can I deal with this?

How are passwords stolen from companies if they only store hashes?

Print last inputted byte

Have the tides ever turned twice on any open problem?

Changing Color of error messages

How do hiring committees for research positions view getting "scooped"?

Do US professors/group leaders only get a salary, but no group budget?

How is the partial sum of a geometric sequence calculated?

Official degrees of earth’s rotation per day



What is the meaning of option 'by' in TikZ Intersections


TikZ: Intersection of two linesHow does TikZ sort intersections?Is there a way to clear paths previously defined with name path global in TikZHow to calculate intersections of a line defined by a segment and an ellipse in tikzPGF/TikZ: Relative coordinates behaving unexpectedName tikz pic as if it was a nodeTikz: node in margin right to other node interacts with tcbtheoremTikZ: Making names of intersections globaldef mypath … versus path [name path = mypath] … ;Visibility of path names declared in foreach loopsThe scope of a node nameUsing functions like sine, cosine and tangent to calculate coordinates in Tikz













5















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.



enter image description 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.










share|improve this question



















  • 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, 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
















5















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.



enter image description 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.










share|improve this question



















  • 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, 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














5












5








5


1






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.



enter image description 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.










share|improve this question
















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.



enter image description 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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 15:36







subham soni

















asked Mar 7 at 15:29









subham sonisubham soni

4,32083183




4,32083183







  • 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, 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













  • 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, 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








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











3 Answers
3






active

oldest

votes


















5














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'$;





share|improve this answer






























    5














    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.



    screenshot



    documentclass[border=5mm,tikz]standalone

    usetikzlibraryintersections

    begindocument
    begintikzpicture
    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);
    endtikzpicture
    enddocument





    share|improve this answer























    • 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


















    5














    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.



    documentclassstandalone
    usepackagetikz
    usetikzlibraryintersections

    begindocument
    begintikzpicture
    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;
    endtikzpicture
    enddocument


    enter image description here






    share|improve this answer


















    • 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 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











    • @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










    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%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









    5














    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'$;





    share|improve this answer



























      5














      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'$;





      share|improve this answer

























        5












        5








        5







        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'$;





        share|improve this answer













        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'$;






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 15:50









        Christoph FringsChristoph Frings

        923211




        923211





















            5














            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.



            screenshot



            documentclass[border=5mm,tikz]standalone

            usetikzlibraryintersections

            begindocument
            begintikzpicture
            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);
            endtikzpicture
            enddocument





            share|improve this answer























            • 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















            5














            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.



            screenshot



            documentclass[border=5mm,tikz]standalone

            usetikzlibraryintersections

            begindocument
            begintikzpicture
            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);
            endtikzpicture
            enddocument





            share|improve this answer























            • 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













            5












            5








            5







            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.



            screenshot



            documentclass[border=5mm,tikz]standalone

            usetikzlibraryintersections

            begindocument
            begintikzpicture
            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);
            endtikzpicture
            enddocument





            share|improve this answer













            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.



            screenshot



            documentclass[border=5mm,tikz]standalone

            usetikzlibraryintersections

            begindocument
            begintikzpicture
            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);
            endtikzpicture
            enddocument






            share|improve this answer












            share|improve this answer



            share|improve this answer










            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

















            • 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











            5














            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.



            documentclassstandalone
            usepackagetikz
            usetikzlibraryintersections

            begindocument
            begintikzpicture
            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;
            endtikzpicture
            enddocument


            enter image description here






            share|improve this answer


















            • 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 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











            • @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















            5














            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.



            documentclassstandalone
            usepackagetikz
            usetikzlibraryintersections

            begindocument
            begintikzpicture
            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;
            endtikzpicture
            enddocument


            enter image description here






            share|improve this answer


















            • 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 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











            • @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













            5












            5








            5







            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.



            documentclassstandalone
            usepackagetikz
            usetikzlibraryintersections

            begindocument
            begintikzpicture
            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;
            endtikzpicture
            enddocument


            enter image description here






            share|improve this answer













            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.



            documentclassstandalone
            usepackagetikz
            usetikzlibraryintersections

            begindocument
            begintikzpicture
            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;
            endtikzpicture
            enddocument


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 7 at 16:53









            marmotmarmot

            109k5135254




            109k5135254







            • 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 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











            • @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












            • 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 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











            • @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







            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

















            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%2f478222%2fwhat-is-the-meaning-of-option-by-in-tikz-intersections%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

            Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

            How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme