Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to draw an arc to indicate angle between y axis and r line, but I don't seem to achive it. My code is

\documentclass[11pt,a4paper]{book}
\usepackage{kerkis}
%\usepackage{kmath}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{color}
%\usepackage[usenames,dvipsnames]{color}
\definecolor{Darkgreen}{rgb}{0,0.4,0}
\definecolor{Darkblue}{rgb}{0,0,0.4}
\usepackage{tikz}
\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[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}$};
%\draw[Darkgreen] (0.5,0.5) arc (80:123:0.8cm);
\draw[Darkgreen] (1cm,0cm) arc (90:125:1cm);

\end{tikzpicture}
\end{document}

My output is

Any ideas on that?


share|improve this question
    
Perhaps you mean \draw[Darkgreen] (0cm,1cm) arc (90:125:1cm);? Looks like you have the x and y coordinates reversed. –  Brent.Longborough Nov 1 '12 at 21:03
    
@Brent.Longborough: Yep that seems like an answer to me. Could also include \pgfmathsetmacro{\EndAngle}{90+atan2(4,3)} to compute the end angle as opposed to guess its value. –  Peter Grill Nov 1 '12 at 21:10
2  
Look at Tikz: joining points on a circle and my answer. –  Paul Gaborit Nov 2 '12 at 17:35
    
Very elegant!Nice!Thank you very much! –  Thanos Nov 2 '12 at 19:41

2 Answers 2

up vote 8 down vote accepted

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}

enter image description here

share|improve this answer

First coordinate determine star of arc. exchange line

\draw[Darkgreen] (1cm,0cm) arc (90:125:1cm);

with

\draw[Darkgreen] (0,1) arc (90:125:1cm);

and your (not MWE) example should draw arc in desired place (if I catch where the arc should be).

share|improve this answer
    
Thank you very much for your answer! Reversing coordinates really works! But I can't understand why! The syntax is \draw (P) arc (a:b:r) (each variable can be seen on my edited answer). My idea was to put P on the x axis, (1,0) that is... –  Thanos Nov 2 '12 at 19:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.