3

Jean-Marie gave an answer in a question, including a picture. I want to draw this with TikZ: I can draw the unit circle but I have no clue how to draw this 'triangle'. The straight side is the line from (0,2-sqrt(3)) to (0,-2+sqrt(3)) and the other sides are the circle segments of the circles around (1,2) and (1,-2), both with radius 2.

It would be really nice if someone can help me out!

4

Something like that ?

\documentclass[border = 0.5cm]{standalone}
\usepackage{tikz}
  \usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\draw (0,0) circle (1);
\draw (0,{2-sqrt(3)}) -- (0,{-2+sqrt(3)});
\draw (1,0) arc (270:240:2);
\draw (1,0) arc (-270:-240:2);
\end{tikzpicture}
\end{document}

Note that with this notation (1,0) is not the center, but the starting point of the arc with a 2 units radius. The center of the arc lies at the intersection of the two radius, the one aimed at 270 degrees and the other aimed at 240 degrees and is of course at (1,2). Same for the lower arc.

enter image description here

An alternate way (as mentionned by Torbjørn T.) is to use a path which can be filled.

\documentclass[border = 0.5cm]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw (0,0) circle (1);
\draw[fill=red] (0,{2-sqrt(3)}) -- (0,{-2+sqrt(3)}) arc(-240:-270:2) arc(270:240:2) -- cycle; 
\end{tikzpicture}
\end{document}

enter image description here

If you want to add the axes and some points on it, you could use :

\begin{tikzpicture}[scale=5]
\draw (0,0) circle (1);
\draw[fill=red] (0,{2-sqrt(3)}) -- (0,{-2+sqrt(3)}) arc(-240:-270:2) arc(270:240:2) -- cycle; 
\draw[->] (-1.5,0) -- (1.5,0) node[anchor=north west] {x axis}; % x axis
\foreach \i [count=\j] in {-1/2,-1/3,0,1/3,1/2} 
    \draw (\i,0) coordinate (x\j) edge ++(0,1pt) -- ++(0,-1pt) node [anchor=north] {\i};
\draw[->] (0,-1.5) -- (0,1.5) node[anchor=south east] {y axis}; % y axis    
\end{tikzpicture}

Note that I scaled the picture in order to get a nice agreement between the size of the picture and the size of the font.

enter image description here

  • 2
    (+1) Note that you do not need the calc library for this. As a small addition, it can of course be done with a single path (e.g. for filling, but also makes the joins nicer): \draw (0,{2-sqrt(3)}) -- (0,{-2+sqrt(3)}) arc(-240:-270:2) arc(270:240:2) -- cycle; – Torbjørn T. Aug 22 '16 at 12:37
  • @Torbjørn T. 1) of course you are right for the calc library, but I got so often in trouble because of it that I almost always include it when I use TikZ. 2) Sure it could nicely be drawn in a single path and filled. – DRi Aug 22 '16 at 12:51
  • What do I have to to if I want to add the x-Axis (this is clear) and the marked points 1 and -1 on this axis? :) – user112042 Aug 22 '16 at 14:39
  • With \foreach \i [count=\j] in {-1/2,-1/3,0,1/3,1/2} {\draw (\i,0) coordinate (x\j) edge ++(0,2pt) -- ++(0,-2pt) node [below=5pt, anchor=mid, font=\scriptsize] {\i};} the numers are on the circle. – user112042 Aug 22 '16 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy