Tikz equivalent for pst-rputover

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












For pstricks the package pst-rputover (new on ctan since 2017-03-28) has been created to solve following problem




In brief, I'm looking for a version of rput* that blocks out lines but not fill colors.




raised here:
Is there a variant of rput* in PSTricks that preserves background fill colors?



I am interested in a solution for tikz. I have recreated the minimal example with tikz:



documentclass[tikz]standalone
begindocument
begintikzpicture
fill[blue!40] (0,0) rectangle (2,2);
fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
draw(1,0)--(1,2);
node at (1,1) Largesf label;
endtikzpicture
enddocument


enter image description here



The expected output should be



enter image description here



I am evaluating following options in tikz:



  • draw/fill/text opacity

  • transparency groups

  • beginscope

  • beginpgfonlayer

Note the knockout feature is not supported by all PDF Viewer. I can confirm that it does not work in Skim and Preview on macOS.



However, I have not figured out yet how to solve this.



UPDATE
I want to add parts of the picture I am working on to clarify that lines might cross several nodes which is a priori not clear:



enter image description hereenter image description here



pst-rputover doc details




The style combines two ideas. The first idea, suggested by the StackExchange user Werner on this page, is to use psDefBoxNodes in pst-node.sty to get the coordinates of the corners of the box occupied by each label. The second idea is to use these coordinates and psclip to remove the parts of the objects in the argument of coverable that overlap with the labels. The only subtlety in implementing this second idea is that we want to do a ‘reverse clip’: we want to keep the areas outside the labels, not the ones inside.











