Getting the x and y coordinates from TikZ

Viewed 1549

For the following

\node (formula) [] {$2x+3y$};
\draw[-latex,red] ($(formula.north west)$) arc

How could I extract the x coordinate. That is, I'm assuming that formula.north west is in the form (x,y), how can I get the x and y coordinates separately?

I'm using \tikzmath and want to do something like

\x1 = (formula.north west).x

if that makes sense?

1 Answers

You can use the let operation to assign the coordinate to a point register:

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\node (formula) [] {$2x+3y$};
\draw[red] let \p1 = (formula.north west)
           in (\x1,\y1) circle [radius=0.1];
\end{tikzpicture}
\end{document}
Related