I'm trying to draw on LaTeX some steps of a demonstration of the Residue Theorem, and I wanted to explicitly show what are the contour and the poles that I'm using. Using the Tikz package, I was able to draw the contour and the poles, with the method shown below:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows, decorations.markings, calc}
\begin{document}
\begin{tikzpicture}[>=stealth]
% axis
\draw -> -- (-3.6,4) node[above]{$\Im(z)$};
\draw -> -- (3,0) node[right]{$\Re(z)$};
% irregular shape
\draw plot[smooth, tension=.9, very thick] coordinates {(-3.5,2.5) (-3,3.2) (-2.4, 3.3) (-1,3.7) (0,3.4) (2,3.9) (2.5,3.5) (3,2.5) (2.5,0.2) (0,0.7) (-3,0.2) (-3.5,2.5)}[postaction={decorate,
decoration={markings,
mark=between positions -3.5 and 3 step 0.25 with {\arrow{<};}}}];
% poles
\path[draw, postaction={decorate,
decoration={markings,
mark=between positions 0.2 and 1 step 0.33 with {\arrow{<};}}}]
(-2,1.3) arc (0:360:0.4) --cycle;
\path[draw, postaction={decorate,
decoration={markings,
mark=between positions 0.2 and 1 step 0.33 with {\arrow{<};}}}]
(0,2.5) arc (0:360:0.4) --cycle;
\path[draw, postaction={decorate,
decoration={markings,
mark=between positions 0.2 and 1 step 0.33 with {\arrow{<};}}}]
(1.9,1.7) arc (0:360:0.4) --cycle;
\end{tikzpicture}
\end{document}
The only thing left to do is connect the contour with the poles inside it, like that
and I don't know how to do it. At first thought I considered manually trace the lines between the contour and the poles and erase the inner areas between two lines, but it looks like a lot of work for something that can be more simple. Is this the only way to do that or there is a more efficient way?


