In tkz-euclide
the legth of a segment is determined via:
\tkzCalcLength[<unit>](<point1>,<point2>) \tkzGetLength{<variableName>}
As you can see, you can also specify the unit in which you want the result. And, of course, don't forget the \
before <variableName>
, when using it later in the code. :)
Edit: To avoid errors at compilation, you will need to specify the unit every time you use \<varialbleName>
, e.g.:
\tkzCalcLength(R,Q) \tkzGetLength{dRQ}
\tkzCalcLength[cm](M,Q) \tkzGetLength{dMQ}
\tkzDrawCircle[R](O,\dRQ cm)
\tkzDrawCircle[R](P,\dMQ pt)
Edit2: OK, here is the full working example, in case it doesn't work for somebody:
% Morley's triangle
% Author : Arnaud Lefebvre (IREM Rouen)
% Ported to tkz-euclide : Count Zero
% Intersections of trisector lines in any triangle
% are vertices of an equilateral triangle
\documentclass{article}
\usepackage{tkz-euclide}
\usetikzlibrary{calc,intersections}
\usetkzobj{all}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
%----------------------------------------------------
% Coordinates of A, B and C, the triangle vertices
%----------------------------------------------------
\coordinate[label=above:$A$] (A) at (5,4);
\coordinate[label=left:$B$] (B) at (0,0);
\coordinate[label=right:$C$] (C) at (7,0);
%----------------------------------------------------
% Lengths of segments [AB], [BC], and [CA]
%----------------------------------------------------
\tkzCalcLength(B,C) \tkzGetLength{a}
\pgfmathsetmacro{\la}{.01*\a pt}
\tkzCalcLength(A,C) \tkzGetLength{b}
\pgfmathsetmacro{\lb}{.01*\b pt}
\tkzCalcLength(A,B) \tkzGetLength{c}
\pgfmathsetmacro{\lc}{.01*\c pt}
%----------------------------------------------------
% Computing 1/3 of each angle
%----------------------------------------------------
\pgfmathsetmacro{\A}{acos((\la*\la-\lb*\lb-\lc*\lc)/(-2*\lb*\lc))};
\pgfmathsetmacro{\tA}{\A/3};
\pgfmathsetmacro{\B}{acos((\lb pt*\lb pt-\la pt*\la pt-\lc pt*\lc pt)/(-2*\la pt*\lc pt))};
\pgfmathsetmacro{\tB}{\B/3};
\pgfmathsetmacro{\C}{acos((\lc pt*\lc pt-\lb pt*\lb pt-\la pt*\la pt)/(-2*\lb pt*\la pt))};
\pgfmathsetmacro{\tC}{\C/3};
%----------------------------------------------------
% Computing intersections of trisector lines
%----------------------------------------------------
\coordinate (A1) at ($(A)!100*max(\lb pt,\lc pt)!\tA:(B)$);
\coordinate (A2) at ($(A)!100*max(\lb pt,\lc pt)!2*\tA:(B)$);
\coordinate (B1) at ($(B)!100*max(\la pt,\lc pt)!\tB:(C)$);
\coordinate (B2) at ($(B)!100*max(\la pt,\lc pt)!2*\tB:(C)$);
\coordinate (C1) at ($(C)!100*max(\la pt,\lb pt)!\tC:(A)$);
\coordinate (C2) at ($(C)!100*max(\la pt,\lb pt)!2*\tC:(A)$);
%----------------------------------------------------
% Computing coordinates of vertices O, P and Q of
% the Morley's triangle
%----------------------------------------------------
\coordinate (O) at (intersection of C--C1 and A--A2);
\coordinate (P) at (intersection of A--A1 and B--B2);
\coordinate (Q) at (intersection of B--B1 and C--C2);
%----------------------------------------------------
% Drawing triangles and trisectors
%----------------------------------------------------
\tkzMarkAngle[size=1,fill=green!80](B,A,A1)
\tkzMarkAngle[size=.9,fill=green!80](A1,A,A2)
\tkzMarkAngle[size=.8,fill=green!80](A2,A,C)
\tkzMarkAngle[size=1,fill=blue!80](C,B,B1)
\tkzMarkAngle[size=.9,fill=blue!80](B1,B,B2)
\tkzMarkAngle[mkpos=.2,size=.8,fill=blue!80](B2,B,A)
\tkzMarkAngle[size=1,fill=red!80](A,C,C1)
\tkzMarkAngle[size=.9,fill=red!80](C1,C,C2)
\tkzMarkAngle[size=.8,fill=red!80](C2,C,B)
\draw (A)--(B)--(C)--cycle;
\draw[fill=orange, opacity=.4]
(O)--node[sloped]{\tiny{//}}
(P)--node[sloped]{\tiny{//}}
(Q)--node[sloped]{\tiny{//}}(O);
\draw (A)--(O) (A)--(P) (B)--(P) (B)--(Q) (C)--(Q) (C)--(O);
%----------------------------------------------------
% Caption
%----------------------------------------------------
\node[rounded corners, fill=purple!20,anchor=south east] at (3,3)
{\begin{minipage}{5cm}
\textbf{Morley's triangle}\newline In any triangle, trisector
lines intersect in 3 points that are vertices of an
equilateral triangle.
\end{minipage}};
\end{tikzpicture}
\end{document}
So, no more complaints will be accepted! All right, just kidding... ;)
Best Answer
Your code works:
You need to read your
.log
file to verify two things:the path for
gnuplot
. If the path is fine then you must find a line likegnuplot
executed or something like thatif in your
.log
file, you have something likethen you need to use the option
--shell-escape
orwrite18
in your script for the compilation.The problem is the same with
pgfplots
or another package that usesgnuplot
.