如何使用 tikz 标记箭头?

如何使用 tikz 标记箭头?

嗨,我想使用 [punktchain,join] 在 tikz 图片中的箭头上添加标题。你能帮助我吗?

\documentclass[12pt,a4paper,oneside]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
    decorations.pathreplacing,decorations.pathmorphing,shapes,%
    matrix,shapes.symbols}

\tikzset{>=stealth',
  punktchain/.style={
    rectangle, 
    rounded corners, 
    % fill=black!10,
    draw=black, very thick,
    text width=13em, 
    minimum height=2em, 
    text centered, 
    on chain},
  line/.style={draw, thick, <-},
  element/.style={
    tape,
    top color=white,
    bottom color=blue!50!black!60!,
  %  minimum width=8em,
    minimum width=8em,
    draw=blue!40!black!90, very thick,
    text width=12em, 
    %   text width=10em, 
    minimum height=3.5em, 
    text centered, 
    on chain},
  every join/.style={->, thick,shorten >=1pt},
  decoration={brace},
  tuborg/.style={decorate},
  tubnode/.style={midway, right=2pt},
}

\begin{document}
\begin{tikzpicture}
  [node distance=1.7cm,start chain=going below,]
     \node[punktchain, join] (1) {a};
     \node[punktchain, join] (2)    {b};
  \end{tikzpicture}    
\end{document}

在此处输入图片描述

答案1

前面提到的解决方案非常有效,作为替代方案,如果出现 Babel 问题,我使用了这个:

\documentclass[12pt,a4paper,oneside]{scrartcl}
    \usepackage{tikz}
    \usetikzlibrary{arrows,
                    babel,% <-- added to resolve for non-english babel issues
                    ,calc,chains,quotes}
    \tikzset{>=stealth',
      punktchain/.style={
        rectangle,
        rounded corners,
        % fill=black!10,
        draw=black, very thick,
        text width=13em,
        minimum height=2em,
        text centered,
        on chain},
      line/.style={draw, thick, <-},
      element/.style={
        tape,
        top color=white,
        bottom color=blue!50!black!60!,
      %  minimum width=8em,
        minimum width=8em,
        draw=blue!40!black!90, very thick,
        text width=12em,
        %   text width=10em,
        minimum height=3.5em,
        text centered,
        on chain},
      every join/.style={->, thick,shorten >=1pt},
%      decoration={brace},
%      tuborg/.style={decorate},
%      tubnode/.style={midway, right=2pt},
    }
    \begin{document}
    \begin{tikzpicture}
      [node distance=1.7cm,start chain=going below,]
         \node[punktchain,join] (1) {a};
         \node[punktchain,join] (2) {b};
%
    \path  (1) ->(2) node[draw=none, midway, left=8pt]{PATH};
      \end{tikzpicture}
    \end{document}

在此处输入图片描述

相关内容