森林:使用省略号(...)并增加节点之间的水平空间

森林:使用省略号(...)并增加节点之间的水平空间

寻找如何在 $B_{1}$ 和 $B_{n} 之间插入省略号 (...){1}$并增加$B之间的水平空间{n}U 和 $B 的 {1}$下图中 R 在 K 下的 {1}$。

\documentclass{standalone}    
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta}

\begin{document}

\begin{forest}
    for tree = {
      draw
    , rounded corners = 0mm
    , align = center
    , font = \normalsize
    %, minimum width  = 1cm
    %, minimum height = 1cm
    , edge = {blue, -Latex, very thick}
    , s sep = 1mm
    , l sep = 10mm
    , forked edge
    , fork sep = 4mm
    %, inner xsep = 5pt
    %, fit = band % rectangle
    %, inner ysep = 2pt
    }
    [C, font = \Huge, color = black, fill = green!100, draw = green!80!darkgray
        [C1, font = \huge, color = white, fill = blue!80, draw = blue!80!darkgray
            [K, font = \Large, color = black, fill = yellow!80, draw = yellow!80!darkgray
                [U, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{1}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ]
                [R, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                       [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{2}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ]
            ]
            [G, font = \Large, color = black, fill = yellow!80, draw = yellow!80!darkgray
                [U, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{3}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ]
                [R, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{4}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ]
            ]
            [A, font = \Large, color = black, fill = yellow!80, draw = yellow!80!darkgray
                [U, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{5}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ]
                [R, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{6}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ]
            ]
        ]
        [C2, font = \huge, color = white, fill = blue!80, draw = blue!80!darkgray
            [P, font = \Large, color = black, fill = yellow!80, draw = yellow!80!darkgray
                [U, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{7}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ]
                [R, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{8}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ]
            ]
        ]
        [C3, font = \huge, color = white, fill = blue!80, draw = blue!80!darkgray
            [S, font = \Large, color = black, fill = yellow!80, draw = yellow!80!darkgray
                [U, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{9}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ], font = \large, color = white, fill = black!80, draw = black!80!darkgray
                [R, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{10}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ]
            ]
            [B, font = \Large, color = black, fill = yellow!80, draw = yellow!80!darkgray
                [U, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{11}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ], font = \large, color = white, fill = black!80, draw = black!80!darkgray
                [R, font = \large, color = white, fill = black!80, draw = black!80!darkgray
                    [$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$B_{n_{12}}$, color = white, fill = red!80, draw = red!80!darkgray]
                ]
            ]
        ]
    ]  
\end{forest}

\end{document}

在此处输入图片描述

答案1

您可以在节点[$\cdots$, draw=none, no edge]之间添加B

[$B_{1}$, color = white, fill = red!80, draw = red!80!darkgray][$\cdots$, draw=none, no edge][$B_{n_{1}}$, color = white, fill = red!80, draw = red!80!darkgray]

在此处输入图片描述

相关内容