Pass a label in a loop (TiKz)












2















I want to reproduce the attached figure but I encounter some troubles for the display of labels.



enter image description here



   documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
foreach j in {0,...,3}{
pic at (4*i,-4*j){zellige};}
foreach i in {0,...,9}
foreach j in {10,...,19}{
node[draw,circle,inner sep=15pt,] at (4*i +2.5,0.1){LARGE j};
}
end{tikzpicture}
end{document}









share|improve this question







New contributor




Fabrice is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • One common trick in TikZ is to use the .try handler. Ideally speaking, you add pgfkeys{ /Fabrice/i/j/.try } in the for loop. And then, before the for loop, add pgfkeys{ /Fabrice/i/j/.code = draw the arrow }.

    – Symbol 1
    4 hours ago













  • Or, you can use coordinate in a pic and name every instance of pics. That will give you access to those corner points.

    – Symbol 1
    4 hours ago











  • Welcome to TeX.SE!

    – Kurt
    4 hours ago
















2















I want to reproduce the attached figure but I encounter some troubles for the display of labels.



enter image description here



   documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
foreach j in {0,...,3}{
pic at (4*i,-4*j){zellige};}
foreach i in {0,...,9}
foreach j in {10,...,19}{
node[draw,circle,inner sep=15pt,] at (4*i +2.5,0.1){LARGE j};
}
end{tikzpicture}
end{document}









share|improve this question







New contributor




Fabrice is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • One common trick in TikZ is to use the .try handler. Ideally speaking, you add pgfkeys{ /Fabrice/i/j/.try } in the for loop. And then, before the for loop, add pgfkeys{ /Fabrice/i/j/.code = draw the arrow }.

    – Symbol 1
    4 hours ago













  • Or, you can use coordinate in a pic and name every instance of pics. That will give you access to those corner points.

    – Symbol 1
    4 hours ago











  • Welcome to TeX.SE!

    – Kurt
    4 hours ago














2












2








2








I want to reproduce the attached figure but I encounter some troubles for the display of labels.



enter image description here



   documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
foreach j in {0,...,3}{
pic at (4*i,-4*j){zellige};}
foreach i in {0,...,9}
foreach j in {10,...,19}{
node[draw,circle,inner sep=15pt,] at (4*i +2.5,0.1){LARGE j};
}
end{tikzpicture}
end{document}









share|improve this question







New contributor




Fabrice is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I want to reproduce the attached figure but I encounter some troubles for the display of labels.



enter image description here



   documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
foreach j in {0,...,3}{
pic at (4*i,-4*j){zellige};}
foreach i in {0,...,9}
foreach j in {10,...,19}{
node[draw,circle,inner sep=15pt,] at (4*i +2.5,0.1){LARGE j};
}
end{tikzpicture}
end{document}






tikz-pgf






share|improve this question







New contributor




Fabrice is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Fabrice is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Fabrice is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 4 hours ago









FabriceFabrice

1,3851922




1,3851922




New contributor




Fabrice is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Fabrice is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Fabrice is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • One common trick in TikZ is to use the .try handler. Ideally speaking, you add pgfkeys{ /Fabrice/i/j/.try } in the for loop. And then, before the for loop, add pgfkeys{ /Fabrice/i/j/.code = draw the arrow }.

    – Symbol 1
    4 hours ago













  • Or, you can use coordinate in a pic and name every instance of pics. That will give you access to those corner points.

    – Symbol 1
    4 hours ago











  • Welcome to TeX.SE!

    – Kurt
    4 hours ago



















  • One common trick in TikZ is to use the .try handler. Ideally speaking, you add pgfkeys{ /Fabrice/i/j/.try } in the for loop. And then, before the for loop, add pgfkeys{ /Fabrice/i/j/.code = draw the arrow }.

    – Symbol 1
    4 hours ago













  • Or, you can use coordinate in a pic and name every instance of pics. That will give you access to those corner points.

    – Symbol 1
    4 hours ago











  • Welcome to TeX.SE!

    – Kurt
    4 hours ago

















