更改 tikz-qtree 中所有边的样式

更改 tikz-qtree 中所有边的样式

我怎样才能改变风格全部下面代码中的边缘像红色的一样?我尝试添加,every edge/.style={..}但没有成功。

\documentclass{article}
\usepackage{tikz-qtree}

\begin{document}        

\begin{tikzpicture}[every tree node/.style={font=\huge},
level distance=1.1cm,sibling distance=.8cm, 
edge from parent path={(\tikzparentnode.south) -- +(0,-8pt) -| (\tikzchildnode)}],
frontier/.style={distance from root=350pt} % Align leaf nodes

\Tree 
[
\edge [ultra thick, dashed,red] node[black,near end,left] {branch};
[   
\edge node[near end, left] {};
[
\edge node[] {}; [.a ]
\edge node[] {}; [.b ]        
]        
\edge node[] {}; [.c ]
]
\edge node[near end,right] {};
[   
\edge node[] {}; [.d ]
\edge node[] {}; [.e ]
]
]
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案1

你可以这样做:

\documentclass{article}
\usepackage{tikz-qtree}

\begin{document}        

\begin{tikzpicture}[every tree node/.style={font=\huge},edge from parent/.style={draw,red,ultra thick,dashed},
level distance=1.1cm,sibling distance=.8cm, 
edge from parent path={(\tikzparentnode.south) -- +(0,-8pt) -| (\tikzchildnode)}],
frontier/.style={distance from root=350pt} % Align leaf nodes

\Tree 
[
\edge  node[black,near end,left] {branch};
[   
\edge node[near end, left] {};
[
\edge node[] {}; [.a ]
\edge node[] {}; [.b ]        
]        
\edge node[] {}; [.c ]
]
\edge node[near end,right] {};
[   
\edge node[] {}; [.d ]
\edge node[] {}; [.e ]
]
]
\end{tikzpicture}

\end{document}

输出:

在此处输入图片描述

我在这里找到了它:

https://tex.stackexchange.com/a/9242/120578

我只是对每个边都做了修改。但这几乎是重复的……让其他人决定吧(我不会标记它,因为即使有答案,这也是不同的问题)

相关内容