7

This may be well-known, but I cannot remember having encountered this before. Here's a minimal example:

\documentclass[12pt,a4paper]{amsart}
\usepackage{tikz}
\begin{document}

\tikzset{vert/.style={circle,inner sep=1mm,draw}}
\tikzset{edge/.style={draw=#1,very thick}}
\begin{center}
\begin{tikzpicture}[scale=2.5]
\node[vert] (a) at (1.,1.3){};
\node[vert] (b) at (1.7,1.3){};
\draw[edge=blue,out=0,in=225] (a) to (b);
\end{tikzpicture}
\begin{tikzpicture}[scale=2.5,rotate=225]
\node[vert] (a) at (1.,1.3){};
\node[vert] (b) at (1.7,1.3){};
\draw[edge=blue,out=0,in=225] (a) to (b);
\end{tikzpicture}
\end{center}

\end{document}

In the rotated picture, the line is not attached correctly to the nodes:

enter image description here

Is that really a bug, or am I missing something? any known fix?

  • It's definitely not new, I can reproduce this behaviour with PGF as old as 3.0.0 (TeX Live 2015). – Henri Menke Aug 19 at 1:41
  • 2
    If you add transform shape to the picture you get the correct curve but of course also a scaling of the nodes. – Henri Menke Aug 19 at 1:54
  • I'm not sure whether it is a bug or not, but the behaviour should definitely be more predictable. I opened a new issue for that: github.com/pgf-tikz/pgf/issues/730 – Henri Menke Aug 19 at 4:38
9

I agree with Shady Puck that this is not a bug. However, an arguably more precise way of explaining what's going on is to recall that by default nodes do not get transformed. If you want to transform them, i.e. subject the node anchors to the transformations, you need to say transform shape. (In your setting, one needs to undo the scale transformation to match the presumably desired result.)

\documentclass[12pt,a4paper]{amsart}
\usepackage{tikz}
\begin{document}

\tikzset{vert/.style={circle,inner sep=1mm,draw}}
\tikzset{edge/.style={draw=#1,very thick}}
\begin{center}
\begin{tikzpicture}[scale=2.5]
\node[vert] (a) at (1.,1.3){};
\node[vert] (b) at (1.7,1.3){};
\draw[edge=blue,out=0,in=225] (a) to (b);
\end{tikzpicture}
\begin{tikzpicture}[scale=2.5,rotate=225,transform shape]
\node[vert,scale=1/2.5] (a) at (1.,1.3){};
\node[vert,scale=1/2.5] (b) at (1.7,1.3){};
\draw[edge=blue,out=0,in=225] (a) to (b);
\end{tikzpicture}
\end{center}
\end{document}

enter image description here

  • 1
    Nice explanation. Are you really a cat (assuming it is possible to know)? – frougon Aug 19 at 14:49
  • 1
    @frougon Nothing is certain in our (quantum) world. – Schrödinger's cat Aug 20 at 3:22
6

It's not a bug -- the behavior is easily fixed.

When you specify a modifier for the whole picture, what TikZ does is apply this modifier to the picture and each object individually. Therefore, it is necessary to offset this individual rotation from the general with our own proportional individualized rotations. After fiddling with the signs for a hot second, I got this code to produce this result.

\tikzset{vert/.style={circle,inner sep=1mm,draw}}
\tikzset{edge/.style={draw=#1,very thick}}
\begin{tikzpicture}[scale=2.5]
    \node[vert] (a) at (1.,1.3){};
    \node[vert] (b) at (1.7,1.3){};
    \draw[edge=blue,out=0,in=225] (a) to (b);
\end{tikzpicture}
\begin{tikzpicture}[scale=2.5,rotate=225]
    \node[vert,rotate=-225] (a) at (1.,1.3){};
    \node[vert,rotate=225] (b) at (1.7,1.3){};
    \draw[edge=blue,out=0,in=225] (a) to (b);
\end{tikzpicture}

enter image description here

  • You have to rotate both nodes by 225. The minus sign for (a) is wrong. – Henri Menke Aug 19 at 4:40
  • @HenriMenke Just turn the second node 225, the first node turns without any problem. \node[vert] (a) at (1.,1.3){};\node[vert,rotate=225] (b) at (1.7,1.3){}; – AndréC Aug 19 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.