One common trick in TikZ is to use the .try handler. Ideally speaking, you add pgfkeys{ /Fabrice/i/j/.try } in the for loop. And then, before the for loop, add pgfkeys{ /Fabrice/i/j/.code = draw the arrow }.

– Symbol 1
4 hours ago







One common trick in TikZ is to use the .try handler. Ideally speaking, you add pgfkeys{ /Fabrice/i/j/.try } in the for loop. And then, before the for loop, add pgfkeys{ /Fabrice/i/j/.code = draw the arrow }.

– Symbol 1
4 hours ago















Or, you can use coordinate in a pic and name every instance of pics. That will give you access to those corner points.

– Symbol 1
4 hours ago





Or, you can use coordinate in a pic and name every instance of pics. That will give you access to those corner points.

– Symbol 1
4 hours ago













Welcome to TeX.SE!

– Kurt
4 hours ago





Welcome to TeX.SE!

– Kurt
4 hours ago










2 Answers
2






active

oldest

votes


















3














I would just add the node to the definition of the pic (since pics can take arguments).



documentclass[tikz]{standalone}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
end{tikzpicture}
end{document}


enter image description here






share|improve this answer































    1














    It is enough to place the labels in the loop that builds the zelliges.



    labels



    documentclass[tikz]{standalone}
    usepackage{color}
    tikzset{
    zellige/.pic={
    draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
    --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
    }
    }
    begin{document}
    begin{tikzpicture}
    draw[cyan] (0,-14) grid (42,3);
    foreach i in {0,...,9}{
    foreach j [evaluate=j as lab using int((j+1)*10+i)]in {0,...,3}{
    pic at (4*i,-4*j){zellige};
    node[draw,circle,inner sep=15pt] at (4*i+2.5,-4*j){LARGE lab};}
    }
    end{tikzpicture}
    end{document}





    share|improve this answer
























    • @Marmot and AndréC Thanks !

      – Fabrice
      3 hours ago











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    Fabrice is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f472293%2fpass-a-label-in-a-loop-tikz%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    I would just add the node to the definition of the pic (since pics can take arguments).



    documentclass[tikz]{standalone}
    tikzset{
    zellige/.pic={
    draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
    --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
    node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
    }
    }
    begin{document}
    begin{tikzpicture}
    draw[cyan] (0,-14) grid (42,3);
    foreach i in {0,...,9}
    {foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
    pic at (4*i,-4*j){zellige=k};}}
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer




























      3














      I would just add the node to the definition of the pic (since pics can take arguments).



      documentclass[tikz]{standalone}
      tikzset{
      zellige/.pic={
      draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
      --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
      node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
      }
      }
      begin{document}
      begin{tikzpicture}
      draw[cyan] (0,-14) grid (42,3);
      foreach i in {0,...,9}
      {foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
      pic at (4*i,-4*j){zellige=k};}}
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer


























        3












        3








        3







        I would just add the node to the definition of the pic (since pics can take arguments).



        documentclass[tikz]{standalone}
        tikzset{
        zellige/.pic={
        draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
        --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
        node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
        }
        }
        begin{document}
        begin{tikzpicture}
        draw[cyan] (0,-14) grid (42,3);
        foreach i in {0,...,9}
        {foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
        pic at (4*i,-4*j){zellige=k};}}
        end{tikzpicture}
        end{document}


        enter image description here






        share|improve this answer













        I would just add the node to the definition of the pic (since pics can take arguments).



        documentclass[tikz]{standalone}
        tikzset{
        zellige/.pic={
        draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
        --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
        node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
        }
        }
        begin{document}
        begin{tikzpicture}
        draw[cyan] (0,-14) grid (42,3);
        foreach i in {0,...,9}
        {foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
        pic at (4*i,-4*j){zellige=k};}}
        end{tikzpicture}
        end{document}


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 3 hours ago









        marmotmarmot

        95.1k4110210




        95.1k4110210























            1














            It is enough to place the labels in the loop that builds the zelliges.



            labels



            documentclass[tikz]{standalone}
            usepackage{color}
            tikzset{
            zellige/.pic={
            draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
            --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
            }
            }
            begin{document}
            begin{tikzpicture}
            draw[cyan] (0,-14) grid (42,3);
            foreach i in {0,...,9}{
            foreach j [evaluate=j as lab using int((j+1)*10+i)]in {0,...,3}{
            pic at (4*i,-4*j){zellige};
            node[draw,circle,inner sep=15pt] at (4*i+2.5,-4*j){LARGE lab};}
            }
            end{tikzpicture}
            end{document}





            share|improve this answer
























            • @Marmot and AndréC Thanks !

              – Fabrice
              3 hours ago
















            1














            It is enough to place the labels in the loop that builds the zelliges.



            labels



            documentclass[tikz]{standalone}
            usepackage{color}
            tikzset{
            zellige/.pic={
            draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
            --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
            }
            }
            begin{document}
            begin{tikzpicture}
            draw[cyan] (0,-14) grid (42,3);
            foreach i in {0,...,9}{
            foreach j [evaluate=j as lab using int((j+1)*10+i)]in {0,...,3}{
            pic at (4*i,-4*j){zellige};
            node[draw,circle,inner sep=15pt] at (4*i+2.5,-4*j){LARGE lab};}
            }
            end{tikzpicture}
            end{document}





            share|improve this answer
























            • @Marmot and AndréC Thanks !

              – Fabrice
              3 hours ago














            1












            1








            1







            It is enough to place the labels in the loop that builds the zelliges.



            labels



            documentclass[tikz]{standalone}
            usepackage{color}
            tikzset{
            zellige/.pic={
            draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
            --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
            }
            }
            begin{document}
            begin{tikzpicture}
            draw[cyan] (0,-14) grid (42,3);
            foreach i in {0,...,9}{
            foreach j [evaluate=j as lab using int((j+1)*10+i)]in {0,...,3}{
            pic at (4*i,-4*j){zellige};
            node[draw,circle,inner sep=15pt] at (4*i+2.5,-4*j){LARGE lab};}
            }
            end{tikzpicture}
            end{document}





            share|improve this answer













            It is enough to place the labels in the loop that builds the zelliges.



            labels



            documentclass[tikz]{standalone}
            usepackage{color}
            tikzset{
            zellige/.pic={
            draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
            --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
            }
            }
            begin{document}
            begin{tikzpicture}
            draw[cyan] (0,-14) grid (42,3);
            foreach i in {0,...,9}{
            foreach j [evaluate=j as lab using int((j+1)*10+i)]in {0,...,3}{
            pic at (4*i,-4*j){zellige};
            node[draw,circle,inner sep=15pt] at (4*i+2.5,-4*j){LARGE lab};}
            }
            end{tikzpicture}
            end{document}






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 3 hours ago









            AndréCAndréC

            8,78411447




            8,78411447













            • @Marmot and AndréC Thanks !

              – Fabrice
              3 hours ago



















            • @Marmot and AndréC Thanks !

              – Fabrice
              3 hours ago

















            @Marmot and AndréC Thanks !

            – Fabrice
            3 hours ago





            @Marmot and AndréC Thanks !

            – Fabrice
            3 hours ago










            Fabrice is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            Fabrice is a new contributor. Be nice, and check out our Code of Conduct.













            Fabrice is a new contributor. Be nice, and check out our Code of Conduct.












            Fabrice is a new contributor. Be nice, and check out our Code of Conduct.
















            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%2f472293%2fpass-a-label-in-a-loop-tikz%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

            What are all the squawk codes?

            What are differences between VBoxVGA, VMSVGA and VBoxSVGA in VirtualBox?

            Hudsonelva