Topnush
Take this code:
```
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% Define the circles with transparency and borders
\begin{scope}[opacity=0.3]
\fill[blue] (0,0) circle (2);
\fill[red] (2,0) circle (2);
\end{scope}
% Add black borders to circles
\draw[black, thin] (0,0) circle (2);
\draw[black, thin] (2,0) circle (2);
% Label the sets (centered above circles)
\node at (0,2.3) {$A$};
\node at (2,2.3) {$B$};
\end{tikzpicture}
\end{document}
```
I would like to highlight the border of the intersection and separately the union. How can I do that?
This will ultimately be two transitions in a beamer presentation.
Top Answer
samcarter
You can use `\clip` to highlight various sections of the border:
```
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% Define the circles with transparency and borders
\begin{scope}[opacity=0.3]
\fill[blue] (0,0) circle (2);
\fill[red] (2,0) circle (2);
\end{scope}
% Add black borders to circles
\draw[black, thin] (0,0) circle (2);
\draw[black, thin] (2,0) circle (2);
% Label the sets (centered above circles)
\node at (0,2.3) {$A$};
\node at (2,2.3) {$B$};
\begin{scope}
\clip (-2.1,-2.1) rectangle (1,2.1);
\draw[yellow, ultra thick] (0,0) circle (2);
\end{scope}
\begin{scope}
\clip (0,0) circle (2);
\draw[green, ultra thick] (2,0) circle (2);
\end{scope}
\end{tikzpicture}
\end{document}
```
![document-1.png](/image?hash=76499c478478d6dd6bd15b4d9d607df9c0bd4dddf0812b2dcc9e77161b683438)