share|improve this question



























    up vote
    1
    down vote

    favorite












    For pstricks the package pst-rputover (new on ctan since 2017-03-28) has been created to solve following problem




    In brief, I'm looking for a version of rput* that blocks out lines but not fill colors.




    raised here:
    Is there a variant of rput* in PSTricks that preserves background fill colors?



    I am interested in a solution for tikz. I have recreated the minimal example with tikz:



    documentclass[tikz]standalone
    begindocument
    begintikzpicture
    fill[blue!40] (0,0) rectangle (2,2);
    fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
    draw(1,0)--(1,2);
    node at (1,1) Largesf label;
    endtikzpicture
    enddocument


    enter image description here



    The expected output should be



    enter image description here



    I am evaluating following options in tikz:



    • draw/fill/text opacity

    • transparency groups

    • beginscope

    • beginpgfonlayer

    Note the knockout feature is not supported by all PDF Viewer. I can confirm that it does not work in Skim and Preview on macOS.



    However, I have not figured out yet how to solve this.



    UPDATE
    I want to add parts of the picture I am working on to clarify that lines might cross several nodes which is a priori not clear:



    enter image description hereenter image description here



    pst-rputover doc details




    The style combines two ideas. The first idea, suggested by the StackExchange user Werner on this page, is to use psDefBoxNodes in pst-node.sty to get the coordinates of the corners of the box occupied by each label. The second idea is to use these coordinates and psclip to remove the parts of the objects in the argument of coverable that overlap with the labels. The only subtlety in implementing this second idea is that we want to do a ‘reverse clip’: we want to keep the areas outside the labels, not the ones inside.











    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      For pstricks the package pst-rputover (new on ctan since 2017-03-28) has been created to solve following problem




      In brief, I'm looking for a version of rput* that blocks out lines but not fill colors.




      raised here:
      Is there a variant of rput* in PSTricks that preserves background fill colors?



      I am interested in a solution for tikz. I have recreated the minimal example with tikz:



      documentclass[tikz]standalone
      begindocument
      begintikzpicture
      fill[blue!40] (0,0) rectangle (2,2);
      fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
      draw(1,0)--(1,2);
      node at (1,1) Largesf label;
      endtikzpicture
      enddocument


      enter image description here



      The expected output should be



      enter image description here



      I am evaluating following options in tikz:



      • draw/fill/text opacity

      • transparency groups

      • beginscope

      • beginpgfonlayer

      Note the knockout feature is not supported by all PDF Viewer. I can confirm that it does not work in Skim and Preview on macOS.



      However, I have not figured out yet how to solve this.



      UPDATE
      I want to add parts of the picture I am working on to clarify that lines might cross several nodes which is a priori not clear:



      enter image description hereenter image description here



      pst-rputover doc details




      The style combines two ideas. The first idea, suggested by the StackExchange user Werner on this page, is to use psDefBoxNodes in pst-node.sty to get the coordinates of the corners of the box occupied by each label. The second idea is to use these coordinates and psclip to remove the parts of the objects in the argument of coverable that overlap with the labels. The only subtlety in implementing this second idea is that we want to do a ‘reverse clip’: we want to keep the areas outside the labels, not the ones inside.











      share|improve this question















      For pstricks the package pst-rputover (new on ctan since 2017-03-28) has been created to solve following problem




      In brief, I'm looking for a version of rput* that blocks out lines but not fill colors.




      raised here:
      Is there a variant of rput* in PSTricks that preserves background fill colors?



      I am interested in a solution for tikz. I have recreated the minimal example with tikz:



      documentclass[tikz]standalone
      begindocument
      begintikzpicture
      fill[blue!40] (0,0) rectangle (2,2);
      fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
      draw(1,0)--(1,2);
      node at (1,1) Largesf label;
      endtikzpicture
      enddocument


      enter image description here



      The expected output should be



      enter image description here



      I am evaluating following options in tikz:



      • draw/fill/text opacity

      • transparency groups

      • beginscope

      • beginpgfonlayer

      Note the knockout feature is not supported by all PDF Viewer. I can confirm that it does not work in Skim and Preview on macOS.



      However, I have not figured out yet how to solve this.



      UPDATE
      I want to add parts of the picture I am working on to clarify that lines might cross several nodes which is a priori not clear:



      enter image description hereenter image description here



      pst-rputover doc details




      The style combines two ideas. The first idea, suggested by the StackExchange user Werner on this page, is to use psDefBoxNodes in pst-node.sty to get the coordinates of the corners of the box occupied by each label. The second idea is to use these coordinates and psclip to remove the parts of the objects in the argument of coverable that overlap with the labels. The only subtlety in implementing this second idea is that we want to do a ‘reverse clip’: we want to keep the areas outside the labels, not the ones inside.








      tikz-pgf transparency






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 hours ago

























      asked 5 hours ago









      Hotschke

      2,02811839




      2,02811839




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          You can clip against the labels:



          documentclass[tikz]standalone
          begindocument

          begintikzpicture
          fill[color=blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;

          node at (1,1) (mynodeA)Largesffamily label;
          node at (0.5,1.5) (mynodeB)sffamily label;

          beginscope
          path [clip]
          (mynodeA.north east) --
          (mynodeA.south east) --
          (mynodeA.south west) --
          (mynodeA.north west) -- cycle
          (current bounding box.south east) --
          (current bounding box.north east) --
          (current bounding box.north west) --
          (current bounding box.south west) -- cycle;
          path [clip]
          (mynodeB.north east) --
          (mynodeB.south east) --
          (mynodeB.south west) --
          (mynodeB.north west) -- cycle
          (current bounding box.south east) --
          (current bounding box.north east) --
          (current bounding box.north west) --
          (current bounding box.south west) -- cycle;

          draw(1,0)--(1,2);
          draw(0.5,0)--(0.5,2);
          draw(0,1.8)--(2,0.5);
          endscope
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer






















          • Thank you very much. This looks like what I want. The actual picture contains 55 nodes and 120 edges which have to be clipped. I think I will use a foreach loop to to define the clippath for every node to make the code more manageable.
            – Hotschke
            3 hours ago










          • Your rputover code is actually doing something similar.
            – Ulrike Fischer
            2 hours ago

















          up vote
          1
          down vote













          with drawing line in two parts?



          enter image description here



          documentclass[tikz, margin=3.141592]standalone
          begindocument
          begintikzpicture
          fill[blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
          node at (1,1) (label) Largesf label;
          draw (1,0) -- (label) (label) -- (1,2);
          endtikzpicture
          enddocument





          share|improve this answer




















          • Thanks for the answer. But that is how I created the expected output. The actual document is complicated and doing this manually is not feasible. I really look for an rputover equivalent.
            – Hotschke
            3 hours ago










          • margin=3.14 - - > :)
            – Dr. Manuel Kuehner
            24 mins ago

















          up vote
          1
          down vote













          Just for completeness: this is a version which also takes into account rounded corners or, more generally, arbitrary node shapes. And it spares you from typing a lot of coordinates.



          documentclass[tikz]standalone
          usetikzlibraryshapes.geometric
          makeatletter % https://tex.stackexchange.com/a/38995/121799
          tikzset
          use path/.code=pgfsyssoftpath@setcurrentpath#1

          makeatother
          tikzsetremember path/.style=save path=tmprotect
          % https://tex.stackexchange.com/a/12033/121799
          tikzsetreverseclip/.style=insert path=(current bounding box.north
          east) rectangle (current bounding box.south west)

          begindocument
          begintikzpicture
          fill[blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
          node[remember path,font=Largesf] at (1,1) label;
          clip[use path=tmprotect,reverseclip];
          draw(1,0)--(1,2);
          endtikzpicture

          begintikzpicture
          fill[blue!40] (-1,0) rectangle (3,4);
          fill[red] plot [smooth] coordinates (-1,4)(0,2)(1,1)(2,2)(3,4) -- cycle;
          node[remember path,font=Largesf,rounded corners] at (1,1) label;
          clip[use path=tmprotect,reverseclip];
          node[remember path,font=Largesf,shape=diamond] at (2,2) label 3;
          clip[use path=tmprotect,reverseclip];
          node[remember path,font=Largesf,shape=ellipse] at (0,2) label 2;
          clip[use path=tmprotect,reverseclip];
          fill[gray,opacity=0.2] (-1,0) rectangle (3,4);
          draw [blue,thick] (-1,4) -- (1,0) -- (3,4);
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer




















          • +1: Great! Is tmprotect already predefined?
            – Dr. Manuel Kuehner
            25 mins ago






          • 1




            @Dr.ManuelKuehner No, only here.
            – marmot
            14 mins 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',
          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%2f457857%2ftikz-equivalent-for-pst-rputover%23new-answer', 'question_page');

          );

          Post as a guest






























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          You can clip against the labels:



          documentclass[tikz]standalone
          begindocument

          begintikzpicture
          fill[color=blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;

          node at (1,1) (mynodeA)Largesffamily label;
          node at (0.5,1.5) (mynodeB)sffamily label;

          beginscope
          path [clip]
          (mynodeA.north east) --
          (mynodeA.south east) --
          (mynodeA.south west) --
          (mynodeA.north west) -- cycle
          (current bounding box.south east) --
          (current bounding box.north east) --
          (current bounding box.north west) --
          (current bounding box.south west) -- cycle;
          path [clip]
          (mynodeB.north east) --
          (mynodeB.south east) --
          (mynodeB.south west) --
          (mynodeB.north west) -- cycle
          (current bounding box.south east) --
          (current bounding box.north east) --
          (current bounding box.north west) --
          (current bounding box.south west) -- cycle;

          draw(1,0)--(1,2);
          draw(0.5,0)--(0.5,2);
          draw(0,1.8)--(2,0.5);
          endscope
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer






















          • Thank you very much. This looks like what I want. The actual picture contains 55 nodes and 120 edges which have to be clipped. I think I will use a foreach loop to to define the clippath for every node to make the code more manageable.
            – Hotschke
            3 hours ago










          • Your rputover code is actually doing something similar.
            – Ulrike Fischer
            2 hours ago














          up vote
          3
          down vote



          accepted










          You can clip against the labels:



          documentclass[tikz]standalone
          begindocument

          begintikzpicture
          fill[color=blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;

          node at (1,1) (mynodeA)Largesffamily label;
          node at (0.5,1.5) (mynodeB)sffamily label;

          beginscope
          path [clip]
          (mynodeA.north east) --
          (mynodeA.south east) --
          (mynodeA.south west) --
          (mynodeA.north west) -- cycle
          (current bounding box.south east) --
          (current bounding box.north east) --
          (current bounding box.north west) --
          (current bounding box.south west) -- cycle;
          path [clip]
          (mynodeB.north east) --
          (mynodeB.south east) --
          (mynodeB.south west) --
          (mynodeB.north west) -- cycle
          (current bounding box.south east) --
          (current bounding box.north east) --
          (current bounding box.north west) --
          (current bounding box.south west) -- cycle;

          draw(1,0)--(1,2);
          draw(0.5,0)--(0.5,2);
          draw(0,1.8)--(2,0.5);
          endscope
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer






















          • Thank you very much. This looks like what I want. The actual picture contains 55 nodes and 120 edges which have to be clipped. I think I will use a foreach loop to to define the clippath for every node to make the code more manageable.
            – Hotschke
            3 hours ago










          • Your rputover code is actually doing something similar.
            – Ulrike Fischer
            2 hours ago












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          You can clip against the labels:



          documentclass[tikz]standalone
          begindocument

          begintikzpicture
          fill[color=blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;

          node at (1,1) (mynodeA)Largesffamily label;
          node at (0.5,1.5) (mynodeB)sffamily label;

          beginscope
          path [clip]
          (mynodeA.north east) --
          (mynodeA.south east) --
          (mynodeA.south west) --
          (mynodeA.north west) -- cycle
          (current bounding box.south east) --
          (current bounding box.north east) --
          (current bounding box.north west) --
          (current bounding box.south west) -- cycle;
          path [clip]
          (mynodeB.north east) --
          (mynodeB.south east) --
          (mynodeB.south west) --
          (mynodeB.north west) -- cycle
          (current bounding box.south east) --
          (current bounding box.north east) --
          (current bounding box.north west) --
          (current bounding box.south west) -- cycle;

          draw(1,0)--(1,2);
          draw(0.5,0)--(0.5,2);
          draw(0,1.8)--(2,0.5);
          endscope
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer














          You can clip against the labels:



          documentclass[tikz]standalone
          begindocument

          begintikzpicture
          fill[color=blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;

          node at (1,1) (mynodeA)Largesffamily label;
          node at (0.5,1.5) (mynodeB)sffamily label;

          beginscope
          path [clip]
          (mynodeA.north east) --
          (mynodeA.south east) --
          (mynodeA.south west) --
          (mynodeA.north west) -- cycle
          (current bounding box.south east) --
          (current bounding box.north east) --
          (current bounding box.north west) --
          (current bounding box.south west) -- cycle;
          path [clip]
          (mynodeB.north east) --
          (mynodeB.south east) --
          (mynodeB.south west) --
          (mynodeB.north west) -- cycle
          (current bounding box.south east) --
          (current bounding box.north east) --
          (current bounding box.north west) --
          (current bounding box.south west) -- cycle;

          draw(1,0)--(1,2);
          draw(0.5,0)--(0.5,2);
          draw(0,1.8)--(2,0.5);
          endscope
          endtikzpicture
          enddocument


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 hours ago









          Hotschke

          2,02811839




          2,02811839










          answered 3 hours ago









          Ulrike Fischer

          181k7286657




          181k7286657











          • Thank you very much. This looks like what I want. The actual picture contains 55 nodes and 120 edges which have to be clipped. I think I will use a foreach loop to to define the clippath for every node to make the code more manageable.
            – Hotschke
            3 hours ago










          • Your rputover code is actually doing something similar.
            – Ulrike Fischer
            2 hours ago
















          • Thank you very much. This looks like what I want. The actual picture contains 55 nodes and 120 edges which have to be clipped. I think I will use a foreach loop to to define the clippath for every node to make the code more manageable.
            – Hotschke
            3 hours ago










          • Your rputover code is actually doing something similar.
            – Ulrike Fischer
            2 hours ago















          Thank you very much. This looks like what I want. The actual picture contains 55 nodes and 120 edges which have to be clipped. I think I will use a foreach loop to to define the clippath for every node to make the code more manageable.
          – Hotschke
          3 hours ago




          Thank you very much. This looks like what I want. The actual picture contains 55 nodes and 120 edges which have to be clipped. I think I will use a foreach loop to to define the clippath for every node to make the code more manageable.
          – Hotschke
          3 hours ago












          Your rputover code is actually doing something similar.
          – Ulrike Fischer
          2 hours ago




          Your rputover code is actually doing something similar.
          – Ulrike Fischer
          2 hours ago










          up vote
          1
          down vote













          with drawing line in two parts?



          enter image description here



          documentclass[tikz, margin=3.141592]standalone
          begindocument
          begintikzpicture
          fill[blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
          node at (1,1) (label) Largesf label;
          draw (1,0) -- (label) (label) -- (1,2);
          endtikzpicture
          enddocument





          share|improve this answer




















          • Thanks for the answer. But that is how I created the expected output. The actual document is complicated and doing this manually is not feasible. I really look for an rputover equivalent.
            – Hotschke
            3 hours ago










          • margin=3.14 - - > :)
            – Dr. Manuel Kuehner
            24 mins ago














          up vote
          1
          down vote













          with drawing line in two parts?



          enter image description here



          documentclass[tikz, margin=3.141592]standalone
          begindocument
          begintikzpicture
          fill[blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
          node at (1,1) (label) Largesf label;
          draw (1,0) -- (label) (label) -- (1,2);
          endtikzpicture
          enddocument





          share|improve this answer




















          • Thanks for the answer. But that is how I created the expected output. The actual document is complicated and doing this manually is not feasible. I really look for an rputover equivalent.
            – Hotschke
            3 hours ago










          • margin=3.14 - - > :)
            – Dr. Manuel Kuehner
            24 mins ago












          up vote
          1
          down vote










          up vote
          1
          down vote









          with drawing line in two parts?



          enter image description here



          documentclass[tikz, margin=3.141592]standalone
          begindocument
          begintikzpicture
          fill[blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
          node at (1,1) (label) Largesf label;
          draw (1,0) -- (label) (label) -- (1,2);
          endtikzpicture
          enddocument





          share|improve this answer












          with drawing line in two parts?



          enter image description here



          documentclass[tikz, margin=3.141592]standalone
          begindocument
          begintikzpicture
          fill[blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
          node at (1,1) (label) Largesf label;
          draw (1,0) -- (label) (label) -- (1,2);
          endtikzpicture
          enddocument






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 4 hours ago









          Zarko

          115k864153




          115k864153











          • Thanks for the answer. But that is how I created the expected output. The actual document is complicated and doing this manually is not feasible. I really look for an rputover equivalent.
            – Hotschke
            3 hours ago










          • margin=3.14 - - > :)
            – Dr. Manuel Kuehner
            24 mins ago
















          • Thanks for the answer. But that is how I created the expected output. The actual document is complicated and doing this manually is not feasible. I really look for an rputover equivalent.
            – Hotschke
            3 hours ago










          • margin=3.14 - - > :)
            – Dr. Manuel Kuehner
            24 mins ago















          Thanks for the answer. But that is how I created the expected output. The actual document is complicated and doing this manually is not feasible. I really look for an rputover equivalent.
          – Hotschke
          3 hours ago




          Thanks for the answer. But that is how I created the expected output. The actual document is complicated and doing this manually is not feasible. I really look for an rputover equivalent.
          – Hotschke
          3 hours ago












          margin=3.14 - - > :)
          – Dr. Manuel Kuehner
          24 mins ago




          margin=3.14 - - > :)
          – Dr. Manuel Kuehner
          24 mins ago










          up vote
          1
          down vote













          Just for completeness: this is a version which also takes into account rounded corners or, more generally, arbitrary node shapes. And it spares you from typing a lot of coordinates.



          documentclass[tikz]standalone
          usetikzlibraryshapes.geometric
          makeatletter % https://tex.stackexchange.com/a/38995/121799
          tikzset
          use path/.code=pgfsyssoftpath@setcurrentpath#1

          makeatother
          tikzsetremember path/.style=save path=tmprotect
          % https://tex.stackexchange.com/a/12033/121799
          tikzsetreverseclip/.style=insert path=(current bounding box.north
          east) rectangle (current bounding box.south west)

          begindocument
          begintikzpicture
          fill[blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
          node[remember path,font=Largesf] at (1,1) label;
          clip[use path=tmprotect,reverseclip];
          draw(1,0)--(1,2);
          endtikzpicture

          begintikzpicture
          fill[blue!40] (-1,0) rectangle (3,4);
          fill[red] plot [smooth] coordinates (-1,4)(0,2)(1,1)(2,2)(3,4) -- cycle;
          node[remember path,font=Largesf,rounded corners] at (1,1) label;
          clip[use path=tmprotect,reverseclip];
          node[remember path,font=Largesf,shape=diamond] at (2,2) label 3;
          clip[use path=tmprotect,reverseclip];
          node[remember path,font=Largesf,shape=ellipse] at (0,2) label 2;
          clip[use path=tmprotect,reverseclip];
          fill[gray,opacity=0.2] (-1,0) rectangle (3,4);
          draw [blue,thick] (-1,4) -- (1,0) -- (3,4);
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer




















          • +1: Great! Is tmprotect already predefined?
            – Dr. Manuel Kuehner
            25 mins ago






          • 1




            @Dr.ManuelKuehner No, only here.
            – marmot
            14 mins ago














          up vote
          1
          down vote













          Just for completeness: this is a version which also takes into account rounded corners or, more generally, arbitrary node shapes. And it spares you from typing a lot of coordinates.



          documentclass[tikz]standalone
          usetikzlibraryshapes.geometric
          makeatletter % https://tex.stackexchange.com/a/38995/121799
          tikzset
          use path/.code=pgfsyssoftpath@setcurrentpath#1

          makeatother
          tikzsetremember path/.style=save path=tmprotect
          % https://tex.stackexchange.com/a/12033/121799
          tikzsetreverseclip/.style=insert path=(current bounding box.north
          east) rectangle (current bounding box.south west)

          begindocument
          begintikzpicture
          fill[blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
          node[remember path,font=Largesf] at (1,1) label;
          clip[use path=tmprotect,reverseclip];
          draw(1,0)--(1,2);
          endtikzpicture

          begintikzpicture
          fill[blue!40] (-1,0) rectangle (3,4);
          fill[red] plot [smooth] coordinates (-1,4)(0,2)(1,1)(2,2)(3,4) -- cycle;
          node[remember path,font=Largesf,rounded corners] at (1,1) label;
          clip[use path=tmprotect,reverseclip];
          node[remember path,font=Largesf,shape=diamond] at (2,2) label 3;
          clip[use path=tmprotect,reverseclip];
          node[remember path,font=Largesf,shape=ellipse] at (0,2) label 2;
          clip[use path=tmprotect,reverseclip];
          fill[gray,opacity=0.2] (-1,0) rectangle (3,4);
          draw [blue,thick] (-1,4) -- (1,0) -- (3,4);
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer




















          • +1: Great! Is tmprotect already predefined?
            – Dr. Manuel Kuehner
            25 mins ago






          • 1




            @Dr.ManuelKuehner No, only here.
            – marmot
            14 mins ago












          up vote
          1
          down vote










          up vote
          1
          down vote









          Just for completeness: this is a version which also takes into account rounded corners or, more generally, arbitrary node shapes. And it spares you from typing a lot of coordinates.



          documentclass[tikz]standalone
          usetikzlibraryshapes.geometric
          makeatletter % https://tex.stackexchange.com/a/38995/121799
          tikzset
          use path/.code=pgfsyssoftpath@setcurrentpath#1

          makeatother
          tikzsetremember path/.style=save path=tmprotect
          % https://tex.stackexchange.com/a/12033/121799
          tikzsetreverseclip/.style=insert path=(current bounding box.north
          east) rectangle (current bounding box.south west)

          begindocument
          begintikzpicture
          fill[blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
          node[remember path,font=Largesf] at (1,1) label;
          clip[use path=tmprotect,reverseclip];
          draw(1,0)--(1,2);
          endtikzpicture

          begintikzpicture
          fill[blue!40] (-1,0) rectangle (3,4);
          fill[red] plot [smooth] coordinates (-1,4)(0,2)(1,1)(2,2)(3,4) -- cycle;
          node[remember path,font=Largesf,rounded corners] at (1,1) label;
          clip[use path=tmprotect,reverseclip];
          node[remember path,font=Largesf,shape=diamond] at (2,2) label 3;
          clip[use path=tmprotect,reverseclip];
          node[remember path,font=Largesf,shape=ellipse] at (0,2) label 2;
          clip[use path=tmprotect,reverseclip];
          fill[gray,opacity=0.2] (-1,0) rectangle (3,4);
          draw [blue,thick] (-1,4) -- (1,0) -- (3,4);
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer












          Just for completeness: this is a version which also takes into account rounded corners or, more generally, arbitrary node shapes. And it spares you from typing a lot of coordinates.



          documentclass[tikz]standalone
          usetikzlibraryshapes.geometric
          makeatletter % https://tex.stackexchange.com/a/38995/121799
          tikzset
          use path/.code=pgfsyssoftpath@setcurrentpath#1

          makeatother
          tikzsetremember path/.style=save path=tmprotect
          % https://tex.stackexchange.com/a/12033/121799
          tikzsetreverseclip/.style=insert path=(current bounding box.north
          east) rectangle (current bounding box.south west)

          begindocument
          begintikzpicture
          fill[blue!40] (0,0) rectangle (2,2);
          fill[red] plot [smooth] coordinates (0,2)(1,1)(2,2) -- cycle;
          node[remember path,font=Largesf] at (1,1) label;
          clip[use path=tmprotect,reverseclip];
          draw(1,0)--(1,2);
          endtikzpicture

          begintikzpicture
          fill[blue!40] (-1,0) rectangle (3,4);
          fill[red] plot [smooth] coordinates (-1,4)(0,2)(1,1)(2,2)(3,4) -- cycle;
          node[remember path,font=Largesf,rounded corners] at (1,1) label;
          clip[use path=tmprotect,reverseclip];
          node[remember path,font=Largesf,shape=diamond] at (2,2) label 3;
          clip[use path=tmprotect,reverseclip];
          node[remember path,font=Largesf,shape=ellipse] at (0,2) label 2;
          clip[use path=tmprotect,reverseclip];
          fill[gray,opacity=0.2] (-1,0) rectangle (3,4);
          draw [blue,thick] (-1,4) -- (1,0) -- (3,4);
          endtikzpicture
          enddocument


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 1 hour ago









          marmot

          70.5k476151




          70.5k476151











          • +1: Great! Is tmprotect already predefined?
            – Dr. Manuel Kuehner
            25 mins ago






          • 1




            @Dr.ManuelKuehner No, only here.
            – marmot
            14 mins ago
















          • +1: Great! Is tmprotect already predefined?
            – Dr. Manuel Kuehner
            25 mins ago






          • 1




            @Dr.ManuelKuehner No, only here.
            – marmot
            14 mins ago















          +1: Great! Is tmprotect already predefined?
          – Dr. Manuel Kuehner
          25 mins ago




          +1: Great! Is tmprotect already predefined?
          – Dr. Manuel Kuehner
          25 mins ago




          1




          1




          @Dr.ManuelKuehner No, only here.
          – marmot
          14 mins ago




          @Dr.ManuelKuehner No, only here.
          – marmot
          14 mins ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f457857%2ftikz-equivalent-for-pst-rputover%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery