tikz/pgf: positioning.lib works correct in combination w/ rotate?

Please have a look at the enclosed MWE. It shows three rectangles at different rotating angles with respect to a coordinate. When not loading the positioning library the result is as expected (see second picture below). But with this fine library the south western point of the node (as shown with the rectangle) seems to be nailed to the canvas (see first picture below).

I am definitely not sure, but I can not believe that this is the intended behaviour.

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\fill[red] (8.4,0) circle (1pt) node[rectangle,draw,above right=10pt]
{Test};
\fill[red] (8.4,-2) circle (1pt) node[rotate=45,rectangle,draw,above right=10pt]
{Test};
\fill[red] (8.4,-4) circle (1pt) node[rotate=90,rectangle,draw,above right=10pt]
{Test};
\end{tikzpicture}
\end{document}


Based on percusse's answer appears an additional question. How do I get this result?

In words: I want the west anchor of the node (which is 90° rotated) to appear 10 pt above the node. The following MWE is to no avail.

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\fill[red] (8.4,0) circle (1pt) node[rotate around={90:(0,0)},rectangle,draw,right=10pt]
{Test};
\fill[red] (8.4,-2) circle (1pt) node[rotate around={90:(0,0)},rectangle,draw,above=10pt]
{Test};
\end{tikzpicture}
\end{document}


Yes and it is the second picture that is wrong. Because that is the rotate around behavior (TikZ manual v3 Section 25.3) since rotate is given to the node not to the picture thus the node should rotate wherever it is located.

And that fine library fixes that. Combined with the fact that above right uses the anti-anchor above->below,right->left (or the compass names) and the node is fixed on that anchor, that is the expected behavior.

positioning library redefines the compass styles, here in particular

\tikzset{above right/.code=\tikz@lib@place@handle@{#1}{south west}{1}{1}{north east}{0.707106781}}

• Thanks for the explanation, I hope I got it. (I must admit that I am not that happy as I now have to check and partially correct several hundreds of pictures.) Mar 5, 2015 at 12:11

Ok, this leads me to the answer. I tested the wrong order when adding an anchor to the macro. With the following example I eventually get the text where I want it!

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\fill[red] (8.4,-2) circle (1pt) node[rotate around={90:(0,0)},rectangle,draw,above=10pt,anchor=west]
{Test};
\end{tikzpicture}
\end{document}


Here is a simple solution. The method:

• choose position: above=10pt,
• choose anchor: anchor=west,
• rotate the node around the anchor: rotate=90.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\fill[red] (8.4,0) circle (1pt) node[above=10pt,anchor=west,rotate=90,draw] {Test};
\end{tikzpicture}
\end{document}