Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

Could someone help me to draw this picture Picture 1.

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

Picture 2.

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}
\def\bigradius{3}
\def\littleradius{0.5}

% 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
     \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;

% 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} 

My work

Thank you one more time for helping me.

share|improve this question

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
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
3  
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
1  
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
show 2 more comments

2 Answers 2

up vote 16 down vote accepted

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}
\def\bigradius{3}
\def\littleradius{0.5}

% Axes
\draw (-1.1*\bigradius, 0) -- (1.1*\bigradius,0)
      (0, -1.1*\bigradius) -- (0, 1.1*\bigradius);
% 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
     \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;
\end{tikzpicture}
\end{document}

Result

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 :-)

share|improve this answer
    
Thank you very much for this :) –  Cortizol Mar 19 '13 at 7:34
add comment

With PSTricks.

enter image description here

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pstricks-add,pst-eucl}

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

\def\Radius{1.8}
\def\radius{0.5}
\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}
        (\Radius;\Angle){A}
        (\Radius;90){B}
        (\Radius;-90){C}
        (\Radius;-\Angle){D}
        (\radius;0|D){E}
        (\radius;0|A){F}
    \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

enter image description here

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pstricks-add,pst-eucl}

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


\def\Radius{1.8}

\begin{document}
\multido{\nr=0.25+0.05,\na=1.0+1.0}{15}{%
\def\Angle{\na}
\def\radius{\nr}
\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}
        (\Radius;\Angle){A}
        (\Radius;90){B}
        (\Radius;-90){C}
        (\Radius;-\Angle){D}
        (\radius;0|D){E}
        (\radius;0|A){F}
    \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.

share|improve this answer
    
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. –  Please don't touch Mar 19 '13 at 3:42
    
@Karl'sstudents This is great! Thank you! –  Cortizol Mar 19 '13 at 7:34
add comment

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