First, you don't have to load color
as tikz
already loads xcolor
. You have to put the things in this order though:
\usepackage{tikz}
\definecolor{Darkgreen}{rgb}{0,0.4,0}
\definecolor{Darkblue}{rgb}{0,0,0.4}
Having said that, why to manually calculate the angles? Use clip
. First draw a triangle (well almost a triangle)
\path[clip] (0,2) -- (0,0) -- (-3,4);
and then a circle:
\node[circle,draw=Darkgreen,minimum size=40pt] at (0,0) (circ) {};
Code:
\documentclass[11pt,a4paper]{book}
\usepackage{kerkis}
%\usepackage{kmath}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
%\usepackage{color}
%\usepackage[usenames,dvipsnames]{color}
\usepackage{tikz}
\definecolor{Darkgreen}{rgb}{0,0.4,0}
\definecolor{Darkblue}{rgb}{0,0,0.4}
\begin{document}
\begin{tikzpicture}
\draw[gray,->] (-5,0) -- (5,0);
\draw[gray,->] (0,-5) -- (0,5);
\draw[gray,dashed] (-5,4) -- (5,4);
\node at (5,0.2) {$x$};
\node at (-0.2,5) {$y$};
\fill (0,0) circle (2pt) node[below] (e) {$m,e$};
\fill (-3,4) circle (2pt) node[above] (ion) {$ze$};
\draw[red] (0,0) -- (-3,4);
\draw[gray,->] (4,1.75) -- (4,0);
\draw[gray,->] (4,2.25) -- (4,4);
\node at (4,2) {$b$};
\draw[blue,->] (-3,4) -- (-1.5,4);
\node[blue] at (-1.8,4.2) {$V$};
\node[red] at (-2.7,3) {$r$};
\draw[Darkgreen,->] (0,0) -- (-1.5,2);
\draw[Darkgreen,->] (0,0) -- (0,2);
\draw[Darkgreen,->] (0,0) -- (-1.5,0);
\draw[Darkgreen,very thin,dashed] (0,2) -- (-1.5,2);
\draw[Darkgreen,very thin,dashed] (-1.5,0) -- (-1.5,2);
\node[color=Darkgreen] at (0.3,2) {$F_y$};
\node[Darkgreen] at (-1.5,-0.3) {$F_x$};
\node[Darkgreen,left] at (-1.7,2) {$F=\dfrac{kze^2}{r^2}$};
%% First clip
\path[clip] (0,2) -- (0,0) -- (-3,4) -- cycle;
%%The circle
\node[circle,draw=Darkgreen,minimum size=40pt] at (0,0) (circ) {};
%
%\draw[Darkgreen] (0.5,0.5) arc (80:123:0.8cm);
\draw[Darkgreen] (1cm,0cm) arc (90:125:1cm);
\end{tikzpicture}
\end{document}
A solution which allows to draw intersection segments
of any two intersections is available as tikz library fillbetween
.
This library works as general purpose tikz
library, but it is shipped with pgfplots
and you need to load pgfplots
in order to make it work:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\draw [name path=red,red] (120:1.06) circle (1.9);
%\draw [name path=yellow,yellow] (0:1.06) circle (2.12);
\draw [name path=green,green!50!black] (0:0.77) circle (2.41);
\draw [name path=blue,blue] (0:0) circle (1.06);
% substitute this temp path by `\path` to make it invisible:
\draw[name path=temp1, intersection segments={of=red and blue,sequence=L1}];
\draw[red,-stealth,ultra thick, intersection segments={of=temp1 and green,sequence=L3}];
\end{tikzpicture}
\end{document}
The key intersection segments
is described in all detail in the pgfplots
reference manual section "5.6.6 Intersection Segment Recombination"; the key idea in this case is to
create a temporary path temp1
which is the first intersection segment of red and blue
, more precisely, it is the first intersection segment in the L
eft argument in red and blue
: red
. This path is drawn as thin black path. Substitute its \draw
statement by \path
to make it invisible.
Compute the desired intersection segment
by intersecting temp1
and green
and use the correct intersection segment. By trial and error I figured that it is the third segment of path temp1
which is written as L3
(L
= left argument in temp1 and green
and 3
means third segment of that path).
The argument involves some trial and error because fillbetween
is unaware of the fact that end and startpoint are connected -- and we as end users do not see start and end point.
Note that you can connect these path segments with other paths. If such an intersection segment
should be the continuation of another path, use --
as before the first argument in sequence. This allows to fill paths segments:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\draw [name path=red,red] (120:1.06) circle (1.9);
%\draw [name path=yellow,yellow] (0:1.06) circle (2.12);
\draw [name path=green,green!50!black] (0:0.77) circle (2.41);
\draw [name path=blue,blue] (0:0) circle (1.06);
% substitute this temp path by `\path` to make it invisible:
\draw[name path=temp1, intersection segments={of=red and blue,sequence=L1}];
\draw[red,fill=blue,-stealth,ultra thick, intersection segments={of=temp1 and green,sequence=L3}]
[intersection segments={of=temp1 and green, sequence={--R2}}]
;
\end{tikzpicture}
\end{document}
Best Answer
This can be implemented elegantly using the
angles
library as suggested by @TorbjørnT. You need alsoquotes
library to label angles. I changed all\( .. \)
to$ .. $
; there is nothing wrong with parentheses but it hurts my eyes and I prefer the more distinct symbol$
. Finally, I don't think a\newcommand
is very beneficial here as this figure is not likely repeated many times. You may think of removing thenewcommand
and inserting the figure as well as the text directly.