我想在这棵树上添加方括号中所示的标签。我有一个可以生成这棵树的工作代码。
\usepackage{tikz-qtree}
\tikzset{every tree node/.style={minimum width=2em,draw,circle},
blank/.style={draw=none},
edge from parent/.style=
{draw,edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}},
level distance=1.5cm}
\begin{tikzpicture}
\label{binary tree}
\Tree
[.$\vee$
$A$
[.$\wedge$
$B$
[.$\vee$ $C$ $D$
]
]
]
\end{tikzpicture}
答案1
你可以随时给你的节点命名
\documentclass[tikz]{standalone}
\usepackage{tikz-qtree}
\tikzset{every tree node/.style={minimum width=2em,draw,circle},
blank/.style={draw=none},
edge from parent/.style=
{draw,edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}},
level distance=1.5cm}
\begin{document}
\begin{tikzpicture}
\label{binary tree}
\Tree
[.\node (1) {$\vee$};
\node (A) {$A$};
[.\node (2) {$\wedge$};
\node (B) {$B$};
[.\node (3) {$\vee$}; \node (C) {$C$}; \node (D) {$D$};
]
]
]
\path (1.east) node[right] {[a]};
\end{tikzpicture}
\end{document}