如何删除 tikz 中轮廓形状外的字母

如何删除 tikz 中轮廓形状外的字母

我希望删除字母中位于形成下方大脑形状的轮廓之外的部分。

在此处输入图片描述

\documentclass[10pt]{standalone}
\usepackage{pgf,tikz}
\usepackage{libertine}

\begin{document}

 \begin{tikzpicture}

 \draw(11.61697,6.215) node {\scalebox{13.6}{\color{purple!77}math} \scalebox{6.915}{\color{gray}\&} };
 \draw(11.7,3) node {\scalebox{14.7}{\color{gray} physics}};
 \draw(10.7,.32) node {\scalebox{8.59}{\color{cyan!96}MATTER}};


 \draw[ line width=1.2mm] plot [smooth,tension=.6] coordinates { (11.611676609979014,-1.1158187173456824)  
    (12.557159646551849,-0.845680706896301)  
    (13.603944437043202,-0.6768444503654376)  
    (14.397474842738259,-0.42359006556914264)  
    (15.258539751045662,-0.1703356807728476)  
    (16.27155729023084,-0.10280117816050227) 
    (17.16638944984442,-0.20410293207902028) 
    (18.07810523511108,-0.13656842946667494)  
    (18.922286517765396,0.25175496055431074)  
    (19.445678913011072,1.2141216227802318)  
    (19.51321341562342,2.277790038924671)  
    (18.82098476384688,3.5778292142123185)  
    (18.230057865988858,4.371359619907376)  
    (17.740432722049352,4.793450261234534)  
    (17.520945588559233,5.418144410398729) 
    (16.778066059823434,5.840235051725887)  
    (16.305324541537015,6.38051107262465)  
    (15.579328638454303,6.6675327087271175)  
    (14.566311099269123,7.089623350054276)  
    (13.51952630877777,7.342877734850571) 
    (12.50650876959259,7.477946740075262)  
    (11.594792984325927,7.477946740075262)  
    (10.649309947753093,7.410412237462917)  
    (9.602525157261741,7.224692355278967)  
    (8.623274869382733,7.055856098748103)  
    (7.863511714993848,6.785718088298722)  
    (6.884261427114841,6.5493473291555135) 
    (5.9050111392358335,5.87400230303206)  
    (5.195898861806207,5.36749353343947)  
    (4.554321086988926,4.371359619907376)  
    (4.250415825233373,3.999919855539477)  
    (3.9465105634778186,3.6622473424777504)  
    (3.7945579326000414,3.0206695676604696)  
    (3.8452088095593004,2.3284409158839297)  
    (3.980277814783991,1.7712812693320807) 
    (4.047812317396336,1.3998415049641815) 
    (4.2166485739272,1.0115181149431958)  
    (4.3686012048049765,0.7413801044938144)  
    (4.571204712642013,0.23487133490122442) 
    (4.959528102662999,-0.1703356807728476)  
    (5.398502369643244,-0.47424094252840165)  
    (6.006312893154352,-0.5755426964469197) 
    (6.61412341666546,-0.5248918194876606)  
    (7.25570119148274,-0.47424094252840165)  
    (7.812860838034589,-0.6937280760185239)  
    (8.150533351096316,-1.1327023429987686)  
    (8.707692997648165,-1.5716766099790134)  
    (9.315503521159274,-1.8924654973876538)  
    (10.,-2.) 
    (10.919447958202474,-1.605443861285186) (11.611676609979014,-1.1158187173456824) };

 \end{tikzpicture}

\end{document}

答案1

正如符号 1 所指出的,您可以使用\clip它。一个微妙之处是 clip 不能与其他选项一起使用。因此您需要使用路径两次。有很多方法可以处理这个问题,其中之一是使用使用路径技巧这允许人们重复使用路径。其他次要问题是,你向 plot 传递了应该放入路径的选项,并且需要在 clip 之后添加节点。当然,如果 Symbol 1 发布了答案,我很乐意删除它。

\documentclass[10pt]{standalone}
\usepackage{tikz}
\usepackage{libertine}
\makeatletter % from https://tex.stackexchange.com/a/127045/121799
\tikzset{use path/.code=\tikz@addmode{\pgfsyssoftpath@setcurrentpath#1}}
\makeatother

\begin{document}

\begin{tikzpicture}
 \draw[line width=1.2mm, color=blue, fill=gray!20,save path=\pathA] plot [smooth,tension=.6] coordinates { (11.611676609979014,-1.1158187173456824)  
    (12.557159646551849,-0.845680706896301)  
    (13.603944437043202,-0.6768444503654376)  
    (14.397474842738259,-0.42359006556914264)  
    (15.258539751045662,-0.1703356807728476)  
    (16.27155729023084,-0.10280117816050227) 
    (17.16638944984442,-0.20410293207902028) 
    (18.07810523511108,-0.13656842946667494)  
    (18.922286517765396,0.25175496055431074)  
    (19.445678913011072,1.2141216227802318)  
    (19.51321341562342,2.277790038924671)  
    (18.82098476384688,3.5778292142123185)  
    (18.230057865988858,4.371359619907376)  
    (17.740432722049352,4.793450261234534)  
    (17.520945588559233,5.418144410398729) 
    (16.778066059823434,5.840235051725887)  
    (16.305324541537015,6.38051107262465)  
    (15.579328638454303,6.6675327087271175)  
    (14.566311099269123,7.089623350054276)  
    (13.51952630877777,7.342877734850571) 
    (12.50650876959259,7.477946740075262)  
    (11.594792984325927,7.477946740075262)  
    (10.649309947753093,7.410412237462917)  
    (9.602525157261741,7.224692355278967)  
    (8.623274869382733,7.055856098748103)  
    (7.863511714993848,6.785718088298722)  
    (6.884261427114841,6.5493473291555135) 
    (5.9050111392358335,5.87400230303206)  
    (5.195898861806207,5.36749353343947)  
    (4.554321086988926,4.371359619907376)  
    (4.250415825233373,3.999919855539477)  
    (3.9465105634778186,3.6622473424777504)  
    (3.7945579326000414,3.0206695676604696)  
    (3.8452088095593004,2.3284409158839297)  
    (3.980277814783991,1.7712812693320807) 
    (4.047812317396336,1.3998415049641815) 
    (4.2166485739272,1.0115181149431958)  
    (4.3686012048049765,0.7413801044938144)  
    (4.571204712642013,0.23487133490122442) 
    (4.959528102662999,-0.1703356807728476)  
    (5.398502369643244,-0.47424094252840165)  
    (6.006312893154352,-0.5755426964469197) 
    (6.61412341666546,-0.5248918194876606)  
    (7.25570119148274,-0.47424094252840165)  
    (7.812860838034589,-0.6937280760185239)  
    (8.150533351096316,-1.1327023429987686)  
    (8.707692997648165,-1.5716766099790134)  
    (9.315503521159274,-1.8924654973876538)  
    (10.,-2.) 
    (10.919447958202474,-1.605443861285186) (11.611676609979014,-1.1158187173456824) };
   \clip[use path=\pathA];
   \draw(11.61697,6.215) node {\scalebox{13.6}{\color{purple!77}math} \scalebox{6.915}{\color{gray}\&} };
   \draw(11.7,3) node {\scalebox{14.7}{\color{gray} physics}};
   \draw(10.7,.32) node {\scalebox{8.59}{\color{cyan!96}MATTER}};

 \end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容