The fact is that I am using \pgfextractx and \pgfextracty to get the x,y values from a coordinate. They return 0 to me regardless of the content of my coordinate. That is, this

\coordinate (E) at (0.308017, -0.951057);

returns me 0 while we know it should return 0.308017. However when I use \pgfpoint it works. That is


returns me a "1" which is fine. I want to do this with coordinates no with pgfpoints. Can I convert one into the other?

Otherwise how can extract a coordinate without having to use pgfpoint, or path or addplot or other weird things? What would be the best solution?

**This is not an answer but my comment (actually question) will not fit in a comment slot.

When I use the code:

\coordinate (E) at (0.308017pt, -0.951057pt);

\coordinate (H) at (\ex, \ey);
\node[] at (H) {This is E    };


Which produces the figureenter image description here

Yes, the 1.2 is located in a bad place but it is telling me that "pgfmathprintnumber" is working. However when I change the line


for the line


The code does not compile. Here is the error:

Package pgfplots Warning: running in backwards compatibility mode (unsuitable ti ck labels; missing features). Consider writing \pgfplotsset{compat=1.12} into yo ur preamble. on input line 10.

! Missing \endcsname inserted. \ex l.20 \pgfmathprintnumber{\ex} ;

do not worry about the "backwards compatibility" I already tried adding the line suggested above and nothing changes. Why the error? it is like if it did not understand the variable "\ex" so that this method did not work.

I am following @Ulrike advise but without the line "\showthe\ex" since that line was giving me another compilation error.

Now, if instead I use the line:

\node[] at (H) {\pgfmathprintnumber{\ex}};

The code does gives me this error:

! Missing \endcsname inserted. \ex l.19 \node[] at (H) {\pgfmathprintnumber{\ex} };

An the output is the Figure: enter image description here

Which says something like "ex" is a NaN (not a number) object?


Now, here is a compilation error that happens when I used "\the\ex" as suggested by @Tornbjorn .

been generated with the most recent feature set (\pgfplotsset{compat=1.12}).

! Package PGF Math Error: Could not parse input '8.76384pt' as a floating point number, sorry. The unreadable part was near 'pt'..

See the PGF Math package documentation for explanation. Type H for immediate help. ...

l.19 ...) {This is E \pgfmathprintnumber{\the\ex} }; ?


I solved my problem without having to convert from coordinate to pgfpoint and viceversa.

My issue was mostly because trying to extract the coordinates.

I learned from the following link: Accessing the logic values of a TikZ coordinate

and mainly from the macro:

  \path let \p1=(#3) in \pgfextra{
    \xdef#1{#1} \xdef#2{#2}

which works quite good in my case. Thanks all for your help.

  • Welcome to TeX.SX! I don't see the connection to pgfplots, so I removed that tag. – Torbjørn T. Oct 18 '15 at 20:21
  • @Zarko Thanks for editing my question. You fixed in addition my code to look pretty. So I should indent the lines so that they get into a gray box? Thanks again. – Herman Jaramillo Oct 18 '15 at 20:52
  • (Well, I did that, not Zarko.) But never mind. The easiest way to higlight code is to select it and hit Ctrl + K (or click the button marked {} above the text field). Blocks will be indented with four spaces, inline code placed between backticks (`). – Torbjørn T. Oct 18 '15 at 21:00
  • No, before me @TorbjørnT. edited your question ... If you click on edited before ... you can see, who edit your question what he/she change. In your case all credits go to TorbjørnT. – Zarko Oct 18 '15 at 21:05
  • @TorbjørnT. sorry for the late reply. Thanks for editing my question as well for the tip, which I have used several times now. – Herman Jaramillo Oct 18 '15 at 22:53

You can use \pgfpointanchor


\coordinate (E) at (0.308017pt, -0.951057pt);
| improve this answer | |
  • I tried this solution. It gave me (/usr/local/texlive/2015/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)) > 0.30801pt. l.12 \showthe\ex Thanks for your help – Herman Jaramillo Oct 18 '15 at 21:38
  • 1
    \showthe is a command to show the current value of a register. With a dimen register it shows the value in pt. \showthe stops the compilation, you can continue by hitting tex. As you are using tex commands like \newdimen in your example I expected that you know \showthe to. – Ulrike Fischer Oct 19 '15 at 7:34

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.