# [Tex/LaTex] How to make labels (or other elements) rotate with a node using TikZ

diagramsrotatingtikz-pgf

Is there a way to get label text to rotate with the TikZ node to which it is attached. I can rotate the node and its text; but labels do not rotate along with the node, and instead remain "level":

\tikzset{fig/.style={regular polygon, regular polygon sides=3, label=60:A,label=below:B}}
\begin{tikzpicture}
\foreach \i in {0,1,2,3}{\node[fig,rotate=20*\i,draw] at(\i*4,0) {Text};}
\end{tikzpicture}


In general, I'd like to find a way to rotate a "composite" element, consisting of more than just a single, simple node and it's labels; for example, a shape, in which the corners have been "marked" with symbols or other shapes:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes}
% Not needed for MWE but used in my code:
%\usetikzlibrary{positioning}
%\usetikzlibrary{petri}

\begin{document}

\tikzset{fig/.style={regular polygon, regular polygon sides=3, label=60:A,label=below:B}}
\begin{tikzpicture}
\foreach \i in {0,1,2,3}{\node[fig,rotate=20*\i,draw] at(\i*4,0) {Text};}
\end{tikzpicture}

% I don't know how to create the images in the second illustration

\end{document}


\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}

\begin{document}

\begin{tikzpicture} [fig/.style={regular polygon, regular polygon sides=3}]
\foreach \i in {0,1,2,3}{%
\begin{scope} [rotate around={20*\i:(\i*4,0) },every node/.style={transform shape}]
\node[fig,draw] (t) at (\i*4,0) {Text};
\node at ([shift={(60:8pt)}]t.60)  {A}; % I prefer more possibilities
\node at ([yshift=-8pt]t.south)  {B};   % I prefer more possibilities
\end{scope}

}
\end{tikzpicture}
\end{document}


or with your code and like in Peter's answer remark : a local style is better (fig/.style here is a local style)

\begin{tikzpicture}[fig/.style={regular polygon, regular polygon sides=3, label=60:A,label=below:B}]
\foreach \i in {0,1,2,3}{
\begin{scope}[rotate around={20*\i:(\i*4,0) }, ultra thick, transform shape]
\node[fig,draw] at(\i*4,0) {Text};
\end{scope}
}
\end{tikzpicture}