我想在 tikz 中重现与此图像类似的内容
这是我当前的代码:
\centering
\begin{tikzpicture} [
node distance = 5cm,
on grid,
auto,
every loop/.style={stealth-}]
% State q1
\node (q1) [state,
accepting] {$q$};
% Arrows
\path [-stealth, thick]
(q1) edge [loop above] node {$\overline{\beta_i} | \beta_j$}();
\end{tikzpicture}
我怎样才能有两个来源,如上图所示?
答案1
您需要先放置带有 beta 的节点,然后再绘制边。
代码
\documentclass[tikz]{standalone}
\usetikzlibrary{automata, arrows.meta, positioning, quotes}
\begin{document}
\begin{tikzpicture}[
arrows={[scale=.75]},
every edge quotes/.append style={inner sep=+.15em, node font=\footnotesize}]
\node (q1) [state, accepting] {$q$};
\node (bb)[above right=0mm and 1cm of q1] {$\overline{\beta_1} \vert \beta_j$};
\path[thick, in=180, at end]
(q1) edge[out=45, "1" above left] ([yshift= .75ex]bb.west)
edge[out=30, "2" below left] ([yshift=-.75ex]bb.west)
(bb) edge[-Latex, out=0, in=-15] (q1);
\end{tikzpicture}
\end{document}