This is an expanded version of an example provided by T. Tantau
Edit and compile if you like:
\documentclass{article} % Set operations illustrated with Venn diagrams % Author: Uwe Ziegenhagen % This is an expanded version of an example provided by T. Tantau \usepackage{tikz} \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{5pt}% \begin{document} % Definition of circles \def\firstcircle{(0,0) circle (1.5cm)} \def\secondcircle{(0:2cm) circle (1.5cm)} \colorlet{circle edge}{blue!50} \colorlet{circle area}{blue!20} \tikzset{filled/.style={fill=circle area, draw=circle edge, thick}, outline/.style={draw=circle edge, thick}} \setlength{\parskip}{5mm} % Set A and B \begin{tikzpicture} \begin{scope} \clip \firstcircle; \fill[filled] \secondcircle; \end{scope} \draw[outline] \firstcircle node {$A$}; \draw[outline] \secondcircle node {$B$}; \node[anchor=south] at (current bounding box.north) {$A \cap B$}; \end{tikzpicture} %Set A or B but not (A and B) also known a A xor B \begin{tikzpicture} \draw[filled, even odd rule] \firstcircle node {$A$} \secondcircle node{$B$}; \node[anchor=south] at (current bounding box.north) {$\overline{A \cap B}$}; \end{tikzpicture} % Set A or B \begin{tikzpicture} \draw[filled] \firstcircle node {$A$} \secondcircle node {$B$}; \node[anchor=south] at (current bounding box.north) {$A \cup B$}; \end{tikzpicture} % Set A but not B \begin{tikzpicture} \begin{scope} \clip \firstcircle; \draw[filled, even odd rule] \firstcircle node {$A$} \secondcircle; \end{scope} \draw[outline] \firstcircle \secondcircle node {$B$}; \node[anchor=south] at (current bounding box.north) {$A - B$}; \end{tikzpicture} % Set B but not A \begin{tikzpicture} \begin{scope} \clip \secondcircle; \draw[filled, even odd rule] \firstcircle \secondcircle node {$B$}; \end{scope} \draw[outline] \firstcircle node {$A$} \secondcircle; \node[anchor=south] at (current bounding box.north) {$B - A$}; \end{tikzpicture} \end{document}
Click to download: set-operations-illustrated-with-venn-diagrams.tex • set-operations-illustrated-with-venn-diagrams.pdf
Open in Overleaf: set-operations-illustrated-with-venn-diagrams.tex