在beamer中使用tikzpicture製作定向丙烯酸圖

在beamer中使用tikzpicture製作定向丙烯酸圖

我正在嘗試將定向丙烯酸圖添加到投影機簡報中。使用這段程式碼(轉載如下)我創建了一張幻燈片,但生成的圖像的每個節點和箭頭大致堆疊在一起。我嘗試過調整節點的位置,但無論我輸入什麼位置,它們似乎都會在圖像中彼此堆疊。如何讓它在投影機中正確顯示(如下圖所示,來自網站)?

IV 的有向無環圖

\begin{frame}
\begin{tikzpicture}
% nodes %
\node[text centered] (z) {$Z$};
\node[right = 1.5 of z, text centered] (t) {$T$};
\node[right=1.5 of t, text centered] (y) {$Y$};
\node[draw, rectangle, dashed, above = 1 of t, text centered] (u) {$U$};

% edges %
\draw[->, line width= 1] (z) --  (t);
\draw [->, line width= 1] (t) -- (y);
\draw[->,red, line width= 1,dashed] (u) --node {X} (z);
\draw[->,line width= 1] (u) --(t);
\draw[->,line width= 1] (u) -- (y);
\draw[->, red, line width=1,dashed] (z) to  [out=270,in=270, looseness=0.5] node{X} (y);
\end{tikzpicture}

\end{frame}

相關內容