# Coordinates computation with tkz-euclide

In tkz-euclide, I want to draw a point with computed coordinates, like in TikZ. However I get a difficult to understand error of syntax which results in a wrong placement. The following MWE shows what happens in both cases:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage[active,tightpage]{preview}
\begin{document}
\PreviewEnvironment{tikzpicture} .
\setlength\PreviewBorder{5pt}
\pagestyle{empty}
\begin{tikzpicture}%[node distance = 2cm, auto]

\tkzDefPoint[label= left:$O$](0,0){O}
\tkzDrawPoints[size=9,color=red](O)

\coordinate (T) at ({sqrt(4)},0);
\tkzDrawPoints(T)
\tkzLabelPoints[right](T)

\tkzDefPoint[label= left:$I$]({sqrt(4)},0){I}
\tkzDrawPoints(I)

\end{tikzpicture}
\end{document}


The point O being the reference the point T is defined in classical TikZ and printed correctly while the point I defined in tkz-euclide gives a bunch of errors and is drawn at the wrong x-coordinate.

Of course a work around is to use TikZ instead of tkz-euclide to draw points with computed coordinates but it makes the code a bit confusing.

Is there a way to compute points correctly in tkz-euclide: {1+1} would work but not {sqrt(4)}, neither a lot of functions such as asin, acos, ...?

• Unrelated: the preview stuff isn't really necessary when using the standalone class. May 17, 2018 at 16:14

tkz-euclide uses the fp package to do the calculations, so the syntax is different. Instead of sqrt(4), you must use root(2,4). The inverse trig functions are arcsin, arccos etc. See texdoc fp (which gives the README file at https://www.ctan.org/pkg/fp), lines 139-142 for a list of known operations.

\documentclass[border=5mm]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}%[node distance = 2cm, auto]

\tkzDefPoint[label= left:$O$](0,0){O}
\tkzDrawPoints[size=9,color=red](O)

\coordinate (T) at ({sqrt(4)},0);
\tkzDrawPoints(T)
\tkzLabelPoints[right](T)

\tkzDefPoint[label= left:$I$]({root(2,4)},0){I}
\tkzDrawPoints(I)

\end{tikzpicture}
\end{document}

• It is not clear that the syntax is different, though the manual (very good, in French) p. 154 states (\S 9) that the syntax is different, and even the README file, lines 139-142, if known is not clearer about root(2,4) it is confusing for a normal user. Moreover, the angles are computed in radian while the package uses degree. So the solution is OK but using TiKZ and tikz-euclide will be inconsistent for the syntax while computing all in tikz-euclide will be as inconsistent with some lines of code with angles in degrees and other in radian. May 23, 2018 at 1:19