1

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?

3
  • Sorry but the answer is no but it's not difficult to find a way to do this. May 12, 2020 at 5:57
  • 1
    i've added a pull request with the lbpos option to set the relative position of the label
    – maphy-psd
    May 30, 2020 at 18:36
  • Is there any update on this? Is there now a built-in way to do this? May 19, 2021 at 7:51

2 Answers 2

1

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

3
  • Thanks Alain. I hope you consider building this macro into the next version of tkz-euclide. May 30, 2020 at 6:05
  • @Mathemanic yes it's possible ! May 30, 2020 at 18:59
  • Hi Alain, thanks again! Is it possible to choose to locally round the arc measure (in specific cases, not the entire document), simlar to \FPRound in this answer? tex.stackexchange.com/a/246611/48036 May 19, 2021 at 10:58
1

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}
1
  • Sorry, didn't see the caveat about not defining the centre of the circle. May 5, 2020 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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