5

I want to draw the following in TikZ:

enter image description here

However, I'm not sure how I can draw all the arrows, and position the math equations in the places that they are shown. I have the following nodes (I used "duck" node in place of the rectangles between the nodes just for simplicity).

\documentclass{beamer}
\usepackage{tikz}
    \usetikzlibrary{
        arrows,
        calc,
        chains,
        decorations,
        decorations.text,
        decorations.pathmorphing,
        matrix,
        positioning,
        shapes,
        tikzmark
    }
    \usepackage{tikzpeople}
    
    \begin{document}
    
    \begin{frame}{Test}
    \begin{tikzpicture}[ar/.style={very thick,-latex,cm},nodes={font=\small}]
    \node[alice,minimum size=0.75cm] (a) {$A$};
    \node[duck,minimum size=0.5cm,right of=a] (d1) {};
    \node[devil,minimum size=0.75cm,right of=d1] (e1) {$E_1$};
    \node[duck,minimum size=0.5cm,right of=e1] (d2) {};
    \node[bob,minimum size=0.75cm,right of=d2]  (b) {$B$};
    \node[duck,minimum size=0.5cm,right of=b] (d3) {};
    \node[devil,minimum size=0.75cm,right of=d3] (e2) {$E_2$};
    \node[duck,minimum size=0.5cm,right of=e2] (d4) {};
    \node[charlie,minimum size=0.75cm,right of=d4] (c) {$C$};
    \end{tikzpicture}
    \end{frame}
    
    \end{document}
5

Something like this ? Updated :

    \documentclass{beamer}
\usepackage{amsmath}
    \usepackage{amsfonts}
    \usepackage{amssymb}
\usepackage{tikz}
\usepackage{tikzpeople}
\usetikzlibrary{
    arrows,
    calc,
    chains,
    decorations,
    decorations.text,
    decorations.pathmorphing,
    matrix,
    positioning,
    shapes,
    tikzmark}
\begin{document}

\begin{frame}{Test}
\begin{tikzpicture}[ar/.style={very thick,-latex,cm},nodes={font=\small}]
\node[alice,minimum size=0.75cm,label={[name=aa]below:$A$}] (a) {};
\node[duck,minimum size=0.5cm,right of=a] (d1) {};
\node[devil,minimum size=0.75cm,right of=d1,label={[name=ee1]below:$E_1$}] (e1) {};
\node[duck,minimum size=0.5cm,right of=e1] (d2) {};
\node[bob,minimum size=0.75cm,right of=d2,label={[name=bb]below:$B$}]  (b) {};
\node[duck,minimum size=0.5cm,right of=b] (d3) {};
\node[devil,minimum size=0.75cm,right of=d3,label={[name=ee2]below:$E_2$}] (e2) {};
\node[duck,minimum size=0.5cm,right of=e2] (d4) {};
\node[charlie,minimum size=0.75cm,right of=d4,label={[name=cc]below:$C$}] (c) {};
    \node[above=2cm of c,coordinate](x){};
        \draw(a)|-(x.center)edge[-Latex]node[pos=.5,left,anchor=east]{formula 4}(c);
            \foreach[var=\up,count=\ii]in{e1,b,e2}
            \draw[-Latex](\up |- x)node[label={above:{text \ii}}]{}--   % [draw] has been removed
            (\up)node[pos=.5,left,anchor=east]{formula \ii};
            \foreach[var=\ar,remember=\ar as \prev (initially a)]in{e1,b,e2,c}
            \draw[-Latex](\prev)to[bend left](\ar);
        \foreach[var=\lab,count=\ii]in{aa,ee1,bb,ee2,cc}
            \node[label={[draw]below:{text \ii}}]at(\lab){};
        \foreach[var=\a, remember=\a as \s (initially aa)]in{ee1,bb,ee2,cc}\draw[Latex-](\s)--(\a);
    \node[text width=3cm,font=\small,above](multline)at(a|-x){This is multiline text with math: % par allowed 

    $\sum_{i=1}^{+\infty}\dfrac{1}{i^2}=\dfrac{\pi^2}{6}$};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

3
  • Thanks, looks nice. How can I get rid of the boxes that surround "text"?
    – pixel
    Dec 7 '20 at 22:55
  • Also, how can I make the text multi-line (as in my example picture above)?
    – pixel
    Dec 7 '20 at 23:09
  • glad if it's usefull to you @pixel . To get rid of the boxes do remove "draw" from label options innode[label={[draw]above:{text \ii}}]{}; To enable multiline text inside node, add text width=my length eg 0.25*\linewidth or 5cm look at the updated answer of mine.
    – mxnc baud
    Dec 7 '20 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.