I am trying to build my trees using macros, but I am not getting the result that I want. Here is a minimal example:
\ documentclass {article}
\ usepackage {tikz}
\ usetikzlibrary {trees}
\ newcommand {\ LeafNode} [1] {%
child {node {# 1}}
}
\ newcommand {\ InnerNode} [3] {%
child {node {# 3}
#1
# 2
}
}
\ begin {document}
\ begin {tikzpicture}
\ node (A) {A}
\ LeafNode {B}
\ LeafNode {C}
;
\ end {tikzpicture}%
\ hspace {2cm}%
\ begin {tikzpicture}
\ node (A) {A}
\ InnerNode {\ LeafNode {D}} {\ LeafNode {E}} {B}
\ LeafNode {C}
;
\ end {tikzpicture}
\ end {document}
I expected this to create two trees:
AA
/ \ / \
BCBC
/ \
DE
but I get:
A
|
Ab
| |
Bd
| |
CC
- ?
, node, PGF:
! Package pgf Error: No shape named is known.
- Tsf