TikZ 中的下支架

TikZ 中的下支架

我有以下 tikzpicture:

在此处输入图片描述

生成者:

\begin{figure}[H]
\centering
\begin{tikzpicture}[level/.style={}]
\node [circle,draw] (z){$f$}
child {node [circle,draw] (g1) {$x_1$}}
child {[white] node [black] (g2) {$\dots$}}
child {node [circle,draw] (g3) {$x_1$}}
child {node [circle,draw] (g4) {$x_2$}}
child {[white] node [black] (g5) {$\dots$}}
child {node [circle,draw] (g6) {$x_2$}}
child {[white] node [black] (g7) {$\dots$}}
child {node [circle,draw] (g8) {$x_m$}}
child {[white] node [black] (g9) {$\dots$}}
child {node [circle,draw] (g10) {$x_m$}};
\end{tikzpicture}
\end{figure}

现在我想添加下支架,如我的(如果我可以这么说的话,相当漂亮)绘画所示:

在此处输入图片描述

我该如何在 tikz 中做到这一点?

答案1

带有图书馆装饰decorations.pathreplacing

在此处输入图片描述

\documentclass[border=4mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[level/.style={},decoration={brace,mirror,amplitude=7}]
\node [circle,draw] (z){$f$}
child {node [circle,draw] (g1) {$x_1$}}
child {[white] node [black] (g2) {$\dots$}}
child {node [circle,draw] (g3) {$x_1$}}
child {node [circle,draw] (g4) {$x_2$}}
child {[white] node [black] (g5) {$\dots$}}
child {node [circle,draw] (g6) {$x_2$}}
child {[white] node [black] (g7) {$\dots$}}
child {node [circle,draw] (g8) {$x_m$}}
child {[white] node [black] (g9) {$\dots$}}
child {node [circle,draw] (g10) {$x_m$}};

\draw [decorate] ([yshift=-5mm]g1.west) --node[below=3mm]{$n_1$} ([yshift=-5mm]g3.east);
\draw [decorate] ([yshift=-5mm]g4.west) --node[below=3mm]{$n_2$} ([yshift=-5mm]g6.east);
\draw [decorate] ([yshift=-5mm]g8.west) --node[below=3mm]{$n_m$} ([yshift=-5mm]g10.east);
\end{tikzpicture}
\end{document}

相关内容