I am trying to reproduce one of my PowerPoint template with beamer.

I would like to link each colored box in a equation with an other box of similar color. Also, I am trying to adjust the position of the boxes behind the equation such as they are aligned with the margin. (like in the PowerPoint).

I am using tabular because I would like to have a kind of title associated with each small box. I know that tikz is highly recommended for boxing equations but if it's possible to use it in this case I would be curious to know.

P.S : Is there any way to make borders of the box less thicker ? Because it's interfering with parenthesis of the main equation...

Thank you for your kind help,

\documentclass[french]{beamer}

%%%%%% ENCODAGE %%%%%%%%%%%
\usepackage[utf8]{inputenc}

%%%%%% TIKZ %%%%%%%%%%%%%%%
\usepackage[beamer,customcolors,norndcorners]{hf-tikz}

%%%%%% OTHERS %%%%%%%%%%%%%
\usepackage{booktabs,calligra}
\usepackage{listings,stackengine}

\author{XXX}
\title{XXX}
\subtitle{XXX}
\institute [XXX] {XXX \\ XXX}
\date{\today}

%%%%%% DEFINITIONS %%%%%%%%%
\def\cmd#1{\texttt{\color{red}\footnotesize $\backslash$#1}}
\def\env#1{\texttt{\color{blue}\footnotesize #1}}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}
\definecolor{halfgray}{gray}{0.55}

\lstset{
basicstyle=\ttfamily\small,
keywordstyle=\bfseries\color{deepblue},
emphstyle=\ttfamily\color{deepred},    % Custom highlighting style
stringstyle=\color{deepgreen},
numbers=left,
numberstyle=\small\color{halfgray},
rulesepcolor=\color{red!20!green!20!blue!20},
}

%%%%%% VIDEO %%%%%%%%%%%%%%
\usepackage{multimedia}

%%%%%% BOX %%%%%%%%%%%%%%%%
\usepackage{fancybox}
\usepackage{varwidth}
\usepackage{subcaption}

\hfsetbordercolor{blue!50!black}

%%%%%% PGFPLOTS %%%%%%%%%%%%
\usepackage{pgfplots}

\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
\definecolor{mylilas}{RGB}{170,55,241}
\definecolor{BgYellow}{HTML}{FFF59C}
\definecolor{FrameYellow}{HTML}{F7A600}
\usetikzlibrary{spy}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns, matrix, positioning}
\usetikzlibrary{arrows.meta,
patterns.meta
}

\begin{document}

\begin{frame}{Equation des films minces générale}
\begin{exampleblock}{Cas cylindrique}
\begin{equation*}
\frac{\partial h}{\partial t} = \frac{1}{12 \mu r}  \frac{\partial}{\partial r}  \left(r h^{3} \left(\tikzmarkin<1->[set fill color=red!20, set border color=red]{a1}(0.075,-0.4)(-0.045,0.65) \rho g \frac{\partial h}{\partial r} \tikzmarkend{a1}+ \tikzmarkin<1->[set fill color=blue!20, set border color=blue]{e}(0.05,-0.4)(-0.045,0.65) D \frac{\partial}{\partial r}(\Delta^2_r h)  \tikzmarkend{e}  \right) \right)
\end{equation*}

\begin{tabular}{ccc}
Pesanteur &  & Elastique \\
\fcolorbox{red}{white}{\begin{aligned} R \propto t^{\frac{1}{2}} \end{aligned}} &
\fcolorbox{black}{white}{\begin{aligned} \lambda_{E-G} = \left(\frac{Ed^3}{12 \rho g (1 - \nu)} \right)^{\frac{1}{4}} \end{aligned}} &
\fcolorbox{blue}{white}{\begin{aligned} R \propto t^{\frac{1}{3}} \end{aligned}} \\
\end{tabular}
\end{exampleblock}
\end{frame}

\end{document}


I have this :

And I am trying to reproduce this :

Here one possible approach using tcolorbox:

\documentclass[french]{beamer}

%%%%%% ENCODAGE %%%%%%%%%%%
\usepackage[utf8]{inputenc}

%%%%%% TIKZ %%%%%%%%%%%%%%%
\usepackage[beamer,customcolors,norndcorners]{hf-tikz}

