I am a beginner with Tikz, I'm reading some tutorials (by the way, if you want to link me some more, I'll be happy about!) and I'm trying to understand how it works.

But I need a "kick" for that: I have to draw this figure:

enter image description here

I started with

\draw [magenta, thick] circle [radius=3];
\draw [blue] circle [radius=4.3];

But then I did not find how to draw the radius (or the two radii) and the small segment, both with their letter above ($R$ and $a$).

I know the command

\draw [magenta, thick] circle [radius=3] -- (0, 3);

draws the radius, but it's completely vertical. How could I draw it with a certain angle? like in figure?

Also, I might find a way for the segment of $a$, but what about writing the letters? How to?

Thank you for all!


Thanks to Sigur, I managed to get this

enter image description here

And the code I used is this

\begin{tikzpicture} [scale=0.7]
\draw [magenta, thick] circle [radius=3] (0,0) node[above]{$R$}--(30:3cm);
\draw [blue, thick] circle [radius=4.3];
\draw [blue, thick] (3, 0)--(4.3, 0) node[above]{$a$} ;

new questions

How to pur the $a$ over the middle of the small segment? And the $R$ too, in a more elegant way.

  • 1
    You can draw segments using \draw (a,b) -- (c,d); Also you can use polar coordinates. In your case, the radius is 3, so you can draw from origin \draw (0,0) -- (45:3cm); – Sigur Dec 17 '16 at 17:32
  • Yes, that was the idea! But what about writing letters over them, and what about non vertical segments? :/ – Henry Dec 17 '16 at 17:33
  • 1
    To insert symbols or letter you use node. For example, \draw (0,0)node[above]{$R$}--(45:3cm); But this is only an example, since the R should be over the segment, no the origin. – Sigur Dec 17 '16 at 17:35
  • @Sigur Awesome! I learnt the angulation and the letter, that's perfect! By the way, sorry for bothering but: how to write the $R$ letter like over the middle of the radius? At a small distance in order to not to make confusion (and last but not least, in a different colour)? ^_^ – Henry Dec 17 '16 at 17:39
  • @Sigur Of course the different colour was easy, I had to remember about \textcolor command inside the double dollar :D I still have the position problem though. – Henry Dec 17 '16 at 17:48

There are various ways you could do this, but building on what you have.

To place a node halfway along a path, use \draw (a) -- node{..} (b);. Note the placement of the node, just after the --. You can also specify any position along the path, by saying e.g. \draw (a) -- (b) node[pos=<fraction>] {..};, where <fraction> is a number between 0 (start of path) and 1 (end of path).

To change the colour of the node, just add a color in the node options.

I used an arrow tip from the arrows.meta library to draw the black dot in the origin. Saying \draw [<arrow tip>-<arrow tip>] (a) -- (b); will draw a line from a to b with the arrow tip specified by <arrow tip> at each end of the line. Here I used just Circle-, which adds the Circle arrow tip at the beginning of the line, and no arrow tip at the end.

\draw [magenta, thick] circle [radius=3];
\draw [blue] circle [radius=4.3];

\draw [Circle-] (0,0) -- node[left,red] {$R$} (60:3);

\draw (0:3) -- node[above,cyan] {$a$} (0:4.3);

enter image description here

  • That was awesome! Thank you so much, it does fit very well for what I have to do! – Henry Dec 17 '16 at 17:59

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.