LaTeX forum ⇒ Graphics, Figures & Tablescoordinates Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

coordinates

Postby kent » Tue Oct 25, 2016 2:38 pm

I wonder how one easily can get from (A) defined by \cordinate (A) at ...
to the specific x and y coordinates of (A). I do not have the angle package available in PGF 3.0 or tkz-2d etc..
Kent Holing
NORWAY

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 9501
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Tue Oct 25, 2016 3:19 pm

Hi Kent,

welcome to the forum!

You could use

  1. test


Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \path (A);
  2. \pgfgetlastxy{\xcoord}{\ycoord}


to store the values in these macros.

Stefan
Site admin

kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

Postby kent » Tue Oct 25, 2016 3:57 pm

Thanks for a quick reply indeed!
My PGF 2.0 don't find the command \pgfgetlastxy I am afraid.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9501
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Tue Oct 25, 2016 4:06 pm

PGF 2.0 is very old, it's very recommendable to update. PGF 2.10 and 3.0 provide new features and libraries. I have no way to test something with the old 2.0.

Stefan
Site admin

kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

Postby kent » Wed Oct 26, 2016 9:38 am

I appreciate your kind help Stefan.

Can anybody else out there have a solution of my problem using PGF 2.0?
If so, I would be delighted to hear about it.
Regards,
Kent

User avatar
Stefan Kottwitz
Site Admin
Posts: 9501
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Wed Oct 26, 2016 10:06 am

You could try this way, by defining that macro (I think I read it in post by Andrew Stacey):

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \makeatletter
  2. \newcommand{\getcoords}[3]{%
  3. \tikz@scan@one@point\pgfutil@firstofone(#1)\relax
  4. \edef#2{\the\pgf@x}%
  5. \edef#3{\the\pgf@y}%
  6. }
  7. \makeatother


Then use it in a tikzpicture environment such as:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \getcoords{A}{\xcoord}{\xcoord}
  2. % just print the x and y values:
  3. \node {\xcoord,\xcoord};


Stefan
Site admin

kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

Postby kent » Wed Oct 26, 2016 10:56 am

Stefan, it works! Great and thanks. I really appreciate it.
Kent


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 11 guests