是否可以使用不基于角度的规范来锚定到矩形?
例如,在此示例中:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning}
\definecolor{cerulean}{cmyk}{0.94,0.11,0,0}
\begin{document}
\begin{tikzpicture}
[every text node part/.style={align=center},
every two node part/.style={align=left},
font={\sf}, rectangle split part fill={cerulean!10, white}]
\node (A) [rectangle split, rectangle split parts=2, rounded corners, ultra thick, draw, text width=5cm, minimum height=1cm]
{\nodepart{text} {\bfseries A}
\nodepart{two}
\begin{tabular}{l}
$\;$B
\end{tabular}};
\node (B) [rectangle split, rectangle split parts=2, rounded corners, ultra thick,draw, text width=5cm, minimum height=1cm , below=2cm of A]
{\nodepart{text} {\bfseries B}
\nodepart{two}
\begin{tabular}{l}
$\;$C
\end{tabular}};
\draw[<->,draw, thick,>=angle 45] (A.south) -- node[right=0.1cm, font={\sf\bfseries}] {R} (B.north);
\draw[<->,draw, thick,>=angle 45] (A.-30) -- node[right=0.1cm, font={\sf\bfseries}] {P} (B.30);
\end{tikzpicture}
\end{document}
结果如下:
最右边的线有锚点{A.-30}
和{B.30}
。我想知道是否有办法将线锚定到矩形边长 1/4 处的点,类似于south
或north
,而无需指定角度(因为如果矩形改变其高度,那么我必须改变角度,如下图所示,我刚刚向矩形添加了一个新元素B
)。
我正在寻找一个简单的解决方案,例如一侧(水平或垂直)的简单分数,它允许我在不改变锚点规格的情况下更改盒子。
非常感谢。