# Same options with different order cause different behaviour

I had believed that the typeset positions of Exp1 and Exp2 in the following code should be the same on paper. The only difference between Exp1 and Exp2 is the order of the options xshift and scale. But the real typeset shows that their typeset positions are not the same. Why? And is there a general rule to determine if the order of TikZ" options should be taken into account?

MWE:

\documentclass{article}
\usepackage{tikz}
\usepackage{geometry,fancyhdr}
\geometry{showframe}
\geometry{left=2cm,right=2cm,top=2cm,bottom=2cm}
\pagestyle{fancy}
\fancyhf{}

\begin{document}
\tikz[remember picture,overlay]\path[fill=red](current page.center)node[below left]{page center for reference} circle (0.1);

% Exp 1:
\tikz[remember picture,overlay]\path(current page.center)node[xshift=2cm,scale=3]{Exp1};

% Exp 2:
\tikz[remember picture,overlay]\path(current page.center)node[scale=3,xshift=2cm]{Exp2};

\end{document}


• As you say, the order of translation and scaling gets reversed. This means that you shift by "(scale factor)*(shift distance)" but in the second example the scale factor is 3, so you shift by 6cm as opposed to 1 times 2cm in the first case. Jun 22 at 3:54
• you see same with \includegraphics, \includegraphics[width=2cm,angle=90]{...} makes an image 2cm high \includegraphics[angle=90,width=2cm]{...} makes an image 2cm wide Jun 22 at 8:37
• So, the oder of options is very important? I'm confused if there is a general rule to think about the effect of the options' order.
– lyl
Jun 22 at 9:46
• The order of transformation options count. yesterday
• A (tikz coordinate) transformation is equivalent to a transformation matrix, and applying a trans-option is to multiply the corresponding matrix to the current accumulated trans-matrix. Since matrix multiplication is not commutative in general, transformations are not too. For example, scale=3,xshift=2cm will transform (0,0) to (0,0), then to (2cm,0), but xshift=2cm,scale=3 will transform (0,0) to (2cm,0), then to (6cm,0). Bonus: scale=3,xshift=2cm is equivalent to xshift=2cm,scale around={3:(2cm,0)}. yesterday