I'm trying to employ the extremely cool inverted clipping from this question in combination with reusage of named paths with the use path key I stole from this question. However, it seems like my cargo-cult skills of stealing TikZ code from stackexchange are insufficient here, because in the MWE I constructed, the inversion of the clipping does not work as expected:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\tikzset{invclip/.style={clip,insert path={{[reset cm]
(-16383.99999pt,-16383.99999pt) rectangle (16383.99999pt,16383.99999pt)
}}}}
\makeatletter
\tikzset{
use path for main/.code={%
\tikz@addmode{%
\expandafter\pgfsyssoftpath@setcurrentpath\csname tikz@intersect@path@name@#1\endcsname
}%
},
use path for actions/.code={%
\expandafter\def\expandafter\tikz@preactions\expandafter{\tikz@preactions\expandafter\let\expandafter\tikz@actions@path\csname tikz@intersect@path@name@#1\endcsname}%
},
use path/.style={%
use path for main=#1,
use path for actions=#1,
}
}
\makeatother
\begin{tikzpicture}[outer sep=0mm]
\coordinate (A) at (-1,-1);
\coordinate (B) at (1,-1);
\coordinate (C) at (1,1);
\coordinate (D) at (-1,1);
\path[draw=black,name path=P] (A) -- (B) -- (C) -- (D) --cycle;
\begin{scope}
\begin{pgfinterruptboundingbox} % useful to avoid the rectangle in the bounding box
\path[invclip] (A) -- (B) -- (C) -- (D); % works just fine
%\path[invclip,use path=P]; % doesn't work at all
\end{pgfinterruptboundingbox}
\fill[orange!50] (-2,-2) rectangle (2,2);
\end{scope}
\end{tikzpicture}
\end{document}
This works just fine:
But this doesn't work:
How can I use inverted clipping with use path?


even odd rule? – cfr Jul 20 '17 at 00:29rectangleand specify it explicitly. At least, that's what I found. – cfr Jul 20 '17 at 00:52rectangleseems to conflict withinvclip. – cfr Jul 20 '17 at 11:58pgfplotshere, either. – cfr Jul 20 '17 at 12:18spaththat helps you connect two or more paths into one. In this case, you are connecting a huge rectangle with whatever complicated path you used to have. After all this is a matter of softpath operation. – Symbol 1 Jul 20 '17 at 12:48spath3? – cfr Jul 23 '17 at 01:55spath3is in TeX Live, on CTAN etc., so it is as standard as most packages. – cfr Jul 23 '17 at 09:38