这个简单的代码创建了在 $\otimes$ 符号处相交的 3 条边的交点:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0, 0)(A) {A};
\node at (0, 2.0)(B) {B};
\node at (2.0, 1.6)(C) {C};
\node at (1.0, 1.2)(X) {$\otimes$};
\draw[line width=2](A) -- (X);
\draw[line width=2](B) -- (X);
\draw[line width=2](C) -- (X);
\end{tikzpicture}
\end{document}
我怎样才能使边缘真正到达$\otimes$符号或尽可能接近,就好像符号位于交叉点上一样?
它看起来应该是这样的(请原谅我的绘画技巧):
答案1
您可以使用负值的“缩短”选项
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0, 0)(A) {A};
\node at (0, 2.0)(B) {B};
\node at (2.0, 1.6)(C) {C};
\node at (1.0, 1.2)(X) {$\otimes$};
\draw[line width=2,shorten >=-5pt](A) -- (X);
\draw[line width=2,shorten >=-6pt](B) -- (X);
\draw[line width=2,shorten >=-4pt](C) -- (X);
\end{tikzpicture}
\end{document}
答案2
您可以为节点赋予特定的形状,而不是使用\otimes
作为其内容(如果仔细放大,您会看到线条接触圆圈但仅在中间,在外边缘留下小间隙):
\documentclass{standalone}
\usepackage{tikz}
\tikzset{
cross/.append style={
append after command={
\pgfextra{
\draw (\tikzlastnode.north west) -- (\tikzlastnode.south east)
(\tikzlastnode.north east) -- (\tikzlastnode.south west);
}
}
}
}
\begin{document}
\begin{tikzpicture}
\node at (0, 0)(A) {A};
\node at (0, 2.0)(B) {B};
\node at (2.0, 1.6)(C) {C};
\node[draw, circle, cross, inner sep=3pt] at (1.0, 1.2) (X) {};
\draw[line width=2](A) -- (X);
\draw[line width=2](B) -- (X);
\draw[line width=2](C) -- (X);
\end{tikzpicture}
\end{document}
答案3
这将在线条上方绘制符号。请注意\otimes
(像每个字符一样)本身是一个矩形。负内分离是通过反复试验找到的。
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0, 0)(A) {A};
\node at (0, 2.0)(B) {B};
\node at (2.0, 1.6)(C) {C};
\coordinate (X) at (1.0, 1.2);
\draw[line width=2](A) -- (X);
\draw[line width=2](B) -- (X);
\draw[line width=2](C) -- (X);
\node[circle, inner sep=-1.3pt, fill=white] at (X) {$\otimes$};
\end{tikzpicture}
\end{document}