Tikz equivalent for pst-rputover
Clash 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
The expected output should be
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:
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 andpsclip
to remove the parts of the objects in the argument ofcoverable
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
add a comment |Â
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
The expected output should be
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:
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 andpsclip
to remove the parts of the objects in the argument ofcoverable
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
add a comment |Â
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
The expected output should be
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:
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 andpsclip
to remove the parts of the objects in the argument ofcoverable
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
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
The expected output should be
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:
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 andpsclip
to remove the parts of the objects in the argument ofcoverable
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
tikz-pgf transparency
edited 2 hours ago
asked 5 hours ago
Hotschke
2,02811839
2,02811839
add a comment |Â
add a comment |Â
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
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
add a comment |Â
up vote
1
down vote
with drawing line in two parts?
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
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 anrputover
equivalent.
– Hotschke
3 hours ago
margin=3.14 - - > :)
– Dr. Manuel Kuehner
24 mins ago
add a comment |Â
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
+1: Great! Is tmprotect already predefined?
– Dr. Manuel Kuehner
25 mins ago
1
@Dr.ManuelKuehner No, only here.
– marmot
14 mins ago
add a comment |Â
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
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
add a comment |Â
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
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
add a comment |Â
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
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
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
add a comment |Â
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
add a comment |Â
up vote
1
down vote
with drawing line in two parts?
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
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 anrputover
equivalent.
– Hotschke
3 hours ago
margin=3.14 - - > :)
– Dr. Manuel Kuehner
24 mins ago
add a comment |Â
up vote
1
down vote
with drawing line in two parts?
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
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 anrputover
equivalent.
– Hotschke
3 hours ago
margin=3.14 - - > :)
– Dr. Manuel Kuehner
24 mins ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
with drawing line in two parts?
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
with drawing line in two parts?
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
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 anrputover
equivalent.
– Hotschke
3 hours ago
margin=3.14 - - > :)
– Dr. Manuel Kuehner
24 mins ago
add a comment |Â
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 anrputover
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
add a comment |Â
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
+1: Great! Is tmprotect already predefined?
– Dr. Manuel Kuehner
25 mins ago
1
@Dr.ManuelKuehner No, only here.
– marmot
14 mins ago
add a comment |Â
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
+1: Great! Is tmprotect already predefined?
– Dr. Manuel Kuehner
25 mins ago
1
@Dr.ManuelKuehner No, only here.
– marmot
14 mins ago
add a comment |Â
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
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
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
add a comment |Â
+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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password