# A few questions regarding rotate around and ++ in TikZ

\begin{tikzpicture}
\draw[help lines] (0,0) grid (15,15);
\begin{scope}[blue]
\draw[thick] (2,0) rectangle (2.4,5);
\draw[thick,rotate around={45:(2.4,5)}] (2.4,5.4) rectangle +(4,-0.4);
\draw[thick] (2.4,5)++(45:4) rectangle ++(4,0.4)--++(0,0.2)--++(0.7,0)--++(0,-0.15)--++(-0.55,0)--++(0,-0.5)--++(0.55,0)--++(0,-0.15)--++(-0.7,0)--++(0,0.2);
\end{scope}
\end{tikzpicture}


I use the preceding code to generate the previous picture. I want to rotate the rightmost rectangle together with the "hand" around the bottom-right corner of the 2nd rectangle.

1. I substitute \draw[thick,rotate around={-15:(2.4,5)++(45:4)}] for \draw[thick] in line 6. But the output is as follows. Why does this method fail?
2. Are there simple methods to get what I want? Other suggestions are welcome.

Thank you!

Presumably you can't use relative coordinates in rotate around like that. Note that it makes no difference whether you have the ++(45:4) there or not. I think the parse looks for something like <angle>:(<coordinate>), and when it reaches the first closing parenthesis for the coordinate, it stops looking.

Note also that (x,y)++(x1,y1) is not one coordinate, it's two. So you're actually making a path from (x,y) to (x+x1,y+y1). As such, I wouldn't expect it to work in rotate around in the first place.

Three possible workarounds are shown below.

1. Save the point in a coordinate first, and use that in rotate around, i.e.

\path (2.4,5)++(45:4) coordinate (x);


followed by rotate around={-15:(x)}.

2. Use the syntax of the calc library to compute the coordinate in rotate around, i.e.

rotate around={-15:($(2.4,5)+(45:4)$)}

3. Calculate the point "manually" with sine and cosine, i.e.

rotate around={-15:({2.4+4*cos(45)},{5+4*sin(45)})}


Note in this case that you need extra braces around each component, i.e. ({<x>},{<y>}). This is to "hide" the parenthesis in sin(45)/cos(45) from the parser, so they're not interpreted as the parenthesis for the end of the coordinate.

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (15,15);
\begin{scope}[blue]
\draw[thick] (2,0) rectangle (2.4,5);
\draw[thick,rotate around={45:(2.4,5)}] (2.4,5.4) rectangle +(4,-0.4);
% save point to coordinate x
\path (2.4,5)++(45:4) coordinate (x);
% use x
\draw[thick,rotate around={-15:(x)}] (2.4,5)++(45:4) rectangle
++(4,0.4)--++(0,0.2)--++(0.7,0)--++(0,-0.15)--++(-0.55,0)--++(0,-0.5)--++(0.55,0)--++(0,-0.15)--++(-0.7,0)--++(0,0.2);

\end{scope}

% with the calc library
\draw[red, dashed,thick,rotate around={-15:($(2.4,5)+(45:4)$)}] (2.4,5)++(45:4) rectangle
++(4,0.4)--++(0,0.2)--++(0.7,0)--++(0,-0.15)--++(-0.55,0)--++(0,-0.5)--++(0.55,0)--++(0,-0.15)--++(-0.7,0)--++(0,0.2);

% with "manual" calculation
\draw[cyan,densely dotted,thick,rotate around={-15:({2.4+4*cos(45)},{5+4*sin(45)})}] (2.4,5)++(45:4) rectangle
++(4,0.4)--++(0,0.2)--++(0.7,0)--++(0,-0.15)--++(-0.55,0)--++(0,-0.5)--++(0.55,0)--++(0,-0.15)--++(-0.7,0)--++(0,0.2);
\end{tikzpicture}
\end{document}