I am using the angles
library to label angles in my diagrams. I'm noticing, however, that the arc created by the angles
package rests on a layer above the rest of the diagram by default, i.e., the following MWE produces the picture below it and to the left.
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles}
\begin{document}
\begin{tikzpicture}
\draw [red,thick]
(0,0) coordinate (B) --
(2,0) coordinate (A) --
(2,1.2) coordinate (C) pic[pic text={$\theta$},draw,black,ultra thick,angle radius=8mm,angle eccentricity=1.2]{angle} --
cycle
;
\end{tikzpicture}
\end{document}
I would like to produce a picture where the arc lies on a lower layer (as in the picture above and to the right). As I understand it, this should be possible by adding the behind path
key to the optional parameters describing the pic
(the behind path
key does work on my computer with both nodes and pics outside of the angles
library, so I'm pretty sure it's just a problem with angles
). However, this has no effect. What's up with this behavior, and what modification to the optional parameters describing the pic
will produce the intended result?
Note that the following MWE produces the desired result (the picture above and to the right) using the backgrounds
library and a scope
. I am asking, though, how to avoid using this construct (or, I suppose, drawing a second red triangle on top of the original, or any other forced construct).
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles,backgrounds}
\begin{document}
\begin{tikzpicture}
\draw [red,thick]
(0,0) coordinate (B) --
(2,0) coordinate (A) --
(2,1.2) coordinate (C) --
cycle
;
\begin{scope}[on background layer]
\pic[pic text={$\theta$},draw,ultra thick,angle radius=8mm,angle eccentricity=1.2]{angle};
\end{scope}
\end{tikzpicture}
\end{document}
Thanks!
Concerning the sector that makes up the drawing of the angle, the angular part of this sector is drawn in front of the path if the draw option is given to the pic, while filled sector is drawn behind the pic, provided an option like fill or shade is passed to the pic.
Note that behind path only applies to the current path; not to the current scope or picture.
So the problem is the red triangle drawn before is NOT the current path when you draw the angle symbol.