我正在尝试解决寻找 A 赞美的问题,为此我需要遮蔽 A 圈之外的所有内容。但是,我遇到了很多麻烦,如果有人可以告诉我如何做或指出正确的方向,我将不胜感激:
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{fullpage}
\usepackage{tikz}
\def \setA { (-11,-5) circle (1cm) }
\def \setB { (-9.5,-5) circle (1cm) }
\def \setC { (-12 ,-8) circle (1cm) }
\def \rectangle { (-15,-10) rectangle (-5,-3) }
\begin{document}
\title{ \bfseries Statistics and Probability for Engineers \\ Assignment \#1 }
\maketitle
\begin{enumerate}
\item
\begin{enumerate}
\item
\begin{tikzpicture}
\draw \rectangle ;
\draw \setA node[below left] {$A$};
\draw \setB node[below left] {$B$};
\draw \setC node[below left] {$C$};
\clip \setB
\clip \setC
\fill[gray] \rectangle
\end{tikzpicture}
\end{enumerate}
\end{enumerate}
\end{document}
答案1
可能是這樣嗎?
\documentclass[12pt]{article}
\usepackage{tikz}
\def \setA { (-11,-5) circle (1cm) }
\def \setB { (-9.5,-5) circle (1cm) }
\def \setC { (-12 ,-8) circle (1cm) }
\def \rectangle { (-15,-10) rectangle (-5,-3) }
\begin{document}
\begin{tikzpicture}
\draw[fill=olive!20] \rectangle ;
\fill[white] \setA;
\draw[fill=olive!20] \setB node[below left] {$B$};
\draw \setA node[below left] {$A$};
\draw \setC node[below left] {$C$};
\end{tikzpicture}
\end{document}
要填充交叉点,您可以使用\clip
:
\documentclass[12pt]{article}
\usepackage{tikz}
\def \setA { (-11,-5) circle (1cm) }
\def \setB { (-9.5,-5) circle (1cm) }
\def \setC { (-12 ,-8) circle (1cm) }
\def \rectangle { (-15,-10) rectangle (-5,-3) }
\begin{document}
\begin{tikzpicture}
\draw \rectangle ;
\draw \setA node[below left] {$A$}
\setB node[below left] {$B$};
\draw \setC node[below left] {$C$};
\clip \setB;
\fill[olive] \setA;
\end{tikzpicture}
\end{document}