Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

It is possible to change the x distance within TikZ internal coordinate system by passing the /tikz/x= key to the tikzpicture environment.

\begin{tikzpicture}[x=14pt]
% Picture code
\end{tikzpicture}

I need to get the value stored inside this key within a picture to perform some calculations. Is it possible to do so ? What I'm looking for is something like this...

 \begin{tikzpicture}[x=14pt]
 % Some command to get the x value and store it in a macro for example /myx

 %\pgfkeysvalueof{/tikz/x} or \pgfkeys{/tikz/x/.get=\myx} don't seem to work

 % Use the \myx in calculations
 \end{tikzpicture}
share|improve this question

1 Answer 1

Unfortunately the value isn't stored inside the key, as it is parsed immediately (the argument to the |x| key can be a coordinate) and then passed on to \pgfsetxvec.

But there are still a couple of ways to get the x-component of the coordinate system.

\documentclass[tikz,border=5]{standalone}
\begin{document}
\makeatletter
\begin{tikzpicture}[x=14pt]
\pgfqpointxy{1}{0}\pgfgetlastxy\x\y
\node {$x_1$: \x, $x_2$: \the\pgf@xx};
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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