3

In Tkz-Euclide, is there a "built-in" (automatic) way to label the minor or major arc of a circle?

For instance, in the following circle, I would like to label the minor arc CD with measure 58 degrees (preferably without having to calculate and place a point or node in the perfect center of that arc!).

enter image description here

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{gensymb} %for degree symbol
\begin{document}
\begin{center}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw (O) circle (3);
\coordinate[label = above left:$A$] (A) at (130:3);
\coordinate[label = above right:$D$] (D) at (58:3);
\coordinate[label = right:$C$] (C) at (0:3);
\coordinate[label = left:$B$] (B) at (180:3);
\draw (B) -- (D) -- (C);
\draw (B) -- (A) -- (C);
\draw (B) -- (C);
\tkzInterLL(A,C)(B,D) \tkzGetPoint{E}
\tkzLabelPoints[above](E)
\tkzMarkAngle[size=0.60cm,%
opacity=.9](B,E,C)
\tkzLabelAngle[pos = 0.9](B,E,C){$126\degree$}
\tkzMarkAngle[size=0.9cm,%
opacity=.9](D,C,E)
\tkzLabelAngle[pos = 1.3](D,C,E){$36\degree$}
\end{tikzpicture}
\end{center}
\end{document}

I know that one option is to create a new coordinate point and labeling it with \coordinate[label = above right:$58\degree$] (F) at (29:3); but this requires calculating the perfect center of that arc. Ideally, I would like a simple command like \tkzLabelMinorArc[above right](D,C){$58\degree$}.

I see on this Tkz-Euclide cheat sheet that Tkz-Euclide has similar commands for \tkzLabelPoint, \tkzLabelAngle, \tkzLabelLine, \tkzLabelSegment, and \tkzLabelCircle, but I cannot find a command to make perfect labels for Minor or Major Arcs of a circle. Does anyone know if this option exists in Tkz-Euclide?

Edit: Long time update to this question. Is it also possible to choose to locally (in specific cases, not the entire document) round the arc measure when desired, similar to how \FPRound works in this answer?

EthanAlvaree
  • 1,367

2 Answers2

3

You used \usetkzobj{all}so you're not using the latest version of tkz-euclide which is 3.06. The solution below uses the last version. It's possible with tkz-euclide but we need to create a new macro. You can get the middle of the arc with \tkzGetPoint{M}. You can adapt the result, intros case you need to change

\node[#1] at (tkzPointResult) {\pgfmathprintnumber{\tkz@An}\degree};

It's possible to add some specific options if it's necessary.

\documentclass{standalone} 
\usepackage{tkz-euclide}
\usepackage{gensymb} 
\makeatletter

\def\tkzMarkArc{\pgfutil@ifnextchar[{\tkz@MarkArc}{\tkz@MarkArc[]}}   
\def\tkz@MarkArc[#1](#2,#3,#4){% 
\begingroup
\tkzCalcLength[cm](#4,#3) \tkzGetLength{tkz@len}
\tkzFindSlopeAngle(#4,#2)\tkzGetAngle{tkz@anga}
\tkzFindSlopeAngle(#4,#3)\tkzGetAngle{tkz@angb}
\tkzNormalizeAngle(\tkz@anga,\tkz@angb)
\edef\tkz@An{\fpeval{(\tkz@SecondAngle-\tkz@FirstAngle)}}
\edef\tkz@Angle{\fpeval{(\tkz@SecondAngle+\tkz@FirstAngle)/2}}
\tkzDefPoint(\tkz@Angle :\tkz@len){tkzPointResult}
\node[#1] at (tkzPointResult) {\pgfmathprintnumber{\tkz@An}\degree};
\endgroup 
}
\makeatother

\begin{document} 

\begin{tikzpicture}
\tkzDefPoint(0,0){O}
\pgfmathsetmacro\r{2}
\tkzDefPoint(30:\r){A}
\tkzDefPoint(85:\r){B}
\tkzDrawCircle(O,A)

\tkzMarkArc[above right](A,B,O)  \tkzGetPoint{M}

\tkzDrawPoints(B,A,M)
\tkzLabelPoints[above right](O,A,B)
\end{tikzpicture}

 \end{document}

enter image description here

Alain Matthes
  • 95,075
2

Didn't see anything in the manual, but you can define such a macro. Can't guarantee the example below works in all cases, though it seems to work fine here.

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{tkz-euclide}
%\usetkzobj{all}
\usepackage{gensymb} %for degree symbol

\usetikzlibrary{calc}
\newcommand\LabelMinorArc[4][]{%
% optional arg: options for node
% mandatory args
%  - center coordinate
%  - first point circle
%  - second point on circle
\path let
\p1=(#2),\p2=(#3),\p3=(#4),
\n1={atan2(\y2-\y1,\x2-\x1)},
\n2={atan2(\y3-\y1,\x3-\x1)},
\n3={scalar(\n2-\n1)},
\n4={veclen(\x2-\x1,\y2-\y1)}
in
(#2) ++(\n3/2+\n1:\n4) node[#1] {$\pgfmathprintnumber{\n3}\degree$};
}

\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw (O) circle (3);
\coordinate[label = above left:$A$] (A) at (130:3);
\coordinate[label = above right:$D$] (D) at (58:3);
\coordinate[label = right:$C$] (C) at (0:3);
\coordinate[label = left:$B$] (B) at (180:3);
\draw (B) -- (D) -- (C);
\draw (B) -- (A) -- (C);
\draw (B) -- (C);
\tkzInterLL(A,C)(B,D) \tkzGetPoint{E}
\tkzLabelPoints[above](E)
\tkzMarkAngle[size=0.60cm,%
opacity=.9](B,E,C)
\tkzLabelAngle[pos = 0.9](B,E,C){$126\degree$}
\tkzMarkAngle[size=0.9cm,%
opacity=.9](D,C,E)
\tkzLabelAngle[pos = 1.3](D,C,E){$36\degree$}

\LabelMinorArc[above right]{O}{C}{D}
\LabelMinorArc[above]{O}{D}{A}
\LabelMinorArc[left]{O}{A}{B}

\end{tikzpicture}
\end{document}
Torbjørn T.
  • 206,688