1

I have two diagrams and I want to draw an arrow between them with a short text message in the arrow. I thought I would use fancy arrow. However I am not sure how to place it between the two diagrams. Here is my MWE with the arrow line commented out. If I uncomment it I get "TeX capacity exceeded".

\documentclass[standalone]{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, shadows, fadings,shapes.arrows}
\tikzset{My Arrow Style/.style={single arrow, fill=red!50, anchor=base, align=center,text width=2.8cm}}
\newcommand{\MyArrow}[2][]{\tikz[baseline] \node [My Arrow Style,#1] {#2};}

\begin{document} \begin{frame} \begin{center} \begin{tikzpicture}[scale=0.6] \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (1) at (0, 0) {1}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (2) at (2, -2) {2}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (3) at (4, -4) {3}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (4) at (6, -6) {4}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (5) at (8, -8) {5}; \path (1) edge [loop above] node {} (1); \path (2) edge [->] node {} (1); \path (3) edge [->] node {} (2); \path (4) edge [->] node {} (3); \path (5) edge [->] node {} (4); %\MyArrow[fill=yellow!50, draw=black, ultra thick, text width=3.5cm]{some text} \begin{scope}[shift={(13cm, -1cm)}] \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (1) at (0,0) {1}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (2) at (-2, -2) {2}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (3) at (0,-2) {3}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (4) at (2, -2) {4}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (5) at (4, -2) {5};

\path (1) edge [loop above] node {} (1);
\path (2) edge [->] node {} (1);
\path (3) edge [->] node {} (1);
\path (4) edge [->] node {} (1);
\path (5) edge [->] node {} (1);
\end{scope}
\end{tikzpicture}

\end{center} \end{frame} \end{document}

Simd
  • 6,785

1 Answers1

2

As you have defined it, this arrow is a TikZ node. It is therefore useless to create a LaTeX command to draw it, just use the style My Arrow Style you have created.

To place it, with the positioning library, I placed it on the right of the north anchor of the node (2)

\node[My Arrow Style,right=of 2.north]{some text};

screenshot

\documentclass[standalone]{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, shadows, fadings,shapes.arrows,positioning}
\tikzset{My Arrow Style/.style={single arrow, fill=red!50, anchor=base, align=center,text width=2.8cm}}
%\newcommand{\MyArrow}[2][]{\tikz[baseline] \node [My Arrow Style,#1] {#2};}

\begin{document} \begin{frame} \begin{center} \begin{tikzpicture}[scale=0.6] \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (1) at (0, 0) {1}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (2) at (2, -2) {2}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (3) at (4, -4) {3}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (4) at (6, -6) {4}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (5) at (8, -8) {5}; \path (1) edge [loop above] node {} (1); \path (2) edge [->] node {} (1); \path (3) edge [->] node {} (2); \path (4) edge [->] node {} (3); \path (5) edge [->] node {} (4); \node[My Arrow Style,right=of 2.north]{some text}; \begin{scope}[shift={(13cm, -1cm)}] \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (1) at (0,0) {1}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (2) at (-2, -2) {2}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (3) at (0,-2) {3}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (4) at (2, -2) {4}; \node[shape=circle,draw=black,fill=white, drop shadow,minimum size=1cm] (5) at (4, -2) {5};

\path (1) edge [loop above] node {} (1);
\path (2) edge [->] node {} (1);
\path (3) edge [->] node {} (1);
\path (4) edge [->] node {} (1);
\path (5) edge [->] node {} (1);
\end{scope}
\end{tikzpicture}

\end{center} \end{frame} \end{document}

AndréC
  • 24,137