获取TikZ节点的线宽和内部sep

问题描述

是否可以使用密钥树检索节点的inner sepline width?我的确切用例如下。

我想在下面的图像中找到红色标记的坐标,但是不使用下面使用的方法。基本上,我想要的是north east锚点(或矩形上的其他锚点),如果它位于边界线的中间而不是外部边缘,以及它是否位于边界上。添加inner sep之前节点的内容。我不想像下面那样使用重复的“幻像”节点,因为在我的用例中,该节点的内容可能很乱。

我还意识到,我可以通过使用line width,将它们应用于节点并使用相同的宏相对于inner sep进行导航来全局保存\pgfmathsetlength{}{}north east ,或通过定义自定义键以类似的方式。但是我真的很想直接询问该节点,就像这些值在\node [inner sep=1.2em] {};之类的节点选项中被指定为文字一样。

图片:

image

代码:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

  \node [draw,line width=5pt,inner sep=8pt] (A) {foo};

  \node [draw=cyan,line width=2pt,inner sep=8pt] (B) {\phantom{foo}};
  \node [line width=0pt,inner sep=0pt] (C) {\phantom{foo}};
  \node [line width=0pt,inner sep=8pt] (D) {\phantom{foo}};

  % Basically I don't want to use nodes C and D,I want everything relative to A
  \draw [red] plot [mark=x] coordinates { (C.north east) };
  \draw [red] plot [mark=x] coordinates { (D.north east) };
  \draw [green] plot [mark=x] coordinates { (A.north east) };

\end{tikzpicture}
\end{document}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)