剪切路径命令不允许使用额外选项

剪切路径命令不允许使用额外选项

使用下面的代码时,我遇到extra options not allowed for clipping path command错误,我该如何解决?

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\begin{scope}
    \clip[draw=black,postaction={fill=black, draw=white, line width=6mm}] (58,77) rectangle +(9,9);
    \clip[postaction={fill=black, line width=6mm}] (61,80) rectangle +(3,3);
    \end{scope}
\end{tikzpicture}
\end{document}

答案1

只需使用preaction

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\begin{scope}
    \path[preaction={clip},draw=black,postaction={fill=black, draw=white, line width=6mm}] (58,77) rectangle +(9,9);
    \clip[postaction={fill=black, line width=6mm}] (61,80) rectangle +(3,3);
    \end{scope}
\end{tikzpicture}
\end{document}

如果preaction被占用,请记住preaction可以嵌套。例如

preaction={preaction={scale=1.1},rotate=10}

相关内容