将箭头绘制到另一个带有标签的箭头上

将箭头绘制到另一个带有标签的箭头上

我正在尝试将标签“H3”添加到从 Financial Slack 到 Financial Performance 的箭头上。这是我当前的代码:

\documentclass{report}    
\usepackage{tikz}
\begin{document}
\begin{figure}
\usetikzlibrary{calc}
\begin{tikzpicture}
\begin{scope}[every node/.style={circle,thick,draw}]
    \node[rectangle] (Sequence Patterns) at (0,0) {Sequence Patterns};
    \node[rectangle] (Acquisition) at (0,1.5) {Acquisition};
    \node[rectangle] (Divestment) at (0,-1.5) {Divestment};
    \node[rectangle] (Extra-Entrainment) at (0,-3) {Extra-Entrainment};
    \node[rectangle] (Financial Performance) at (10,0) {Financial Performance};
    \node[rectangle] (Financial Slack) at (7,3) {Financial Slack};
    \node[rectangle] (Controls) at (10,-1.5) {Controls};
\end{scope}

\begin{scope}[->={Stealth[black]},
              every node/.style={fill=white},
              every edge/.style={draw=black,very thick}]
    \path [->] (Sequence Patterns) edge node {$H2$} (Financial Performance);
    (Controls) edge (Financial Performance)
    \path [->] (Acquisition) edge (Sequence Patterns);
    \path [->] (Divestment) edge  (Sequence Patterns);
    \path [->] (Acquisition) edge node {$H1a$} (Financial Performance);
    \path [->] (Divestment) edge node {$H1b$} (Financial Performance);
    \path [->] (Extra-Entrainment) edge node {$H4$} (Financial Performance);
    \path [->] (Controls) edge (Financial Performance);
    \path [->] (Financial Slack) edge ($(Sequence Patterns)!0.7!(Financial Performance)$);
\end{scope}
\end{tikzpicture}
\end{figure}
\end{document}

有人知道怎么做吗?

另外:是否可以将标签“H1a”、“H1b”、“H2”和“H4”对齐到箭头的左侧和上方,而不是它们之间?

多谢!

答案1

使用 TiZ 库chainspositioningquotes。库arrows.meta用于绘制更漂亮的箭头:

\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains,
                positioning,
                quotes}
                
\begin{document}
    \begin{tikzpicture}[
node distance = 4mm and 55mm,
  start chain = n going below,
     N/.style = {draw, semithick, minimum width=9em, align=center},
every edge/.style = {draw, -Stealth},
every edge quotes/.style = {auto, inner sep=2pt, font=\footnotesize, pos=0.3, sloped}
                        ]
    \begin{scope}[nodes={N, on chain=n}]
\node   {Acquisition};       % n-1
\node   {Sequence Patterns};
\node   {Divestment};
\node   {Extra-Entrainment}; % n-2
    \end{scope}
\node[N, right=of n-2] (n-5)    {Financial\\ Performance};
\node[N, below=of n-5] (n-6)    {Controls};
% arrows
\path   (n-1.east) edge ["$H_{1a}$"]    (n-5.174)
        (n-1) edge  (n-2)
        (n-2.east) edge ["$H_2$"] coordinate[pos=0.66] (aux) (n-5.178)
        (n-3.east) edge ["$H_{1b}$"]    (n-5.182)
        (n-3) edge (n-2)
        (n-4.east) edge ["$H_4$"]       (n-5.186)
        (n-6) edge (n-5)
        (n-2.west) edge [bend right] (n-4.west)
        ;
\node[N, above=of n-1.north -| aux] (n-7) {Financial Slack};
\path   (n-7) edge ["$H3$" sloped=false] (aux);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

欢迎来到 texSE!

这是我的建议。简单的图形应该用简单的方式绘制。TikZ 具有自然的语法,几乎和英语一样自然,因此当您阅读 TikZ 代码时,您可以猜出代码的含义。享受阅读手册

更新:你的描述对我来说不太清楚。我只能猜想你想要一个从接触到连接和FS的线上的点的虚线箭头。如果是这样,就说SPFP

\draw[densely dotted] (FS)-(FS|-FP) node[pos=.5,right]{$H_3$}; 

在此处输入图片描述

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}[thick]
\tikzset{n/.style={draw,align=center,inner sep=3mm,fill=yellow!30}} 
\path[nodes={n}] 
(0,0)     node (SP) {Sequence Patterns}
(0,1.5)   node (A)  {Acquisition}
(0,-1.5)  node (D)  {Divestment}
(0,-3)    node (EE) {Extra-Entrainment}
(7,3)     node (FS) {Financial Slack}
(10,0)    node (FP) {Financial\\[3mm]Performance}
+(0,-2)   node (C)  {Controls};

\begin{scope}[-stealth]
\draw (SP)--(FP) coordinate[pos=.3] (H2);
\draw (A)--(SP);
\draw (D)--(SP);
\draw (A)--(FP.165); 
\draw (D)--(FP.190); 
\draw (EE)--(FP.205);
\draw (C)--(FP);
%\draw (SP)-|(FS) node[pos=.75,right]{$H_3$};
\draw[densely dotted] (FS)-(FS|-FP) node[pos=.5,right]{$H_3$};
\end{scope}

\path 
(H2) node[above right]{$H_2$}
+(0,4) coordinate (H2top) +(0,-4) coordinate (H2bot)
(intersection of H2top--H2bot and A--FP)  node[above right]{$H_{1a}$}
(intersection of H2top--H2bot and D--FP)  node[above right]{$H_{1b}$}
(intersection of H2top--H2bot and EE--FP) node[above right]{$H_4$}
;
\end{tikzpicture}
\end{document}

相关内容