# Drawing complex integration [duplicate]

This question already has an answer here:

Could someone help me to draw this picture

but in point (0,0) to have small circle negative oriented, like here

I am beginner with tikz and this looks to complicated for me. Any help is appreciated.

UPDATE. I used your solution (thank you very much for all) and result is next

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings}
\begin{document}

\begin{tikzpicture}
% Configurable parameters
\def\gap{0.2}

% 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[line width=1pt,   decoration={ markings,
mark=at position 0.2455 with {\arrow[line width=1.2pt]{>}},
mark=at position 0.765 with {\arrow[line width=1.2pt]{>}},
mark=at position 0.87 with {\arrow[line width=1.2pt]{>}},
mark=at position 0.97 with {\arrow[line width=1.2pt]{>}}},
postaction={decorate}]
let
-- cycle;

% The labels
\node at (3.6,-0.2){$x$};
\node at (-0.24,3.53) {$iy$};
\node at (-0.6,0.43) {$\gamma_{\varepsilon}$};
\node at (-1.8,2.8) {$\gamma_{R}$};
\node at (1.9,0.29) {$l_1$};
\node at (1.555,-0.32) {$l_2$};

\end{tikzpicture}
\end{document}


Thank you one more time for helping me.

-

## marked as duplicate by Kurt, Gonzalo Medina, hpesoj626, Thorsten, Stefan Kottwitz♦Mar 19 '13 at 6:41

Welcome to TeX.sx! You might want to have a look at: complicated paths for complex integration. It contains almost what you want. – Alexander Mar 18 '13 at 23:46
@Alexander Thanks. I saw this before 30 min, but this isn't too helpful for me (or I am wrong?) – Cortizol Mar 18 '13 at 23:49
Maybe you can explain a bit more what you have problems with and what you already tried. A minimal working example is especially appreciated here. – Alexander Mar 18 '13 at 23:53
@Alexander Yes I know for that and I understand it. Like I said, I'm am totally beginner, but I will show my "misery" work tomorrow, because now I must go to bed (it's pretty late in my country). Good night :) – Cortizol Mar 18 '13 at 23:57
It might be better to create a new question instead of modifying an already answered one. In your example just add fill=gray, so \draw[fill=gray,line width=1pt, decoration={ markings, to get the inside filled. – Alexander Mar 19 '13 at 17:17

I guess the difficult part is the red path. Here is an idea: use polar coordinates and compute the starting angle for each arc using a little of trigonometry.

Update. Another difficult part would be to put the small arrows along the red path. This requires the library decorations.markings but the specification of the position of each arrow is tricky. You can specify it as a fraction of the total length of the path (so that 0 will be the beginning and 1 the end) but it is difficult to guess the right values for the intermediate points, or you can specify them as distances in mm from the beginning of the path. These can be computed for particular values of the radii, but it is also difficult to have a general solution.

I choose the "fraction of the length" solution, and after some trial and error I got the right values:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings}
\begin{document}

\begin{tikzpicture}
% Configurable parameters
\def\gap{0.2}

% Axes
% Red path
\draw[red, thick,   decoration={ markings,
mark=at position 0.17 with {\arrow{latex}},
mark=at position 0.53 with {\arrow{latex}},
mark=at position 0.755 with {\arrow{latex}},
mark=at position 0.955 with {\arrow{latex}}},
postaction={decorate}]
let
-- cycle;
\end{tikzpicture}
\end{document}


Edit: my initial answer used atan2(radius,gap/2) to find the angles, but I realized that the right formula should be asin(gap/2/radius). For such small angles the difference is almost unnoticeable, but it what is right, is right :-)

-
Thank you very much for this :) – Cortizol Mar 19 '13 at 7:34

With PSTricks.

\documentclass[pstricks,border=12pt]{standalone}

\psset
{
PointName=none,
PointSymbol=none,
linecap=1,
linecolor=red,
}

\def\Angle{2.5}

\begin{document}
\begin{pspicture}[showgrid=false](-3,-3)(3,3)
\psaxes[labels=none,ticks=none,linecolor=gray]{->}(0,0)(-3,-3)(2.7,2.7)[$\textbf{Re}\, z$,-90][$\textbf{Im}\, z$,180]
\pstGeonode
(0,0){O}
\pstArcOAB[arrows=->,arcsepB=-3pt]{O}{A}{B}
\pstArcOAB[arrows=->,arcsepB=-3pt]{O}{B}{C}
\pstArcOAB{O}{C}{D}
\pstLineAB[ArrowInside=->]{D}{E}
\pstArcnOAB{O}{E}{F}
\pstLineAB[ArrowInside=->]{F}{A}
%labeling
\psset{labelsep=2pt}
\uput[45](\Radius;45){$\Gamma$}
\uput[135](\radius;135){$\gamma$}
\uput[-45](\Radius;0){$R$}
\uput[-135](\Radius;180){$-R$}
\end{pspicture}
\end{document}


Note that actually this kind of question has been answered here.

## Animated version

\documentclass[pstricks,border=12pt]{standalone}

\psset
{
PointName=none,
PointSymbol=none,
linecap=1,
linecolor=red,
}

\begin{document}
\multido{\nr=0.25+0.05,\na=1.0+1.0}{15}{%
\def\Angle{\na}
\begin{pspicture}[showgrid=false](-3,-3)(3,3)
\psaxes[labels=none,ticks=none,linecolor=gray]{->}(0,0)(-3,-3)(2.7,2.7)[$\textbf{Re}\, z$,-90][$\textbf{Im}\, z$,180]
\pstGeonode
(0,0){O}
\pstArcOAB[arrows=->,arcsepB=-3pt]{O}{A}{B}
\pstArcOAB[arrows=->,arcsepB=-3pt]{O}{B}{C}
\pstArcOAB{O}{C}{D}
\pstLineAB[ArrowInside=->]{D}{E}
\pstArcnOAB{O}{E}{F}
\pstLineAB[ArrowInside=->]{F}{A}
%labeling
\psset{labelsep=3pt}
\uput[45](\Radius;45){$\Gamma$}
\uput[135](\radius;135){$\gamma$}
\uput[-45](\Radius;0){$R$}
\uput[-135](\Radius;180){$-R$}
\end{pspicture}}
\end{document}


## Warning:

A special feature of ArrowInside is that it will not produce an arrow when <- (and its variants such as |<-) is assigned to it! In other words, -> (and its variants such as ->|) is the only working option.

-
You have a great.sty style in your answers – texenthusiast Mar 19 '13 at 3:21
@texenthusiast: I will upload the style to CTAN later. – kiss my armpit Mar 19 '13 at 3:42
@Karl'sstudents This is great! Thank you! – Cortizol Mar 19 '13 at 7:34
[$\textbf{Re}\, z$,-90][$\textbf{Im}\, z$,180] What does -90 and 180 relative to? I change this value, the text place changes, but I don't know why. – buzhidao Jun 16 at 13:09