# Beamer - diagrams of boxed text

I am writing a Beamer presentation and was unable to find a way to have various boxed texts be related in a diagram inside one page. I tried with the column environment but my solution looks to me too naive:

1) arrows are too short for my purposes;

2) alignments are depending on the length of texts and are obtained only by careful tuning of space skips;

3) I do not see a way to eventually add more complicated features like diagonal arrows or the like;

It is possible that a tikz approach would be more efficient.

\documentclass[aspectratio=169]{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage[overlay]{textpos}

\begin{frame}{Title here}
\begin{columns}[t]
\column{0.25\textwidth}
\centering

\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\vspace{1.7cm}

\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\column{0.30\textwidth}
\center
$\overset{\mathrm{long text here}}{\longrightarrow}$

\vspace{1.7cm}

$\overset{\mathrm{long text here}}{\longleftrightarrow}$

\column{0.25\textwidth}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}

\vspace{1.7cm}

\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\end{columns}
\end{frame}

• Note that math ignores spaces (even in \mathrm). You should put text where you want it inside math with amsmath's \text macro (or a \hbox but that doesn't adjust font sizes). – Skillmon Apr 7 '18 at 9:34

You are right, with tikz is more simple to drawn your relations:

\documentclass[aspectratio=169]{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage[overlay]{textpos}

\usepackage{tikz}

\begin{document}
\begin{frame}
\frametitle{Title here}
\begin{center}
\begin{tikzpicture}[
node distance = 11mm and 44mm,
block/.style = {rectangle, rounded corners, fill=gray!30,
text width=0.24\linewidth, align=left,
LA/.style = {-Straight Barb, semithick,              % LA: left arrow
shorten >=3mm, shorten <=3mm},
LRA/.style = {Straight Barb-Straight Barb, semithick, % LRA: left right arrow
shorten >=3mm, shorten <=3mm}
]
\node (n1) [block]              {Some text with math formulae e.g. $\alpha=f$};
\node (n2) [block,right=of n1]  {Some text with math formulae e.g. $\alpha=f$};
\node (n3) [block,below=of n1]  {Some text with math formulae e.g. $\alpha=f$};
\node (n4) [block,right=of n3]  {Some text with math formulae e.g. $\alpha=f$};
%
\draw[LA]   (n1) -- node[above] {long text here} (n2);
\draw[LRA]  (n3) -- node[above] {long text here} (n4);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}

• @CarLaTeX, thanks for correction. to me is more simple to draw image than write some text in correct English :-) – Zarko Apr 7 '18 at 8:54
• I'm not a native speaker, too, I always make a lot of errors but the important thing is to understand each other. Ciao! :):):) – CarLaTeX Apr 7 '18 at 8:56
• thanks, that was exactly what I was looking for. It will just need me some time to understand how to deal with overlays, now... – Nicola Ciccoli Apr 7 '18 at 11:33

Why a tikz approach?

\documentclass[aspectratio=169]{beamer}
\usepackage{lmodern}
\usepackage{amsmath}
\begin{document}
\begin{frame}{Title here}
\centering
\begin{minipage}{4cm}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\end{minipage}
$\underrightarrow{\makebox[3cm][r]{long text here}\hspace{3em}}$
\begin{minipage}{4cm}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\end{minipage}
\vfill
\begin{minipage}{4cm}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\end{minipage}
$\underleftrightarrow{\makebox[3cm][r]{long text here}\hspace{3em}}$
\begin{minipage}{4cm}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\end{minipage}
\end{frame}
\end{document}

• Very good work. I upvote you and delete your zero score. – Sebastiano Apr 7 '18 at 21:36

Just for completeness in case you do not want to re-invent the beamer blocks with TikZ, and readjust them every time you change their appearance. You can just add the arrows as overlays.

\documentclass[aspectratio=169]{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{Connect/.style={ultra thick,>=latex,shorten >=0.5cm,shorten <=1cm}}
\newcommand{\tikznode}[2]{\tikz[remember picture,baseline=(#1.base),inner
sep=0pt]{\node(#1)[inner sep=0pt]{#2};}}
\usepackage[overlay]{textpos}

\begin{document}
\begin{frame}{Title here}
\begin{overlayarea}{\textwidth}{8cm}
\begin{columns}[t]
\column{0.25\textwidth}
\centering

\begin{block}{}
\tikznode{1a}{\strut}Some text with math formulae e.g.\ $\alpha=f$\tikznode{1b}{\strut}
\end{block}
\vspace{1.7cm}

\begin{block}{}
\tikznode{2a}{\strut}
Some text with math formulae e.g.\ $\alpha=f$
\tikznode{2b}{\strut}
\end{block}
\column{0.30\textwidth}
\center

\vspace{1.7cm}

\column{0.25\textwidth}
\begin{block}{}
\tikznode{3a}{\strut}Some text with math formulae e.g.\ $\alpha=f$\tikznode{3b}{\strut}
\end{block}

\vspace{1.7cm}

\begin{block}{}
\tikznode{4a}{\strut}Some text with math formulae e.g.\ $\alpha=f$\tikznode{4b}{\strut}
\end{block}
\end{columns}%
\begin{tikzpicture}[overlay,remember picture]
\draw[Connect,->] ($(1a-|1b)!0.5!(1b)$) -- ($(3a)!0.5!(3a|-3b)$)
node[pos=0.55,above]{some text here};
\draw[Connect,<->] ($(2a-|2b)!0.5!(2b)$) -- ($(4a)!0.5!(4a|-4b)$)
node[pos=0.55,above]{some other text here};
\end{tikzpicture}
\end{overlayarea}
\end{frame}
\end{document}


I also added an overlayarea just in case you want to work with pause. This prevents the slide from jumping.