2

This has been driving me crazy for months. Suppose I have the following MWE:

\documentclass[tikz]{standalone}
\usepackage{tkz-euclide}

\begin{document}

\begin{tikzpicture}
\tkzDefPoints{0/0/A,3/0/B,0/5/C}
\tkzMarkRightAngle(B,A,C)
\tkzMarkAngle(C,B,A)
\tkzDrawPolygon(A,B,C)
\tkzLabelPoints[below](A,B)
\tkzLabelPoints[above](C)
\end{tikzpicture}

\end{document}

This produces the following image.

MWE Right Triangle with black angles

I want to make it so that all instances of \tkzMarkRightAngle, \tkzMarkRightAngles, \tkzMarkAngle, and , \tkzMarkAngles draw in magenta for their lines/arcs and not the default black. I can do this individually by using the option \tkzMarkAngle[magenta] or \tkzMarkAngle[color = magenta]. Doing such individually on each angle will produce what I want:

MWE Right Triangle with magenta angles

However, I want to set this globally. I know that I can do many other things globally, such as set up arc and line colors via

\tkzSetUpArc[color=magenta]
\tkzSetUpLine[color=magenta]

or that I can also change certain aspects of the right angle via

\tikzset{/tkzrightangle/size=0.5}

but I just cannot figure out how to set the color of all angles globally. Would anyone know of a way to accomplish this?

4
  • You could just define \newcommand*\myMarkAngle[1][]{\tkzMarkAngle[{magenta,#1}]} and use that instead. The tkz packages don't offer many helpful styles that can be used here. Commented Mar 30, 2023 at 19:29
  • Indeed, I didn't think it was necessary to use a common style for all the angles. It seemed to me that this was not frequent enough because often the angles are filled with different colors but I will see if it is possible to modify the code slightly. This also leads to the colors of the arcs, marks ... Commented Mar 31, 2023 at 6:03
  • Thanks for the comments. Regarding defining a new command, that particular approach offered by @Qrrbrbirlbel is of course doable, but causes me to create 4 new commands. And, every time I need to update the color, I need to update all four of them. (Or make the solution longer and create a newcommand or variable for the color. So I was hoping to avoid it. Regarding the infrequent usage, I don't know how often users choose just one color, but I was trying to mimic the textbooks I've used. In those books, all the angles are cyan, all the angles are magenta, or some combination thereof.
    – Jeff Slye
    Commented Mar 31, 2023 at 17:59
  • @JeffSlye Then do \newcommand*\myMarkAngle[1][]{\tkzMarkAngle[{every mark angle,#1}]} and \pgfkeys{/tkzmkangle/every mark angle/.style=magenta}. Then you only need to change the every mark angle instead of four commands. Commented Mar 31, 2023 at 18:24

1 Answer 1

1

two possibilities :

A)

\documentclass[tikz]{standalone}
\usepackage{tkz-euclide}

\begin{document}

\begin{tikzpicture}
\tkzDefPoints{0/0/A,3/0/B,0/5/C}
\begin{scope}[color=magenta]
   \tkzMarkRightAngle(B,A,C)
   \tkzMarkAngle(C,B,A)
\end{scope}

\tkzDrawPolygon(A,B,C)
\tkzLabelPoints[below](A,B)
\tkzLabelPoints[above](C)
\end{tikzpicture}

\end{document}

B) I added in a previous version the possibility to use pic

 \tikzset{angle style/.style={color=magenta}} 
   
\begin{tikzpicture}
  \tkzDefPoints{0/0/A,4/0/B}
  \tkzDefTriangle[right,swap](A,B) \tkzGetPoint{C}
  \tkzDrawPolygon(A,B,C)
  \tkzDrawPoints(A,B,C)
  \tkzLabelPoints[below](B,A)
  \tkzLabelPoints[above right](C)
  \tkzPicAngle["$\alpha$",draw=orange,
   <->,angle eccentricity=1.2,
   angle radius=1cm,angle style](B,A,C)
  \tkzPicRightAngle[draw,red,thick,
   angle eccentricity=.5,
   pic text=.,angle style](C,B,A)
\end{tikzpicture}

enter image description here

1
  • Was hoping this wasn't the official answer, but thank you for the detailed response. I may go with the pic option, but I'll see which one goes better with my workflow! (Also totally didn't think of the scope option, as obvious as that sounds. Though I guess I didn't consider it since it isn't global for the entire document.)
    – Jeff Slye
    Commented Mar 31, 2023 at 18:04

You must log in to answer this question.

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