# Drawing contour integral diagrams

I am $\TeX$ writing notes on complex analysis, I need to use figures of contour paths to integrate on them, how can I plot them on Mathematica, something like this

adding also the $\gamma_R$ legends in $\TeX$ if possible ?

• Arrow[] and JoinedCurve[] will be quite helpful here. Jun 10, 2015 at 2:40
• @Guesswhoitis. Thanks a lot, could you provide an example?, I am new to mathematica, even a simple one, like the first contour. Jun 10, 2015 at 2:47
• You might want to see this. Jun 10, 2015 at 3:14

Preliminaries:

lin[x_] := {Arrowheads[{{0.05, 0.5}}], Arrow[Most@x]};
arc[x_] :=
Arrow[Table[
x[[1]] {Cos[j], x[[-2]] Sin[j]}, {j, x[[2]], x[[3]],
0.01 (x[[3]] - x[[2]])}]]};
cont[lst_] := If[#[[-1]] == "line", lin@#, arc@#] & /@ lst


Example of right most contour but you could adapt to others by specifying contour as list of elements (am time poor at present):

 im[d_, o_] :=
Graphics[{Red,
cont[{{{o, d}, {1, d}, "line"}, {1, ArcTan[d], 2 Pi - ArcTan[d], 1,
"arc"}, {{1, -d}, {o, -d}, "line"}, {Norm[{o, d}], ArcTan[d/o],
2 Pi - ArcTan[d/o], -1, "arc"}}], Black,
Text["|z|=1/R", 2 Norm[{o, d}] {Cos[3 Pi/4], Sin[3 Pi/4]}]},
Axes -> True,
Ticks -> {{{1.1, "R"}, {-1.1, "-R"}}, {{1.1, "i R"}, {-1.1,
"-i R"}}}, PlotRange -> {{-1.3, 1.3}, {-1.3, 1.3}}]


You can format text and contour as desired.

• Thanks a lot ! Loved the .gif !! Jun 12, 2015 at 0:47
• What? No $\eta_R$? Jun 12, 2015 at 1:27
• @DavidG.Stork yes I apologise for the omission for the labeling of the contour as well as the failure to suppress the tick mark (as you did with 0 option in tick specification). My principal aim was to start to generalize and illustrate with contour that was most "interesting"...done at midnight after 14 hour day...so not firing on all cylinders Jun 12, 2015 at 1:31
Graphics[
{Text[Style["|z| = 1/R", 22, Italic, FontFamily -> "Times"], {-.4, .15}],
Text[Style["\!$$\*SubscriptBox[\(\[Eta]$$, $$R$$]\)", 22, Italic,
FontFamily -> "Times"], {.8, .8}],
{Red,