如何在 tikzpicture 中设置节点距离而无需箭头改变方向?

如何在 tikzpicture 中设置节点距离而无需箭头改变方向?

我想知道为什么当我将距离改为 2.5 厘米时,连接到输出节点的箭头方向相反,如第二张图所示。我该如何解决这个问题,才能使箭头的长度与第二张图一样?

第一张图的示例代码:

\documentclass[10pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

\begin{document}

\tikzstyle{block1} = [draw, fill=white!20, rectangle,minimum height=3em, minimum width=10em]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\begin{center}
\begin{tikzpicture}[auto, node distance=2.15cm,>=latex']
    \node [input, name=input] {};
    \node [block1, right of=input] (h_k) {$h(k)=h_1(k)*h_2(k)$};
    \node [output, right of=h_k] (output) {};   
    \draw [->] (input) -- (h_k);
    \draw [->] (h2_k) -- (output);
\end{tikzpicture}
\end{center}
\end{document}

在此处输入图片描述

第二张图的示例代码:

\documentclass[10pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

\begin{document}

\tikzstyle{block1} = [draw, fill=white!20, rectangle,minimum height=3em, minimum width=10em]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\begin{center}
\begin{tikzpicture}[auto, node distance=2.5cm,>=latex']
    \node [input, name=input] {};
    \node [block1, right of=input] (h_k) {$h(k)=h_1(k)*h_2(k)$};
    \node [output, right of=h_k] (output) {};   
    \draw [->] (input) -- (h_k);
    \draw [->] (h2_k) -- (output);
\end{tikzpicture}
\end{center}
\end{document}

在此处输入图片描述

相关内容