我想画一棵像图中这样树枝更粗的树,除了“粗”,我还能用什么来代替呢?
\documentclass[border=3.141592]{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={grow=0}
[$A$,for tree={edge={red ,thick}}
[$V $,edge label={node[pos=0.7,left ,font= \small]{$x$}}
[$G$[.][.]][$H$[.][.]]]
[$EF$[$J$[.][.]][$K$[.][.]]]]
\end{forest}
\end{document}
答案1
好了,之前就将要关闭了...一些题外的建议:
- (对我而言)不清楚您是否只想更改一条边、边的分支或所有边的线宽
- 示例中显示了所有可能性
- 添加边缘标签的样式
- 添加的节点已过时
math content
\documentclass[border=3.141592]{standalone}
%\documentclass{article}
\usepackage{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
for tree={
% nodes
inner sep=2pt,
math content,
% tree
grow=0,
edge={semithick},% edge = arr,
},
%% edge labels
/tikz/ELS/.style = {% Edge Label Style
node font=\scriptsize, text=cyan,
inner sep=0pt,
pos=0.5, anchor=#1 east},
EL/.style = {if n=1{edge label={node[ELS=north]{$#1$}}}
{edge label={node[ELS=south]{$#1$}}}}
%%%% diagram body
[A,
[V, for tree={edge={red ,ultra thick}} % lower branch will be red and ultra thick
, EL=x
[G, EL=u [.][.]]
[H, EL=v [.][.]]
]
[EF, EL=y, edge={blue,thick} % only for one edge
[J[.][.]]
[K[.][.]]
]
]
\end{forest}
\end{document}