【问题标题】:Adding arrow to the middle of other arrow in LaTex?将箭头添加到 LaTex 中其他箭头的中间?
【发布时间】:2020-11-21 15:31:59
【问题描述】:

我想在连接变量 2 和变量 3 的箭头中间添加一个变量 5 的箭头。

\documentclass[jou]{apa7}
\usepackage[american]{babel}
\usetikzlibrary{positioning}
\tikzset{mynode/.style={draw,text width=1.90cm,align=center}
}

\begin{document}

\begin{figure}
\begin{tikzpicture}
\node[mynode] (v1){Variable 1};
\node[mynode,below left=of v1](v2) {Variable 2};
\node[mynode,below right=of v1](v3) {Variable 3};
\node[mynode,below = 2.5cm of v1] (v4){Variable 4};
\node[mynode, above right=of v1](v5) {Variable 5};

\draw[-latex] (v2.north) -- node[auto,] {a} (v1.west);
\draw[-latex] (v1.east) -- node[auto,] {b} (v3.north);
\draw[-latex] (v2.east) -- node[below, align=center] {c} (v3.west);
\draw[-latex] (v2.south) -- node[below=3mm, align=center] {d} (v4.west);
\draw[-latex] (v3.south) -- node[below=3mm, align=center] {e} (v4.east);
\draw[-latex] (v5.south) -- node[auto,]{f} (v3.north);
\end{tikzpicture}
\end{figure}

\end{document}

【问题讨论】:

    标签: latex tikz


    【解决方案1】:

    您可以使用calc 库计算节点v2v3 之间的中间:

    \documentclass[jou]{apa7}
    \usepackage[american]{babel}
    \usetikzlibrary{positioning}
    \usetikzlibrary{calc}
    \tikzset{mynode/.style={draw,text width=1.90cm,align=center}
    }
    
    \begin{document}
    
    \begin{figure}
    \begin{tikzpicture}
    \node[mynode] (v1){Variable 1};
    \node[mynode,below left=of v1](v2) {Variable 2};
    \node[mynode,below right=of v1](v3) {Variable 3};
    \node[mynode,below = 2.5cm of v1] (v4){Variable 4};
    \node[mynode, above right=of v1](v5) {Variable 5};
    
    \draw[-latex] (v2.north) -- node[auto,] {a} (v1.west);
    \draw[-latex] (v1.east) -- node[auto,] {b} (v3.north);
    \draw[-latex] (v2.east) -- node[below, align=center] {c} (v3.west);
    \draw[-latex] (v2.south) -- node[below=3mm, align=center] {d} (v4.west);
    \draw[-latex] (v3.south) -- node[below=3mm, align=center] {e} (v4.east);
    \draw[-latex] (v5.south) -- node[auto,]{f} (v3.north);
    \draw[-latex] (v5.south) -- ($(v2)!.5!(v3)$);
    \end{tikzpicture}
    \end{figure}
    
    \end{document}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-28
      • 1970-01-01
      相关资源
      最近更新 更多