# Sloping is wrong for sloped node text

For some reason, when I use both xscale and yscale, node sloping is off, see MWE. How do I fix this so the node text aligns properly with the path?

\documentclass{minimal}
\listfiles
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[xscale=1.3, yscale=2.2]
\node (P2) at (4,0) {};
\node (RA) at (7,-2) {};
\path (P2) edge node[sloped, above] {node text} (RA);
\end{tikzpicture}
\end{document}


(tikz.sty 2013/12/13 v3.0.0 (rcs-revision 1.142))

• How can I get my MWE to also display the compilation result? Do I need to compile it myself and attach the generated file? – Uli Fahrenberg Sep 25 '15 at 12:53
• Take a screen shot of the pdf image and upload it pressing the img button (or ctrl + G). – user11232 Sep 25 '15 at 13:10

I don't know why you need those scales but when you scale, it is applied to lengths not shapes. You have to pass the option transform shape also.

\documentclass{article}
\listfiles
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[xscale=1.3, yscale=2.2,transform shape]
\node (P2) at (4,0) {};
\node (RA) at (7,-2) {};
\path (P2) edge node[sloped, above] {node text} (RA);
\end{tikzpicture}
\end{document}


This has the effect of scale being applied to node text too. If you don't want that use the following:

\documentclass{article}
\listfiles
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[x=1.3cm, y=2.2cm]
\node (P2) at (4,0) {};
\node (RA) at (7,-2) {};
\path (P2) edge node[sloped, above] {node text} (RA);
\end{tikzpicture}
\end{document}


• I know about "transform shape", but I don't want to scale the node text. The "scale"s are there because I first logically design the figure and then scale it so it displays well. (This is just a small part of a bigger picture.) – Uli Fahrenberg Sep 25 '15 at 12:45
• @UliFahrenberg: Please see the edit. Is that what you want? – user11232 Sep 25 '15 at 12:56
• Yes! Thank you! (I've learned tikz by looking at other people's code, so for some reason I knew about "xscale" and "yscale" but not about "x" and "y"...) – Uli Fahrenberg Sep 25 '15 at 13:00