1

I would like to modify the black curve in order to include the red dashed line that now is left outside. The arc around the origin should instead be around the red point in the lower-half of the complex plane.

\documentclass[8pt,usenames,dvipsnames]{beamer}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings}

\begin{document}        
\begin{figure}
\centering
\begin{tikzpicture}[scale=0.7, every node/.style={scale=0.85}]
% Configurable parameters
\def\gap{0.2}
\def\bigradius{3}
\def\littleradius{0.25}
% Axes
\draw [help lines,->] (-1.25*\bigradius, 0) -- (1.25*\bigradius,0);
\draw [help lines,->] (0, -1.25*\bigradius) -- (0, 1.25*\bigradius);
% Path
\draw[line width=1pt,   decoration={ markings,
  mark=at position 0.2455 with {\arrow[line width=0.9pt]{>}},
  mark=at position 0.765 with {\arrow[line width=0.9pt]{>}},
  mark=at position 0.87 with {\arrow[line width=0.9pt]{>}},
  mark=at position 0.97 with {\arrow[line width=0.9pt]{>}}},
  postaction={decorate}]
  let
     \n1 = {asin(\gap/2/\bigradius)},
     \n2 = {asin(\gap/2/\littleradius)}
  in (\n1:\bigradius) arc (\n1:360-\n1:\bigradius)
  -- (-\n2:\littleradius) arc (-\n2:-360+\n2:\littleradius)
  -- cycle;
 \filldraw [red] (1,0) circle (2pt);
 \filldraw [red] (0.5,-1) circle (2pt);
\draw[red, dashed] (1,0) -- (1.25*\bigradius,0);
\draw[red, dashed] (1,0) -- (0.5,-1);
%Labels
\node at (3.6,-0.4){$\Re(z)$};
\node at (-0.6,3.53) {$\Im(z)$};
\end{tikzpicture}
\end{figure}

\end{document}

1 Answer 1

2

Welcome! The calc library, which you are loading, allows one to construct points at a given distance from a line. So the steps in the following code are:

  1. Name the red dots.
  2. Construct segments of lines which are parallel to the segments of the red, dashed line but shifted left or right by half the gap width.
  3. Use the intersections of these auxiliary lines to construct the path, and rotate the small arc according to the slope of the corresponding line stretch.

\documentclass[8pt,usenames,dvipsnames]{beamer}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings}
\DeclareMathOperator{\re}{Re}
\DeclareMathOperator{\im}{Im}
\begin{document} 
\begin{frame}[t]
\frametitle{A contour}
\begin{figure}
\centering
\begin{tikzpicture}[scale=0.7, every node/.style={scale=0.85},
dot/.style={circle,fill,inner sep=1pt}]
% Configurable parameters
\def\gap{0.2cm}
\def\bigradius{3cm}
\def\littleradius{0.25cm}
% Axes
\draw [help lines,->] (-1.25*\bigradius, 0) -- (1.25*\bigradius,0);
\draw [help lines,->] (0, -1.25*\bigradius) -- (0, 1.25*\bigradius);
% red path
\draw[red, dashed]  (0.5,-1) node[dot] (c1) {} --(1,0) node[dot] (c2){} 
-- (1.25*\bigradius,0) coordinate (c3);
\path let \p1=($(c2)-(c1)$), \n1={atan2(\y1,\x1)} in
 ($(c1)+(\n1:\gap/2+\littleradius/2)$) coordinate (c1')
 ($(c1')!\gap/2!90:(c2)$) coordinate (l1)
 ($(c2)!\gap/2!-90:(c1)$) coordinate (l2)
 ($(c2)!\gap/2!90:(c3)$) coordinate (l2')
 ($(c3)!\gap/2!-90:(c2)$) coordinate (l3)
 ($(c1')!\gap/2!-90:(c2)$) coordinate (r1)
 ($(c2)!\gap/2!90:(c1)$) coordinate (r2)
 ($(c2)!\gap/2!-90:(c3)$) coordinate (r2')
 ($(c3)!\gap/2!90:(c2)$) coordinate (r3);
% Path
\draw[line width=1pt,   decoration={ markings,
  mark=at position 0.06 with {\arrow[line width=0.9pt]{>}},
  mark=at position 0.2455 with {\arrow[line width=0.9pt]{>}},
  mark=at position 0.84 with {\arrow[line width=0.9pt]{>}},
  mark=at position 0.939 with {\arrow[line width=0.9pt]{>}}
  },
  postaction={decorate}]
  let
     \n1 = {asin(\gap/2/\bigradius)},
     \n2 = {asin(\gap/2/\littleradius)},
     \p1=($(c2)-(c1)$),
     \n3={atan2(\y1,\x1)}
  in (intersection of l1--l2 and l2'--l3) -- (\n1:\bigradius) 
  arc[start angle=\n1,end angle=360-\n1,radius=\bigradius]
  -- (intersection of r1--r2 and r2'--r3)
  -- (r1) 
  arc[start angle=-\n2+\n3,end angle=-360+\n2+\n3,radius=\littleradius]
  -- cycle
  ;

%Labels
\node at (3.6,-0.4){$\re(z)$};
\node at (-0.6,3.53) {$\im(z)$};
\end{tikzpicture}
\end{figure}
\end{frame}       
\end{document}

enter image description here

EDIT: I adjusted the positions of the arrows.

Obviously one could make the arrow heads nicer, and perhaps even bend them, but I am not sure if you want to keep the current ones.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .