0

Edit: @js bibra pointed me to How do I mark an angle with multiple arcs?

It seems like my question is kind of a duplicate, but there is still the matter of whether it makes sense and how to nest pics, -and how is the calling syntax from angle is achieved?


I want to define my own pic that create a double angle like this:

Double angle

Optimally the new double angle pic, dangle should work like the normal angle. My attempt is to create a new pic, where the angle is drawn twice:

\documentclass[tikz, border = 0.5 cm]{standalone}
\usetikzlibrary {angles}
\tikzset{
    pics/dangle/.style args={#1--#2--#3}{
        code={
        \coordinate (AA) at #1;
        \coordinate (BB) at #2;
        \coordinate (CC) at #3;
 %       \draw pic [draw, angle radius=6 mm] {angle = AA--BB--CC};  %not ok
 %       \draw pic [draw, angle radius=7 mm] {angle = AA--BB--CC};  %not ok
       \draw[red] (AA)--(CC); %just for testing
        }
    }
}
 \begin{document}
  \begin{tikzpicture}
    \coordinate (A) at (5,0);
    \coordinate (B) at (0,0);
    \coordinate (C) at (2,3);
    \draw pic [draw, green] {angle = A--B--C};   
    \draw pic {dangle={(A)--(B)--(C)}} ;
    \draw[thick] (A) node[right]{A} -- (B) node[left]{B} -- (C) node[right]{C};  
 \end{tikzpicture}
 \end{document}

Triangle with green angle

I can not use angle within my own pic. Is it possible to nest pics? How? I created the temp coordinates (AA), (BB) and (CC) because this is written in the manual:

The three points ⟨A⟩, ⟨B⟩, and ⟨C⟩ must be the names of nodes or coordinates; you cannot use direct coordinates like “(1,1)” here.

-but I can still not make it work!

An other thing is that the calling syntax is not the same angle = A--B--C vs dangle={(A)--(B)--(C)}. Can someone explain why it is that way or how to correct it?

0

2 Answers 2

2

Try

\documentclass[tikz, border =3mm]{standalone}
\usetikzlibrary {angles}

\begin{document}
    \begin{tikzpicture}
\coordinate[label=right:A] (A) at (5,0);
\coordinate[label= left:B] (B) at (0,0);
\coordinate[label=above:C] (C) at (2,3);
%
\pic [draw=green, double] {angle = A--B--C};
%   
\draw[thick]    (A) -- (B) -- (C);
\draw[red]      (C) -- (A);
    \end{tikzpicture}
\end{document}

enter image description here

Is this what you looking for? Distance between arcs lines you can adjust with double distance=dimension, for example double distance=5pt, which you add to \pic options.

Addendum 1: now i recognize, that your question is actually duplicate to question for which you provide a link. If you like to nest more pic, just write it more with different angle radius:

\documentclass[tikz, border =3mm]{standalone}
\usetikzlibrary {angles}

\begin{document}
    \begin{tikzpicture}
\coordinate[label=right:A] (A) at (5,0);
\coordinate[label= left:B] (B) at (0,0);
\coordinate[label=above:C] (C) at (2,3);
% see different angle radius
\pic [draw=green, angle radius=7mm] {angle = A--B--C}; 
\pic [draw=green, angle radius=8mm] {angle = A--B--C};
\pic [draw=green, angle radius=9mm] {angle = A--B--C};
%   
\draw[thick]    (A) -- (B) -- (C);
\draw[red]      (C) -- (A);
    \end{tikzpicture}
\end{document}

enter image description here

Addendum 2: It seems that your problem is to correct your style \dangle definition. It can't be defined on the way, as you try. Instead you can define new command, which will draw two arcs for angle mark:

\documentclass[tikz, border = 0.5 cm]{standalone}
\usetikzlibrary {angles}
\newcommand\dangle[3]{ % <---
        \pic [draw, angle radius=6 mm] {angle = #1--#2--#3};
        \pic [draw, angle radius=7 mm] {angle = #1--#2--#3};
                     }

 \begin{document}
  \begin{tikzpicture}
\coordinate[label=right:A] (A) at (5,0);
\coordinate[label= left:B] (B) at (0,0);
\coordinate[label=above:C] (C) at (2,3);
%
\dangle{A}{B}{C};
\draw[thick]    (A) -- (B) -- (C); 
\end{tikzpicture}
 \end{document}

by which you will get:

enter image description here

In the case, that you like to have colored arcs, than you only need add color to angle definition. For example

\pic [draw=green, angle radius=6 mm] {angle = #1--#2--#3}
\pic [draw=red,   angle radius=7 mm] {angle = #1--#2--#3}

which yield to:

enter image description here

On a similar way you can define command for even more arcs' marks for particular angle.

9
  • Yes nice, and I guess, that I can make a triple angle by techniques from tex.stackexchange.com/questions/38431/triple-lines-in-tikz . Though I would like to know if it is possible in the way I started: nested pics!? Aug 12, 2020 at 15:05
  • Please see answer from js bibra and edit. Aug 12, 2020 at 15:34
  • @hpekristiansen, why? What you miss in my answer. As now see, your question is duplicate to question which link you provide ...
    – Zarko
    Aug 12, 2020 at 16:21
  • I do not miss anything - your answer is perfect. The reason I do not delete my question is the theoretical aspect about nesting pics and the calling syntax for angle. Aug 12, 2020 at 16:23
  • Ok now my question is going to be closed anyway - guess I will never know Aug 12, 2020 at 16:24
1

https://tex.stackexchange.com/a/457830/197451

enter image description here

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{angles}
\begin{document}
    \begin{tikzpicture}[double arc/.style={double,double distance=2pt},
%                       triple arc/.style={double distance=4pt,
%                       pic actions/.append code=\tikzset{postaction={draw}}}
]
    \coordinate (A) at (5,0);
    \coordinate (B) at (0,0);
    \coordinate (C) at (2,3);
 \draw[thick] (A) node[right]{A} -- (B) node[left]{B} -- (C) node[right]{C};  
\draw   pic [draw,double arc,angle radius=1cm] {angle=A--B--C};

    \end{tikzpicture}
\end{document}
1
  • 1
    Thanks - I do not know why I did not find that. Seem like my question is a duplicate. Aug 12, 2020 at 15:25

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