标题说明了一切,以下是代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,backgrounds}
\begin{document}
\def\lcirc2{(-.7,-.5) circle (1cm)}
\def\rcirc2{(.7,-.5) circle (1cm)}
\def\ucirc{(0,.5) circle (1cm)}
\def\rect{(-2.5,-1.8) rectangle (2.5,1.8)}
\begin{tikzpicture}
\begin{scope}
\clip \rcirc2;
\fill[gray] \rcirc2;
\fill[white] \lcirc2;
\fill[gray] \ucirc;
\end{scope}
\begin{scope}
\clip \lcirc2;
\fill[gray] \lcirc2;
\fill[white] \rcirc2;
\end{scope}
\begin{scope}
\clip \ucirc;
\fill[gray] \ucirc;
\end{scope}
\draw \rect;
\draw \lcirc2;
\draw \rcirc2;
\draw \ucirc;
\draw (0,2.1) node {$(A\bigtriangleup B)\bigtriangleup C$};
\draw (0,-.2) node {$X$};
\end{tikzpicture}
\end{document}
我需要在每个圆圈之外单独给 X 涂上灰色。提前致谢。
答案1
“大三角形”符号通常表示“对称差异”。假设这是正确的,这是使用奇偶填充规则的一个很好的例子:
\documentclass[border=0.4in]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\firstcircle{(90:1.8) circle[radius = 2.4]}
\def\secondcircle{(210:1.8) circle[radius = 2.4]}
\def\thirdcircle{(330:1.8) circle[radius = 2.4]}
\draw (0, 5.5) node {\Large $(A \bigtriangleup B) \bigtriangleup C$};
\draw[thick] (-5, -3.7) rectangle (5, 4.6);
\fill[even odd rule, gray] \firstcircle \secondcircle \thirdcircle;
\draw[thick] \firstcircle \secondcircle \thirdcircle;
\node[fill = white, shape = circle] (0,0) {$X$};
\end{tikzpicture}
\end{document}