I'm trying to re-create this picture using TikZ:


I, however, have a very limited understanding of TikZ, and, despite trying to learn how to draw this for an hour or so, have gotten nowhere on my own.


4 Answers 4


One (somehow verbose) option:

enter image description here

The code:


\def\myrad{3cm}% radius of the circle
\def\myang{60}% angle for the arc


% the origin
\coordinate (O) at (0,0);
% the circle and the dot at the origin
\draw (O) node[circle,inner sep=1.5pt,fill] {} circle [radius=\myrad];
% the ``\theta'' arc
  (\myrad,0) coordinate (xcoord) -- 
  node[midway,below] {$r$} (O) -- 
  (\myang:\myrad) coordinate (slcoord)
  pic [draw,->,angle radius=1cm,"$\theta$"] {angle = xcoord--O--slcoord};
% the outer ``s'' arc
  arc[start angle=0,end angle=\myang,radius=\myrad+10pt]
  node[midway,fill=white] {$s$};


A PSTricks solution:



% parameters





All you have to do is choose the values of the parameters and the drawing will be adjusted accordingly.

  • 2
    "How do I do X in tikz?" "Here's the pstricks solution!" "How do I do Y in pstricks?" "Here's the tikz solution!" Loyal to the end, all of us.
    – Ryan
    Jan 15, 2015 at 7:51
  • I'm just poking fun at the fact that every time someone asks about tikz they get pstricks solutions, and every pstricks question usually has a tikz answer because most people only know one and are quite loyal to it. (I'm not trying to say your answer is bad, I'm just saying the rivalry is a bit funny).
    – Ryan
    Jan 15, 2015 at 7:54
  • I'll edit that to not say "refuse"—bad word choice
    – Ryan
    Jan 15, 2015 at 7:56

Just a finger warm-up exercise with PSTricks.



enter image description here


A MetaPost solution. A verbose one, since two macros respectively producing a circular arc and adding bar ends to a path have been included.

To be compiled with the MetaFun format of MetaPost and with the LaTeX engine:

mpost --mem=metafun --tex=latex mydrawing.mp

input latexmp; setupLaTeXMP(options = "12pt", textextlabel = enable, mode = rerun) ;

% Macro drawing a circular arc (radius = 1, centered at origin)
vardef arc(expr theta_min, theta_max) =
  save theta, mystep ; 
  mystep = 1; theta = theta_min ;
  dir theta_min 
  for theta = theta_min+mystep step mystep until theta_max: .. dir theta endfor 
enddef ;

% Macro adding bar ends to any path
vardef drawbarends(expr pat, lmark) =
  draw pat ; 
  for t = 0, infinity: 
    draw (left -- right) zscaled (0.5lmark * unitvector direction t of pat) 
      rotated 90 shifted point t of pat; 

  u := 1cm ; % unit length
  % Full circle
  pair center ; center = origin ; r := 2.75u ; 
  draw fullcircle scaled 2r shifted center ;
  % Radii
  theta_min := 0 ; theta_max := 60 ;
  path radius_a, radius_b ; 
  radius_a = (center -- center + dir theta_min) scaled r ; draw radius_a ;
  radius_b = (center --  center + dir theta_max) scaled r ; draw radius_b ;
  label.bot("$r$", point 0.5 of radius_a) ;
  % Arc
  myeps := 0.25u ; path p ; p = arc(theta_min, theta_max) scaled (r+myeps) shifted center ;
  drawbarends (p, 4bp) ;
  pair midpoint ; midpoint = point 0.5 along p ;
  picture arclabel ; arclabel = thelabel("$s$", midpoint) ;
  unfill (boundingbox (arclabel) enlarged 1bp) ; draw arclabel ;
  % Angle
  drawarrow anglebetween(radius_a, radius_b, "$\theta$") ;
endfig ;

enter image description here

You must log in to answer this question.

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