Graphics, Figures & Tablescoordinates

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

coordinates

Post by kent »

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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

coordinates

Post by Stefan Kottwitz »

Hi Kent,

welcome to the forum!

You could use
test

Code: Select all

\path (A);
\pgfgetlastxy{\xcoord}{\ycoord}
to store the values in these macros.

Stefan
LaTeX.org admin
kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

Re: coordinates

Post by kent »

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: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: coordinates

Post by Stefan Kottwitz »

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
LaTeX.org admin
kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

Re: coordinates

Post by kent »

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: 10324
Joined: Mon Mar 10, 2008 9:44 pm

coordinates

Post by Stefan Kottwitz »

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

Code: Select all

\makeatletter
\newcommand{\getcoords}[3]{%
   \tikz@scan@one@point\pgfutil@firstofone(#1)\relax
  \edef#2{\the\pgf@x}%
  \edef#3{\the\pgf@y}%
}
\makeatother
Then use it in a tikzpicture environment such as:

Code: Select all

\getcoords{A}{\xcoord}{\xcoord}
% just print the x and y values:
\node {\xcoord,\xcoord};
Stefan
LaTeX.org admin
kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

Re: coordinates

Post by kent »

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