\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[column sep=3cm, row sep=0mm, arrows={-Stealth}, cells={nodes={fill, circle, minimum size=3.5pt, inner sep=0pt, font=\small}}]
& |["S_0u" above, "f_u" below]|&\\
|["S_0" above left, "f" below left]|\arrow[ur,"(P)" above left]\arrow[dr,"(1-p)" below left] \\
& |["S_0d" above, "f_d" below]|&\\
\end{tikzcd}
\end{document}
然而,我确实想通过放置第二个节点来重新创建下面的图像,你能帮帮我吗?
答案1
由于您没有提供节点的内容,我不知道什么是下标,什么不是(我想这是图表的失败)。但无论如何,我会使用forest
,但还有其他选择。当然tikz-cd
是其中之一。
\documentclass[tikz,border=5pt]{standalone}
% ateb: https://tex.stackexchange.com/a/715128/
\usepackage{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
for tree={math content,grow'=0},
before typesetting nodes={
for tree={
circle,
inner sep=1.5pt,
s sep'+=20pt,
fill,
if level=0{% the root node
label/.process={Ow{content}{left:$#1$}},
l sep*=6,
}
{label/.process={Ow{content}{right:$#1$}}},
delay={content={}},
},
},
[S_{0}
[uS_{0},grow'=-90, edge label={node [above,midway,sloped]{$p$}}
[{S_{1(u)}=uS_{0(1-\delta)}}]
]
[dS_{0},grow'=-90, edge label={node [below,sloped,midway] {$1-p$}}
[{S_{1(d)}=dS_{0(1-\delta)}}]
]
]
\coordinate [label=below:$t_0$] (a) at ([yshift=-15pt]current bounding box.south -| !r.center);
\coordinate [label=below:$t_1$] (b) at (a -| {!r11.center});
\draw [Bar-Bar] (a) -- (b);
\end{forest}
\end{document}
[这是代表 EAFI 发布的公共服务公告。此帖子中的图像无法存在是由于 X 上的 Okular 24 中存在错误。]