如何解决LaTex / tikZ:如何从南2个节点向北1个节点绘制2个垂直箭头?
如何从变量2和变量3的节点到变量1绘制垂直箭头?
\documentclass[jou]{apa7}
\usepackage{tikz}
\usepackage{fixltx2e}
\usetikzlibrary{shapes,shadows,arrows}
\usetikzlibrary{positioning}
\tikzset{mynode/.style={shape=rectangle,draw,align=center}
}
\begin{document}
\begin{figure*}
\begin{tikzpicture}
\node[mynode,text width=7cm,minimum height=1cm] (v1){Variable 1};
\node[mynode,above left= 2cm of v1,text width = 4cm,minimum height = 1cm,xshift=4cm](v2) {Variable 2};
\node[mynode,above right= 2cm of v1,text width=4cm,xshift=-4cm] (v3){Variable 3};
\draw[-latex] (v2.south) -- (v1.north);
\draw[-latex] (v3.south) -- (v1.north);
\end{tikzpicture}
\end{figure*}
\end{document}
使用上面的代码输出:
所需的输出:
解决方法
使用-|
将对角线替换为水平和垂直线段:
\documentclass[jou]{apa7}
\usepackage{tikz}
\usepackage{fixltx2e}
\usetikzlibrary{shapes,shadows,arrows}
\usetikzlibrary{positioning}
\tikzset{mynode/.style={shape=rectangle,draw,align=center}
}
\begin{document}
\begin{figure*}
\begin{tikzpicture}
\node[mynode,text width=7cm,minimum height=1cm] (v1){Variable 1};
\node[mynode,above left= 2cm of v1,text width = 4cm,minimum height = 1cm,xshift=4cm](v2) {Variable 2};
\node[mynode,above right= 2cm of v1,text width=4cm,xshift=-4cm] (v3){Variable 3};
\draw[-latex] (v2.south) -| ([xshift=-2cm]v1.north);
\draw[-latex] (v3.south) -| ([xshift=2cm]v1.north);
\end{tikzpicture}
\end{figure*}
\end{document}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。