tikzpicture 文字下方弯曲的箭头

tikzpicture 文字下方弯曲的箭头

我尝试将文字放在弯曲箭头下方,但是出现了错误。

这有效(仅限直箭头下方的文字):

\path [line,dashed] (batchinput) -- node[below, color=black] {$N$ inputs} (input);
\path [line,dashed] (batchinput) to[bend right, looseness=0.5, in=135, out = 45] (input);
\path [line,dashed] (batchinput) to[bend right, looseness=0.5, in=90, out = 90] (input);

但这不行(我想要第二个弯箭头下面有“...”):

\path [line,dashed] (batchinput) -- node[below, color=black] {$N$ inputs} (input);
\path [line,dashed] (batchinput) to[bend right, looseness=0.5, in=135, out = 45] -- node[below, color=black] {...} (input);
\path [line,dashed] (batchinput) to[bend right, looseness=0.5, in=90, out = 90] (input);

我正在使用 overleaf。我有两个节点:

\node [cloud, node distance = 4.5cm] (batchinput) {Batch};
\node [cloud, right of=batchinput, node distance = 4.5cm] (input) {Input};

所有内容都包裹在以下内容中:

\begin{tikzpicture}[scale=2, node distance = 3.5cm, auto]
\end{tikzpicture}

完整代码为:

    \usepackage{tikz}   
    % Define block styles
    \tikzstyle{decision} = [diamond, draw, fill=blue!20,
        text width=8em, text badly centered, inner sep=0pt]
    \tikzstyle{block} = [rectangle, draw, fill=blue!20,
        text width=14em, text centered, rounded corners, minimum height=4em]
    \tikzstyle{blockd} = [rectangle, draw, fill=red!20,
        text width=14em, text centered, rounded corners, minimum height=4em]
    \tikzstyle{line} = [draw, very thick, color=black!50, -latex']
    \tikzstyle{cloud} = [draw, ellipse,fill=green!20, text centered, text width=4em, minimum height=2em]
    \tikzstyle{connector} = [draw, circle,fill=white!20, text centered, text width=4em, minimum height=2em]
    % Code
    \begin{tikzpicture}[scale=2, node distance = 3.5cm, auto]
        \node [cloud, node distance = 4.5cm] (batchinput) {Batch};
        \node [cloud, right of=batchinput, node distance = 4.5cm] (input) {Input};
        \path [line,dashed] (batchinput) -- node[below, color=black] {$N$ inputs} (input);
        \path [line,dashed] (batchinput) to[bend right, looseness=0.5, in=135, out = 45] -- node[below, color=black] {...} (input);
        \path [line,dashed] (batchinput) to[bend right, looseness=0.5, in=90, out = 90] (input);
    \end{tikzpicture}

知道我哪里错了吗?

谢谢。

答案1

我确实找到了答案,我不应该重复--

修复后的代码如下:

\usepackage{tikz}   
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20,
    text width=8em, text badly centered, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20,
    text width=14em, text centered, rounded corners, minimum height=4em]
\tikzstyle{blockd} = [rectangle, draw, fill=red!20,
    text width=14em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, very thick, color=black!50, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=green!20, text centered, text width=4em, minimum height=2em]
\tikzstyle{connector} = [draw, circle,fill=white!20, text centered, text width=4em, minimum height=2em]
% Code
\begin{tikzpicture}[scale=2, node distance = 3.5cm, auto]
    \node [cloud, node distance = 4.5cm] (batchinput) {Batch};
    \node [cloud, right of=batchinput, node distance = 4.5cm] (input) {Input};
    \path [line,dashed] (batchinput) -- node[below, color=black] {$N$ inputs} (input);
    \path [line,dashed] (batchinput) to[bend right, looseness=0.5, in=135, out = 45] node[below, color=black] {...} (input);
    \path [line,dashed] (batchinput) to[bend right, looseness=0.5, in=90, out = 90] (input);
\end{tikzpicture}

相关内容