2

I'd like to access to the /tilz/scale, the pgfkeysvalueof returns an empty string.

Is there a .store macro dedicated to ?

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale=2]

\node {*\pgfkeysvalueof{/tilz/scale}*} ;

\end{tikzpicture}
\end{document}
Tarass
  • 16,912
  • I think scale might be a style for x scale and y scale (I never remember if with spaces or not). Maybe try to get the values of one of those. – Nicola Gigante Mar 09 '18 at 08:38

1 Answers1

6

The scale is not stored in the form you expect: it's passed directly to the pgf base layer. If you try

\documentclass{article}
\usepackage{tikz}
\pgfkeys{/tikz/scale/.show code}

you get

> \pgfkeysshower=\long macro:
#1\pgfeov ->\tikz@addtransform {\pgftransformscale {#1}}.
\pgfkeys@code ...keysshower }\show \pgfkeysshower 

i.e. there is a TikZ wrapper passing to \pgftransformscale. The latter stores the data in a matrix: one can recover it using \pgfgettransformentries or \pgfgettransform (the latter has everything in one macro):

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\pgfkeys{/tikz/scale = 2}
\pgfgettransformentries\aa\ab\ba\bb\xhsift\yshift
\show\aa 
\show\ab
\show\ba
\show\bb
\end{tikzpicture}
\end{document}
Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036