连接树林的元素

连接树林的元素

我正在研究分类法并使用 \forest 来构建它。我想绘制附图中以红色突出显示的部分。

\documentclass[conference]{IEEEtran}
\usepackage{etex}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{tikz,pgfplots}
\usepackage{tikz-qtree}
\usepackage{forest}
\usepackage{lettrine}
\usepackage{lscape}
\usepackage{pgf-pie}
\usetikzlibrary{positioning,shapes,arrows,shadows,patterns}
\usepackage{dashbox}
\usepackage{mathptmx}
\def\dsp{\def\baselinestretch{1.5}\large\normalsize}
\dsp
\newtheorem{theorem}{Jibberish}
\hyphenation{mar-gin-al-ia}
\begin{document}
\begin{figure}
    \centering
    {\footnotesize
        \begin{forest}
            for tree={
                grow=0,             
                parent anchor=east,
                child anchor=west,
                anchor = west,
                if n children=0{tier=word}{},
                align=center,
                edge path={                     
                    \noexpand\path[\forestoption{edge}](!u.parent anchor) -- +(5pt,0) |- (.child anchor)\forestoption{edge label};
                }                   
            }
            [xxx                        
            [yyy    
            [zzz
            [kkk]
            [lll
            [mmm]
            [mmm]
            ]
            ]               
            ]
            [yyy        
            [zzz
            [kkk
            [aaa]
            [bbb]
            ]
            [lll
            [aaa]
            [bbb]
            [ccc]
            ]
            ]    
            [zzz
            [kkk]
            [lll]
            ]       
            [zzz
            [kkk]   
            [lll]           
            [mmm]       
            ]   
            ]
            ]       
        \end{forest}
    }       
\end{figure}
\end{document}

在此处输入图片描述

答案1

您可以“作弊”并直接“手工”绘制它。

在此处输入图片描述

\documentclass[conference]{IEEEtran}
\usepackage{etex}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{tikz,pgfplots}
\usepackage{tikz-qtree}
\usepackage{forest}
\usepackage{lettrine}
\usepackage{lscape}
\usepackage{pgf-pie}
\usetikzlibrary{positioning,shapes,arrows,shadows,patterns}
\usepackage{dashbox}
\usepackage{mathptmx}
\def\dsp{\def\baselinestretch{1.5}\large\normalsize}
\dsp
\newtheorem{theorem}{Jibberish}
\hyphenation{mar-gin-al-ia}
\begin{document}
\begin{figure}
    \centering
    {\footnotesize
        \begin{forest}
            for tree={
                grow=0,             
                parent anchor=east,
                child anchor=west,
                anchor = west,
                if n children=0{tier=word}{},
                align=center,
                edge path={                     
                    \noexpand\path[\forestoption{edge}](!u.parent anchor) -- +(5pt,0) |- (.child anchor)\forestoption{edge label};
                }                   
            }
            [xxx                        
            [yyy    
            [zzz
            [kkk]
            [lll
            [mmm]
            [mmm]
            ]
            ]               
            ]
            [yyy        
            [zzz
            [kkk
            [aaa] {\draw () -- ++(1,0) coordinate(x1) |- (!s);}
            [bbb] 
            ]
            [lll
            [aaa] {\draw () -- ++(1,0) coordinate(x2) |- (!s);}
            [bbb] 
            [ccc] {\draw () -- ++(1,0) coordinate(x3) |- (!s);
             \draw (x1) -- (x3) coordinate[pos=0.125] (y1)
             coordinate[pos=0.375] (y2)
             coordinate[pos=0.625] (y3)
             coordinate[pos=0.875] (y4);
             \foreach \X [count=\Y] in {sss,rrr,qqq,ppp}
             {\draw (y\Y) -- ++(1,0) node[right] {\X};}}
            ]
            ]    
            [zzz
            [kkk]
            [lll]
            ]       
            [zzz
            [kkk]   
            [lll]           
            [mmm]       
            ]   
            ]
            ]       
        \end{forest}
    }       
\end{figure}
\end{document}

相关内容