英文:
How to input an arrow before a node in Tikz
问题
目前,这是我有的部分代码,我不知道如何在节点前面输入一个箭头,带有“dr above”。以下是翻译好的部分:
\tikzstyle{Box} = [rectangle, rounded corners,
minimum width=1.25cm,
minimum height=1.25cm,
text centered,
draw=black, fill=yellow!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{center}
\begin{figure}
\centering
\begin{tikzpicture}[node distance=2cm]
\node (F) [Box, label=above:{\textcolor{red}{$I_1$}}] {$F$};
\
\node (D) [Box, right of =S, label=above:{\textcolor{red}{$I_2$}}] {$D$};
\
\node (W) [Box, right of =D, label=above:{\textcolor{red}{$I_3$}}] {$W$};
\
\node (R) [Box, right of =W, label=above:{\textcolor{red}{$I_4$}}] {$R$};
\draw [arrow] (F) -- node[above]{\textcolor{red}{$\varphi_1$}}(D);
\draw [arrow] (D) -- node[above]{\textcolor{red}{$\varphi_2$}}(W);
\draw [arrow] (W) -- node[above]{\textcolor{red}{$\varphi_3$}}(R);
\end{tikzpicture}
\end{figure}
\end{center}
希望这能帮助你解决问题。谢谢你!
英文:
Im currently using Tikz to cite a mathematical model from a research but I don't know how to input an arrow before the node.
Here's a photo of the mathematical model that I'm trying to code:
I don't know how to input the arrow entering the node F with dr above. Currently, this is all i have
\tikzstyle{Box} = [rectangle, rounded corners,
minimum width=1.25cm,
minimum height=1.25cm,
text centered,
draw=black, fill=yellow!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{center}
\begin{figure}
\centering
\begin{tikzpicture}[node distance=2cm]
\node (F) [Box, label=above:{\textcolor{red}{$I_1$}}] {$F$};
\
\node (D) [Box, right of =S, label=above:{\textcolor{red}{$I_2$}}] {$D$};
\
\node (W) [Box, right of =D, label=above:{\textcolor{red}{$I_3$}}] {$W$};
\
\node (R) [Box, right of =W, label=above:{\textcolor{red}{$I_4$}}] {$R$};
\draw [arrow] (F) -- node[above]{\textcolor{red}{$\varphi_1$}}(D);
\draw [arrow] (D) -- node[above]{\textcolor{red}{$\varphi_2$}}(W);
\draw [arrow] (W) -- node[above]{\textcolor{red}{$\varphi_3$}}(R);
\end{tikzpicture}
\end{figure}
\end{center}
I hope anyone can help me resolve this problem. Thank you so much.
答案1
得分: 1
你可以在第一个框的左侧添加一个空节点,然后像处理其他箭头一样绘制箭头:
\documentclass{beamer}
\usepackage{tikz}
\tikzset{
Box/.style={
rectangle,
rounded corners,
minimum width=1.25cm,
minimum height=1.25cm,
text centered,
draw=black,
fill=yellow!30
},
arrow/.style={
thick,
->,
>=stealth
}
}
\begin{document}
\begin{frame}
\begin{figure}
\begin{tikzpicture}[node distance=2cm]
\node (F) [Box, label=above:{\textcolor{red}{$I_1$}}] {$F$};
\node (D) [Box, right of=F, label=above:{\textcolor{red}{$I_2$}}] {$D$};
\node (W) [Box, right of=D, label=above:{\textcolor{red}{$I_3$}}] {$W$};
\node (R) [Box, right of=W, label=above:{\textcolor{red}{$I_4$}}] {$R$};
\node (foo) [left of=F] {};
\draw [arrow] (F) -- node[above]{\textcolor{red}{$\varphi_1$}}(D);
\draw [arrow] (D) -- node[above]{\textcolor{red}{$\varphi_2$}}(W);
\draw [arrow] (W) -- node[above]{\textcolor{red}{$\varphi_3$}}(R);
\draw [arrow] (foo) -- node[above]{\textcolor{red}{dr}}(F);
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
英文:
You can add an empty node "left of" your first box and then draw the arrow just like you do for your other arrows:
\documentclass{beamer}
\usepackage{tikz}
\tikzset{
Box/.style={
rectangle,
rounded corners,
minimum width=1.25cm,
minimum height=1.25cm,
text centered,
draw=black,
fill=yellow!30
},
arrow/.style={
thick,
->,
>=stealth
}
}
\begin{document}
\begin{frame}
\begin{figure}
\begin{tikzpicture}[node distance=2cm]
\node (F) [Box, label=above:{\textcolor{red}{$I_1$}}] {$F$};
\node (D) [Box, right of =F, label=above:{\textcolor{red}{$I_2$}}] {$D$};
\node (W) [Box, right of =D, label=above:{\textcolor{red}{$I_3$}}] {$W$};
\node (R) [Box, right of =W, label=above:{\textcolor{red}{$I_4$}}] {$R$};
\node (foo) [left of=F] {};
\draw [arrow] (F) -- node[above]{\textcolor{red}{$\varphi_1$}}(D);
\draw [arrow] (D) -- node[above]{\textcolor{red}{$\varphi_2$}}(W);
\draw [arrow] (W) -- node[above]{\textcolor{red}{$\varphi_3$}}(R);
\draw [arrow] (foo) -- node[above]{\textcolor{red}{dr}}(F);
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论