%%%%%% OTHERS %%%%%%%%%%%%%
\usepackage{booktabs,calligra}
\usepackage{listings,stackengine}

\author{XXX}
\title{XXX}
\subtitle{XXX}
\institute [XXX] {XXX \\ XXX}
\date{\today}

%%%%%% DEFINITIONS %%%%%%%%%
\def\cmd#1{\texttt{\color{red}\footnotesize $\backslash$#1}}
\def\env#1{\texttt{\color{blue}\footnotesize #1}}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}
\definecolor{halfgray}{gray}{0.55}

\lstset{
basicstyle=\ttfamily\small,
keywordstyle=\bfseries\color{deepblue},
emphstyle=\ttfamily\color{deepred},    % Custom highlighting style
stringstyle=\color{deepgreen},
numbers=left,
numberstyle=\small\color{halfgray},
rulesepcolor=\color{red!20!green!20!blue!20},
}

%%%%%% VIDEO %%%%%%%%%%%%%%
\usepackage{multimedia}

%%%%%% BOX %%%%%%%%%%%%%%%%
\usepackage{fancybox}
\usepackage{varwidth}
\usepackage{subcaption}

\hfsetbordercolor{blue!50!black}

%%%%%% PGFPLOTS %%%%%%%%%%%%
\usepackage{pgfplots}

\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
\definecolor{mylilas}{RGB}{170,55,241}
\definecolor{BgYellow}{HTML}{FFF59C}
\definecolor{FrameYellow}{HTML}{F7A600}
\usetikzlibrary{spy}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns, matrix, positioning}
\usetikzlibrary{arrows.meta,
patterns.meta
}

\usepackage[most]{tcolorbox}
\tcbset{highlight math style={enhanced,colframe=red,colback=red!10!white,boxsep=0pt,sharp corners,
equal height group=C,
minimum for equal height group=C:1.5cm,
valign=center,
}}

\begin{document}

\begin{frame}{Equation des films minces générale}
\begin{exampleblock}{Cas cylindrique}
\begin{equation*}
\frac{\partial h}{\partial t} = \frac{1}{12 \mu r}  \frac{\partial}{\partial r}  \left(r h^{3} \left(
%
\tcbhighmath[remember as=a,tcbox raise=-7mm]{
\rho g \frac{\partial h}{\partial r}
}
+
\tcbhighmath[remember as=b,colback=blue!10,colframe=blue,tcbox raise=-7mm]{
D \frac{\partial}{\partial r}(\Delta^2_r h)
}
\right) \right)
\end{equation*}

\vskip1.5cm

\begin{equation*}
\tcbhighmath[
tcbox raise=0mm,
remember as=c,
overlay={
\node[anchor=north] at (frame.south) {Pesanteur};
\draw[red,-latex,thick] (a.south) -- (frame.north);
}
]{
\displaystyle R \propto t^{\frac{1}{2}}
\tcbhighmath[
tcbox raise=0mm,
remember as=d,
colback=black!10,
colframe=black,
overlay={
\draw[black,-latex,thick] (c.east) -- (frame.west);
}
]{
\lambda_{E-G} = \left(\frac{Ed^3}{12 \rho g (1 - \nu)}  \right)^{\frac{1}{4}}
\tcbhighmath[
tcbox raise=0mm,
remember as=e,
colback=blue!10,
colframe=blue,
overlay={
\draw[blue,latex-,thick] (d.east) -- (frame.west);
\draw[blue,-latex,thick] (b.south) -- (frame.north);
\node[anchor=north] at (frame.south) {Elastique};
}
]{
R \propto t^{\frac{1}{3}}
}
\end{equation*}
\end{exampleblock}
\end{frame}

\end{document}


• Very nice solution using only tcolorbox. What a powerful package it is! Sep 15 at 11:51
• @SebGlav Very powerful, indeed! Sep 15 at 11:54
• Thank you for the answer : do you know in this case what is the difference between tcbhighmath and tcboxmath ? Because I have tried the second option and it doesn't work compared to the first one. Thanks !
– Wiss
Sep 16 at 9:13
• @Wiss \tcboxmath works as well, but you'll have to specify the options separately because it does not listen to highlight math style Sep 16 at 9:18
• @Wiss You also need the other options from highlight math style, in particular enhanced Sep 16 at 9:23