我正在嘗試創建一個從單字底部伸出的箭頭,然後循環到同一個單字的頂部。重點是為了說明「Operations」的輸出也成為「Operations」的輸入。
我最初的嘗試只是簡單地使用edge[out = -90, in = 90]
,但這並不會使箭頭圍繞該單字循環。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0,0) (Operations) {Operations};
\draw [->] (Operations) edge[out = -90, in = 90] (Operations);
\end{tikzpicture}
\end{document}
編輯
在我的真實範例中,我有一個從上面的節點向下指向「操作」的箭頭,還有一個從「操作」向下指向下面的節點的箭頭。理想情況下,循環箭頭的起點和終點應與這兩個現有箭頭對齊。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0,3) (Input) {Input};
\node at (0,1.5) (Operations) {Operations};
\node at (0,0) (Output) {Output};
\draw [->] (Input) -- (Operations);
\draw [->] (Operations.center) arc (-180:180:1);
\draw [->] (Operations) -- (Output);
\end{tikzpicture}
\end{document}
答案1
這是一個非常好的解決方案,透過新增第三個節點\node at (1,0) (here) {};
並將箭頭的大小修改為looseness
。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0,0) (Operations) {Operations};
\node at (1,0) (here) {};
\draw [->] (Operations) to[out=-80, in=-90,looseness=2] (here) to[out=90,in=80,looseness=2] (Operations);
\end{tikzpicture}
\end{document}
答案2
正如我在評論中所說,有精確的數字
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0,0) (Operations) {Operations};
\draw [->] (Operations.south)arc(-160:160:1);
\end{tikzpicture}
\end{document}
另一種方法
\draw[->,shorten <=5pt,shorten >=5pt](Operations.center)arc(-180:180:1);
第三種方法
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0,3) (Input) {Input};
\node at (0,1.5) (Operations) {Operations};
\node at (0,0) (Output) {Output};
\draw [->] (Input) -- (Operations);
\draw [->] (Operations) -- (Output);
\draw[->](Operations.south)arc(-180:0:1)coordinate(X)
(Operations.north)+(2,0)--(X)
(Operations.north)+(2,0)arc(0:180:1);
\end{tikzpicture}
\end{document}