在 Tikz 中将箭头放在箭头上

在 Tikz 中将箭头放在箭头上

在下面的 MWE 中:

\documentclass{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{tikz,pgf}


\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
    decorations.pathreplacing,decorations.pathmorphing,shapes,%
    matrix,shapes.symbols,automata}

\begin{document}

\begin{center}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto, node distance=3cm ,semithick]

    \node [draw,  rounded corners=2pt,rectangle, initial, initial text=\textbf{Query},initial where=above](timing) {Timing};
    \node [draw,  rounded corners=2pt,rectangle](indep)[right of=timing] {Independent};
    \node [draw,  rounded corners=2pt,rectangle](caching)[right of=indep] {Caching};
    \node [draw,  rounded corners=2pt,rectangle](pc)[right of=caching] {PC Logging};

    \node [draw, node distance=3cm, rounded corners=2pt,rectangle](stp)[right of= pc] {STP};

    \path (timing) edge[]   node{} (indep);

    \path (indep) edge[]   node{} (caching);

    \path (caching) edge[]   node{} (pc);

    \path (pc) edge[]   node{} (stp);

\end{tikzpicture}\\
\end{center}

\end{document}

PCLogging我怎样才能在和框之间的箭头(最好是在中点)上放置一个指向上方的垂直箭头STP

答案1

添加

\draw[->] ($(stp.west)!0.5!(pc.east)$) -- ++(0,1cm) node[above] {Text}; 

足以找到中点并在末尾添加文本。

在此处输入图片描述

相关内容