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}
\begin{document}
\begin{tikzpicture}
\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) {\Large\sf label};
\end{tikzpicture}
\end{document}
The expected output should be
I am evaluating following options in tikz:
- draw/fill/text opacity
- transparency groups
\begin{scope}
\begin{pgfonlayer}
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 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.
Related questions