在 LaTex 中将箭头添加到其他箭头的中间?
Adding arrow to the middle of other arrow in LaTex?
我想从变量 5 添加一个箭头到连接变量 2 和变量 3 的箭头中间。
\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}
您可以使用 calc
库来计算节点 v2
和 v3
之间的中间点:
\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}
我想从变量 5 添加一个箭头到连接变量 2 和变量 3 的箭头中间。
\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}
您可以使用 calc
库来计算节点 v2
和 v3
之间的中间点:
\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}