0

Could someone please help me draw this contour enter image description here

except without the O, O1, and O2 lines. Unfortunately, I don't have access to the source tex and I'm rather inexperienced with tikz.

2
1

How about this? A few circles, ellipses, clips and you have it. I did (almost) everything with parameters, so you can change the dimensions as you need.

However, it is probably not the best example for your first tikz drawing.

\documentclass [tikz, border=2mm]{standalone}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{tikzpicture}[line cap=round,line join=round]
  % Arrow for the ellipse
  \tikzstyle{arrowe}=[red, decoration={markings,mark=at position 0.45 with {\arrow[scale=1.5,>=stealth]{<}}},postaction={decorate}]
  % Arros for the arc
  \tikzstyle{arrowb}=[red, decoration={markings,mark=at position 0.75 with {\arrow[scale=1.5,>=stealth]{>}}},postaction={decorate}]
  % parameters
  \def\a {0.6}  % ellipse x-axis
  \def\b {1}    % ellipse y-axis
  \def\x {6}    % x distance between ellipses
  \def\y {4}    % y distance between ellipses
  \def\w {1.75} % width (at the middle section)
  \def\xt{0.15} % x of tanget point
  \pgfmathsetmacro\yt{\b/\a*sqrt(\a*\a-\xt*\xt)} % y of tangent point
  \pgfmathsetmacro\m {(\a*\a*\yt)/(\b*\b*\xt)}   % normal slope
  \pgfmathsetmacro\yc{\y+\b+\yt+\m*(\x-\xt)}     % arc center
  \pgfmathsetmacro\r {sqrt((\x-\xt)*(\x-\xt)+(\y+\yt-\yc)*(\y+\yt-\yc))} % arc radius
  \pgfmathsetmacro\h {\yc-\r} % height (at the middle section)
  \pgfmathsetmacro\aa{\x-\w}  % semiellipse x-axis
  \pgfmathsetmacro\bb{\y-\b}  % semiellipse y-axis
  % red lines parameters
  \def\rl{4}   % little arc radius
  \def\rb{18}  % big arc radius
  \def\s {0.5} % distance red and black semiellipses
  \pgfmathsetmacro\yl{sqrt(\rl*\rl-\w*\w)} % little arc center
  \pgfmathsetmacro\xb{sqrt(\rb*\rb-\h*\h)} % big arc center
  \pgfmathsetmacro\ar{\x-\w+\s}            % red semiellipse x-axis
  
  % red lines (except for semiellipse)
  \begin{scope}
    \clip (-\x,-\y) rectangle (\x,0);
    \draw[arrowb] (0,\yl) circle (\rl cm);
  \end{scope}
  \begin{scope}
    \clip (0,-\h) rectangle (\x,\h);
    \draw[arrowb](-\xb,0) circle (\rb cm);
  \end{scope}
  
  % ellipses
  \foreach\i/\j in {-\x/-\y, -\x/\y, \x/-\y, \x/\y}
  {
    \draw (\i,\j) ellipse (\a cm and \b cm);
  }
  
  % arcs and semiellipses
  \begin{scope}
    \clip (\x-\xt,\y+\yt)   -- (-\x+\xt,\y+\yt) -- (-\x,\y-\b) -- (-\x,-\y+\b) --
          (-\x+\xt,-\y-\yt) -- (\x-\xt,-\y-\yt) -- (\x,-\y+\b) -- (\x,\y-\b)   -- cycle;
    \draw[arrowe] (\x,0) ellipse (\ar cm and \bb cm); % red semiellipse
    \draw (-\x,0) ellipse (\aa cm and \bb cm);
    \draw ( \x,0) ellipse (\aa cm and \bb cm);
    \draw (0, \yc) circle (\r cm);
    \draw (0,-\yc) circle (\r cm);
  \end{scope}
  
  % labels
  \node at (0,\h)  [above] {$i\pi$};
  \node at (0,-\h) [below] {$-i\pi\phantom{-}$};
  \node[red] at (0  ,-0.1) {$A$};
  \node[red] at (1.6, 1.5) {$B$};
\end{tikzpicture}
\end{document}

With this tikz code you get the following contour. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.