2

On page 99 of the tkz-euclide manual, several examples are given of the option 'diameter'. But this gives me an error. Is there another package or library that needs to be loaded to have access to the key?

! Package pgfkeys Error: I do not know the key '/tikz/diameter' and I am going to ignore it. Perhaps you misspelled it.

\documentclass[border=3mm]{standalone}
\usepackage{tkz-euclide}

\begin{document}

\begin{tikzpicture}
  \tkzDefPoints{0/0/A,1/0/B}
  \tkzDrawCircle[diameter](A,B)
\end{tikzpicture}

\end{document}

Thanks.

3
  • Which version are you using? I think that since version 5, it's no longer possible! I end up forgetting my own documents! Mar 3 at 9:00
  • 1
    If you create a lot of geometric shapes, I recommend you try tkz-elements with lualatex, and draw with TikZ or tkz-euclide. Mar 3 at 9:02
  • 1
    you don't need to load tikz and pgf ! Mar 3 at 9:21

1 Answer 1

2

The diameter option has not been used for several versions.

First define the circle with tkzDefCircle[diameter] to obtain the center and a point of the circle (which you already have), then plot it, using only the plot options.

This is undoubtedly frustrating, as it requires an extra line of code, but it was necessary to separate the calculations from the plotting. That's why it's possible with lualatex to use tkz-elements to get all the calculations first (faster and more accurate with Lua) and then plot with tkz-euclide.

\documentclass[border=3mm]{standalone}
\usepackage{tkz-euclide}

\begin{document}
\begin{tikzpicture}
  \tkzDefPoints{0/0/A,1/0/B}
  \tkzDefCircle[diameter](A,B)
  % or \tkzDefMidPoint(A,B)       \tkzGetPoint{C} 
  \tkzGetPoints{C}{T} % here T = B
  \tkzDrawCircle(C,T)
  \tkzDrawPoints(A,B,C)
\end{tikzpicture}
\end{document}

enter image description here

With tkz-elements

% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{tkz-euclide,tkz-elements}
\begin{document} 
\begin{tkzelements}
  z.A  = point : new (0,0)
  z.B  = point : new (1,0)
  C.AB = circle : diameter (z.A,z.B)
  z.C = C.AB.center
\end{tkzelements}
  
\begin{tikzpicture}
\tkzGetNodes
  \tkzDefPoints{0/0/A,1/0/B}
  \tkzDrawCircle(C,B)
\end{tikzpicture}
\end{document}
3
  • Thanks a lot Alain for your answer! I really wanted to reproduce the Pappus chain example in the Manual. I have just noticed an answer of yours with the Pappus chain example and the obsolete code: tex.stackexchange.com/questions/365062. Maybe you could fix the code there. Thanks!
    – PatrickT
    Mar 3 at 11:29
  • 1
    @PatrickT You can find an example here 47.25. Application of Inversion: Pappus chain in the documentation Mar 3 at 15:07
  • Thanks Alain! I had two copies of the manual and was using an older version... You're absolutely right of course: example 47.25 in the latest version of the manual works great! I have updated your answer to question 365062, please see if it's done right. Thanks!
    – PatrickT
    Mar 3 at 23:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .