pgf/tikz 线段转三角形

pgf/tikz 线段转三角形

我正在尝试画一棵简单的树。

这是乳胶代码:

\begin{tikzpicture}
\node at (2,-2) [circle,draw,minimum size=8mm] (A) {$\alpha$};
\node at (0,-4) [circle,draw,minimum size=8mm] (B) {$\beta$};
\node at (4,-4) (C) {};
\node at (4,-4)
[isosceles triangle, shape border rotate=+90,
draw,minimum size=8mm,minimum height=2cm,
anchor=north] (Ctriangle) {$\gamma$};
\draw [-,thick] (A) to (B);
\draw [-,thick] (A) to (C);
;
\end{tikzpicture}

这是图片:

在此处输入图片描述

如何让线接触三角形的顶点

答案1

为了触摸尖端,C节点应该使用坐标,以便它是一个没有大小的点,如下所示

\node[coordinate] at (4,-4) (C) {}; 或 \coordinate (C) at (4,-4); (感谢 Adam)

\documentclass[tikz,border=1cm]{standalone}
%
\usetikzlibrary{matrix, shapes, arrows, positioning}
\begin{document}
\begin{tikzpicture}
\node at (2,-2) [circle,draw,minimum size=8mm] (A) {$\alpha$};
\node at (0,-4) [circle,draw,minimum size=8mm] (B) {$\beta$};
\node[coordinate] at (4,-4) (C) {};
\node at (4,-4) [isosceles triangle, shape border rotate=+90,
draw,minimum size=8mm,minimum height=2cm,
anchor=north] (Ctriangle) {$\gamma$};
\draw [-,thick] (A) to (B);
\draw [-,thick] (A) to (C);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容