我想使用 beamer 构建四个带有箭头的矩形框,如下图所示。
我尝试了以下方法,但无法将文本放置在箭头上方和旁边。我想知道是否有人可以帮助我。提前谢谢您。
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{frame}
\centering
\scalebox{0.6}[0.6]{
\begin{tikzpicture}[>=stealth, place/.style={shape=rectangle,draw,rounded corners,fill=blue!25,},trans/.style={align=center},auto,scale=7]
\node[place,fill=green!25,inner sep=8, font=\Large ] (a1) {1\textsuperscript{st} TEXT};
\node[right=1cm of a1,place,fill=green!25,inner sep=8, font=\Large ] (a2) {2\textsuperscript{nd} TEXT};
\node[below=1cm of a2,place,fill=green!25,inner sep=8, font=\Large ] (a3) {3\textsuperscript{rd} TEXT};
\node[left=1cm of a3,place,fill=green!25,inner sep=8, font=\Large ] (a4) {4\textsuperscript{th} TEXT};
\draw [->] (a1) -- (a2);
\draw [->] (a2) -- (a3);
\draw [->] (a3) -- (a4);
\end{tikzpicture}
}
\end{frame}
答案1
你可以node[midway] {f}
向箭头添加:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{frame}
\centering
\scalebox{0.6}[0.6]{
\begin{tikzpicture}[>=stealth, place/.style={shape=rectangle,draw,rounded corners,fill=blue!25,},trans/.style={align=center},auto,scale=7]
\node[place,fill=green!25,inner sep=8, font=\Large ] (a1) {1\textsuperscript{st} TEXT};
\node[right=1cm of a1,place,fill=green!25,inner sep=8, font=\Large ] (a2) {2\textsuperscript{nd} TEXT};
\node[below=1cm of a2,place,fill=green!25,inner sep=8, font=\Large ] (a3) {3\textsuperscript{rd} TEXT};
\node[left=1cm of a3,place,fill=green!25,inner sep=8, font=\Large ] (a4) {4\textsuperscript{th} TEXT};
\draw [->] (a1) -- (a2) node[midway] {f};
\draw [->] (a2) -- (a3) node[midway] {f};
\draw [->] (a3) -- (a4) node[midway,above] {f};
\end{tikzpicture}
}
\end{frame}
\end{document}