Set outline first and fill colors later





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







5















I have the following code



documentclass[border=5mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.10,
ticks=none}
usepgfplotslibrary{fillbetween}
usetikzlibrary{backgrounds,
calc,
patterns}

begin{document}

begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
end{tikzpicture}

end{document}


The code defines the outline of a tile in the line starting with tikzset{



I want to put this tile at various places and I want to use different colors to fill the tile. The above code is one of the attempts to get this done, which however does not work.



The output I get is the following:



enter image description here



I very recently learnt about the tikzset command (thanks to TeXstackexchange) and have no understanding of it. Can somebody please help me here and also, if possible, suggest a reference.










share|improve this question































    5















    I have the following code



    documentclass[border=5mm]{standalone}
    usepackage{pgfplots}
    pgfplotsset{compat=1.10,
    ticks=none}
    usepgfplotslibrary{fillbetween}
    usetikzlibrary{backgrounds,
    calc,
    patterns}

    begin{document}

    begin{tikzpicture}[scale=4, transform shape]
    tikzset{
    myc/.pic={
    draw[line width=2mm] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
    }
    }
    path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
    end{tikzpicture}

    end{document}


    The code defines the outline of a tile in the line starting with tikzset{



    I want to put this tile at various places and I want to use different colors to fill the tile. The above code is one of the attempts to get this done, which however does not work.



    The output I get is the following:



    enter image description here



    I very recently learnt about the tikzset command (thanks to TeXstackexchange) and have no understanding of it. Can somebody please help me here and also, if possible, suggest a reference.










    share|improve this question



























      5












      5








      5








      I have the following code



      documentclass[border=5mm]{standalone}
      usepackage{pgfplots}
      pgfplotsset{compat=1.10,
      ticks=none}
      usepgfplotslibrary{fillbetween}
      usetikzlibrary{backgrounds,
      calc,
      patterns}

      begin{document}

      begin{tikzpicture}[scale=4, transform shape]
      tikzset{
      myc/.pic={
      draw[line width=2mm] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
      }
      }
      path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
      end{tikzpicture}

      end{document}


      The code defines the outline of a tile in the line starting with tikzset{



      I want to put this tile at various places and I want to use different colors to fill the tile. The above code is one of the attempts to get this done, which however does not work.



      The output I get is the following:



      enter image description here



      I very recently learnt about the tikzset command (thanks to TeXstackexchange) and have no understanding of it. Can somebody please help me here and also, if possible, suggest a reference.










      share|improve this question














      I have the following code



      documentclass[border=5mm]{standalone}
      usepackage{pgfplots}
      pgfplotsset{compat=1.10,
      ticks=none}
      usepgfplotslibrary{fillbetween}
      usetikzlibrary{backgrounds,
      calc,
      patterns}

      begin{document}

      begin{tikzpicture}[scale=4, transform shape]
      tikzset{
      myc/.pic={
      draw[line width=2mm] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
      }
      }
      path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
      end{tikzpicture}

      end{document}


      The code defines the outline of a tile in the line starting with tikzset{



      I want to put this tile at various places and I want to use different colors to fill the tile. The above code is one of the attempts to get this done, which however does not work.



      The output I get is the following:



      enter image description here



      I very recently learnt about the tikzset command (thanks to TeXstackexchange) and have no understanding of it. Can somebody please help me here and also, if possible, suggest a reference.







      tikz-pgf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 20 at 12:39









      caffeinemachinecaffeinemachine

      2491 silver badge7 bronze badges




      2491 silver badge7 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          5














          Just use pic actions.



          documentclass[tikz,border=3.14mm]{standalone}

          begin{document}

          begin{tikzpicture}[scale=4, transform shape]
          tikzset{
          myc/.pic={
          draw[line width=2mm,pic actions] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
          }
          }
          path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer





















          • 2





            @caffeinemachine I personally prefer pic actions over an argument in the pic in this case because you can then add dashed and/or draw=red and so on which you cannot do in the same simple way if you use arguments of the pics.

            – user121799
            May 20 at 12:54



















          4














          Your pic can have arguments.



          documentclass[border=5mm]{standalone}
          usepackage{pgfplots}
          pgfplotsset{compat=1.10,
          ticks=none}
          usepgfplotslibrary{fillbetween}
          usetikzlibrary{backgrounds,
          calc,
          patterns}

          begin{document}

          begin{tikzpicture}[scale=4, transform shape]
          tikzset{
          myc/.pic={
          draw[line width=2mm,fill=#1] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
          }
          }
          path (0,0) pic {myc=red} (1,3) pic {myc=green} (2,6) pic {myc=blue};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer




























          • Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.

            – caffeinemachine
            May 20 at 12:51






          • 2





            @caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define new pics. Reading about the key handler and the example on page 264, you will know that pic is, literally, a kind of style. So you read about .style key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to a pic.

            – user156344
            May 20 at 12:54
















          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%2f491746%2fset-outline-first-and-fill-colors-later%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









          5














          Just use pic actions.



          documentclass[tikz,border=3.14mm]{standalone}

          begin{document}

          begin{tikzpicture}[scale=4, transform shape]
          tikzset{
          myc/.pic={
          draw[line width=2mm,pic actions] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
          }
          }
          path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer





















          • 2





            @caffeinemachine I personally prefer pic actions over an argument in the pic in this case because you can then add dashed and/or draw=red and so on which you cannot do in the same simple way if you use arguments of the pics.

            – user121799
            May 20 at 12:54
















          5














          Just use pic actions.



          documentclass[tikz,border=3.14mm]{standalone}

          begin{document}

          begin{tikzpicture}[scale=4, transform shape]
          tikzset{
          myc/.pic={
          draw[line width=2mm,pic actions] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
          }
          }
          path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer





















          • 2





            @caffeinemachine I personally prefer pic actions over an argument in the pic in this case because you can then add dashed and/or draw=red and so on which you cannot do in the same simple way if you use arguments of the pics.

            – user121799
            May 20 at 12:54














          5












          5








          5







          Just use pic actions.



          documentclass[tikz,border=3.14mm]{standalone}

          begin{document}

          begin{tikzpicture}[scale=4, transform shape]
          tikzset{
          myc/.pic={
          draw[line width=2mm,pic actions] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
          }
          }
          path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer













          Just use pic actions.



          documentclass[tikz,border=3.14mm]{standalone}

          begin{document}

          begin{tikzpicture}[scale=4, transform shape]
          tikzset{
          myc/.pic={
          draw[line width=2mm,pic actions] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
          }
          }
          path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
          end{tikzpicture}

          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 20 at 12:47









          user121799user121799

          127k6 gold badges192 silver badges357 bronze badges




          127k6 gold badges192 silver badges357 bronze badges











          • 2





            @caffeinemachine I personally prefer pic actions over an argument in the pic in this case because you can then add dashed and/or draw=red and so on which you cannot do in the same simple way if you use arguments of the pics.

            – user121799
            May 20 at 12:54














          • 2





            @caffeinemachine I personally prefer pic actions over an argument in the pic in this case because you can then add dashed and/or draw=red and so on which you cannot do in the same simple way if you use arguments of the pics.

            – user121799
            May 20 at 12:54








          2




          2





          @caffeinemachine I personally prefer pic actions over an argument in the pic in this case because you can then add dashed and/or draw=red and so on which you cannot do in the same simple way if you use arguments of the pics.

          – user121799
          May 20 at 12:54





          @caffeinemachine I personally prefer pic actions over an argument in the pic in this case because you can then add dashed and/or draw=red and so on which you cannot do in the same simple way if you use arguments of the pics.

          – user121799
          May 20 at 12:54













          4














          Your pic can have arguments.



          documentclass[border=5mm]{standalone}
          usepackage{pgfplots}
          pgfplotsset{compat=1.10,
          ticks=none}
          usepgfplotslibrary{fillbetween}
          usetikzlibrary{backgrounds,
          calc,
          patterns}

          begin{document}

          begin{tikzpicture}[scale=4, transform shape]
          tikzset{
          myc/.pic={
          draw[line width=2mm,fill=#1] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
          }
          }
          path (0,0) pic {myc=red} (1,3) pic {myc=green} (2,6) pic {myc=blue};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer




























          • Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.

            – caffeinemachine
            May 20 at 12:51






          • 2





            @caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define new pics. Reading about the key handler and the example on page 264, you will know that pic is, literally, a kind of style. So you read about .style key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to a pic.

            – user156344
            May 20 at 12:54


















          4














          Your pic can have arguments.



          documentclass[border=5mm]{standalone}
          usepackage{pgfplots}
          pgfplotsset{compat=1.10,
          ticks=none}
          usepgfplotslibrary{fillbetween}
          usetikzlibrary{backgrounds,
          calc,
          patterns}

          begin{document}

          begin{tikzpicture}[scale=4, transform shape]
          tikzset{
          myc/.pic={
          draw[line width=2mm,fill=#1] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
          }
          }
          path (0,0) pic {myc=red} (1,3) pic {myc=green} (2,6) pic {myc=blue};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer




























          • Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.

            – caffeinemachine
            May 20 at 12:51






          • 2





            @caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define new pics. Reading about the key handler and the example on page 264, you will know that pic is, literally, a kind of style. So you read about .style key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to a pic.

            – user156344
            May 20 at 12:54
















          4












          4








          4







          Your pic can have arguments.



          documentclass[border=5mm]{standalone}
          usepackage{pgfplots}
          pgfplotsset{compat=1.10,
          ticks=none}
          usepgfplotslibrary{fillbetween}
          usetikzlibrary{backgrounds,
          calc,
          patterns}

          begin{document}

          begin{tikzpicture}[scale=4, transform shape]
          tikzset{
          myc/.pic={
          draw[line width=2mm,fill=#1] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
          }
          }
          path (0,0) pic {myc=red} (1,3) pic {myc=green} (2,6) pic {myc=blue};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer















          Your pic can have arguments.



          documentclass[border=5mm]{standalone}
          usepackage{pgfplots}
          pgfplotsset{compat=1.10,
          ticks=none}
          usepgfplotslibrary{fillbetween}
          usetikzlibrary{backgrounds,
          calc,
          patterns}

          begin{document}

          begin{tikzpicture}[scale=4, transform shape]
          tikzset{
          myc/.pic={
          draw[line width=2mm,fill=#1] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
          }
          }
          path (0,0) pic {myc=red} (1,3) pic {myc=green} (2,6) pic {myc=blue};
          end{tikzpicture}

          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 20 at 12:50

























          answered May 20 at 12:49







          user156344























          • Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.

            – caffeinemachine
            May 20 at 12:51






          • 2





            @caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define new pics. Reading about the key handler and the example on page 264, you will know that pic is, literally, a kind of style. So you read about .style key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to a pic.

            – user156344
            May 20 at 12:54





















          • Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.

            – caffeinemachine
            May 20 at 12:51






          • 2





            @caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define new pics. Reading about the key handler and the example on page 264, you will know that pic is, literally, a kind of style. So you read about .style key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to a pic.

            – user156344
            May 20 at 12:54



















          Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.

          – caffeinemachine
          May 20 at 12:51





          Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.

          – caffeinemachine
          May 20 at 12:51




          2




          2





          @caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define new pics. Reading about the key handler and the example on page 264, you will know that pic is, literally, a kind of style. So you read about .style key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to a pic.

          – user156344
          May 20 at 12:54







          @caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define new pics. Reading about the key handler and the example on page 264, you will know that pic is, literally, a kind of style. So you read about .style key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to a pic.

          – user156344
          May 20 at 12:54




















          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%2f491746%2fset-outline-first-and-fill-colors-later%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

          He _____ here since 1970 . Answer needed [closed]What does “since he was so high” mean?Meaning of “catch birds for”?How do I ensure “since” takes the meaning I want?“Who cares here” meaningWhat does “right round toward” mean?the time tense (had now been detected)What does the phrase “ring around the roses” mean here?Correct usage of “visited upon”Meaning of “foiled rail sabotage bid”It was the third time I had gone to Rome or It is the third time I had been to Rome

          Bunad

          Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum