如何在乳胶中绘制类似符号“\leadsto”的箭头?

如何在乳胶中绘制类似符号“\leadsto”的箭头?

请参考如何绘制流程图的答案?现在我想 \leadsto在乳胶中更改所有箭头的外观,您指的是图片
在此处输入图片描述 ,我在手册中找不到它,有人知道怎么做吗?请帮帮我。

 \documentclass[a4paper,12pt]{article}
    \usepackage{tikz}
    \usetikzlibrary{trees}

    \tikzset{level 1/.style={level distance=1.5cm, sibling distance=3.5cm}}
    \tikzset{level 2/.style={level distance=1.5cm, sibling distance=2cm}}

    \tikzset{bag/.style={text width=20em, text centered,yshift=-0.2cm}}

    \begin{document}
    \begin{tikzpicture}[grow=down, -stealth]
    \node[bag]{$(B)$} 
        child{ edge from parent node[right]{t}; \node[bag]{$(Rgood)$}
                child{ edge from parent node[right]{and}; \node[bag]{$(and)$}
                        child[missing]
                        child{ edge from parent node[right=0.1cm]{it}; \node[bag]{$(path1)$}}
                        child{ edge from parent node[right=0.1cm]{else}; \node[bag]{$(path2)$}}
                }
        };
    \end{tikzpicture}

    \end{document}

答案1

您可以添加选项edge from parent来指定树的边缘样式,并使用装饰来获得“波浪”线:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees,decorations.pathmorphing}

\tikzset{level 1/.style={level distance=1.5cm, sibling distance=3.5cm}}
\tikzset{level 2/.style={level distance=1.5cm, sibling distance=2cm}}
\tikzset{bag/.style={text width=20em, text centered,yshift=-0.2cm}}

\begin{tikzpicture}[grow=down, -stealth,
    edge from parent/.style={draw,decorate,decoration={snake, post=lineto, post length=3mm}}]
    \node[bag]{$(B)$}
        child{ edge from parent node[right]{t}; \node[bag]{$(Rgood)$}
            child{ edge from parent node[right]{and}; \node[bag]{$(and)$}
                child[missing]
                child{ edge from parent node[right=0.1cm]{it}; \node[bag]{$(path1)$}}
                child{ edge from parent node[right=0.1cm]{else}; \node[bag]{$(path2)$}}
        }};
\end{tikzpicture}

结果

相关内容