我有以下tikz
绘制四棵不同树的代码。
\begin{tikzpicture}[level distance=1.5cm,
level 1/.style={sibling distance=3cm},
level 2/.style={sibling distance=1.5cm}]
\node {R}
child { node {O}
child { node {M}
child { node {A} }
}
child { node {A}
child { node {M} }
}
}
child { node {M}
child { node {O}
child { node {A} }
}
child { node {A}
child { node {O} }
}
}
child { node {A}
child { node {O}
child { node {M} }
}
child { node {M}
child { node {O} }
}
}
;
\end{tikzpicture}
\begin{tikzpicture}[level distance=1.5cm,
level 1/.style={sibling distance=3cm},
level 2/.style={sibling distance=1.5cm}]
\node {O}
child { node {R}
child { node {M}
child { node {A} }
}
child { node {A}
child { node {M} }
}
}
child { node {M}
child { node {R}
child { node {A} }
}
child { node {A}
child { node {R} }
}
}
child { node {A}
child { node {R}
child { node {M} }
}
child { node {M}
child { node {R} }
}
}
;
\end{tikzpicture}
\begin{tikzpicture}[level distance=1.5cm,
level 1/.style={sibling distance=3cm},
level 2/.style={sibling distance=1.5cm}]
\node {M}
child { node {O}
child { node {R}
child { node {A} }
}
child { node {A}
child { node {R} }
}
}
child { node {R}
child { node {O}
child { node {A} }
}
child { node {A}
child { node {O} }
}
}
child { node {A}
child { node {R}
child { node {O} }
}
child { node {O}
child { node {R} }
}
}
;
\end{tikzpicture}
\begin{tikzpicture}[level distance=1.5cm,
level 1/.style={sibling distance=3cm},
level 2/.style={sibling distance=1.5cm}]
\node {A}
child { node {O}
child { node {R}
child { node {M} }
}
child { node {M}
child { node {R} }
}
}
child { node {R}
child { node {O}
child { node {M} }
}
child { node {M}
child { node {O} }
}
}
child { node {M}
child { node {R}
child { node {O} }
}
child { node {O}
child { node {R} }
}
}
;
\end{tikzpicture}
用英语来说,puoi dire:
我想将这些树用作一棵更大树的分支,从无标签的根节点开始。生成的树应该是单词“ROMA”的字谜。
答案1
抱歉,您的问题不太清楚。如果您能提供预期结果的草图,那将有很大帮助。
到目前为止,我只能建议使用forest
包而不是tikz
(使用它的代码更简单和更短)并展示如何绘制一棵树,其中没有内容的根节点有四个分支:
\documentclass[margin=3mm]{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree = {l sep = 6mm,
s sep = 2mm,
}
[ , coordinate
[R
[? [??]]
[?? [?]]
]
[O
[M [A]]
[A [M]]
]
[M
[O [A]]
[A [O]]
]
[A
[O [M]]
[M [O]]
]
]
\end{forest}
\end{document}
上面的树形结构是您想要的吗?
将正确的字母插入我留给你的节点中。