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












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

    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}





    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.



    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}


    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}

            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}





            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}

            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}





            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}

            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}





            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}

            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}






            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.



            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}


            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.



            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}


            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.



            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}


            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.



            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}


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










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

            mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?