从 TikZ 获取 x 和 y 坐标

Getting the x and y coordinates from TikZ

对于以下

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

如何提取 x 坐标。也就是说,我假设formula.northwest的形式是(x,y),如何分别得到x和y坐标?

我正在使用 \tikzmath 并想做类似

的事情

\x1 = (formula.north 西).x

这是否有意义?

您可以使用let操作将坐标分配给点寄存器:

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

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