Explain formula using beamer
You can use the tikzmark
library; the idea is to place some marks at the desired locations and then to use those marks to have pointers for the explanations:
\documentclass{beamer}
\usetheme{Madrid}
\usepackage{tikz}
\usetikzlibrary{tikzmark,positioning}
\begin{document}
\begin{frame}
\begin{exampleblock}{Baye's theorem}
\[
\tikzmark{ptd}p(\theta\, |\, D) = \frac{\tikzmark{pdt}p(D\,|\,\theta) p(\theta)}{\tikzmark{pd}p(D)}
\]
\begin{tikzpicture}[
remember picture,
overlay,
expl/.style={draw=orange,fill=orange!30,rounded corners,text width=3cm},
arrow/.style={red!80!black,ultra thick,->,>=latex}
]
\node<2->[expl]
(ptdex)
at (2,-2cm)
{Some explanation};
\node<3->[expl]
(pdtex)
at (6,3.5cm)
{Some other explanation; this one is a little longer};
\node<4->[expl]
(pdex)
at (9,-3cm)
{Some other explanation};
\draw<2->[arrow]
(ptdex) to[out=100,in=180] ([yshift=0.5ex]{pic cs:ptd});
\draw<3->[arrow]
(pdtex.west) to[out=180,in=180] ([yshift=0.5ex]{pic cs:pdt});
\draw<4->[arrow]
(pdex.north) to[out=90,in=180] ([yshift=0.5ex]{pic cs:pd});
\end{tikzpicture}
\end{exampleblock}
\end{frame}
\end{document}
An animation of the result:
Update
If, for some reason, the tikzmark
library is not available and no overlays are wanted, use
\documentclass{beamer}
\usetheme{Madrid}
\usepackage{tikz}
\newcommand\tikzmark[1]{
\tikz[remember picture,overlay] \coordinate (#1);
}
\begin{document}
\begin{frame}
\begin{exampleblock}{Baye's theorem}
\[
\tikzmark{ptd}p(\theta\, |\, D) = \frac{\tikzmark{pdt}p(D\,|\,\theta) p(\theta)\tikzmark{pt}}{\tikzmark{pd}p(D)}
\]
\begin{tikzpicture}[
remember picture,
overlay,
expl/.style={draw=orange,fill=orange!30,rounded corners,text width=3cm},
arrow/.style={red!80!black,ultra thick,->,>=latex}
]
\node[expl]
(ptdex)
at (2,-2cm)
{Some explanation};
\node[expl]
(pdtex)
at (4,3.5cm)
{Some other explanation; this one is a little longer};
\node[expl]
(pdex)
at (9,-3cm)
{Some other explanation};
\node[expl]
(ptex)
at (8,3.5cm)
{Some other explanation; this one is a little longer};
\draw[arrow]
(ptdex) to[out=100,in=180] ([yshift=0.5ex]{ptd});
\draw[arrow]
(pdtex.west) to[out=180,in=180] ([yshift=0.5ex]{pdt});
\draw[arrow]
(pdex.north) to[out=90,in=180] ([yshift=0.5ex]{pd});
\draw[arrow]
(ptex.east) to[out=0,in=0] ([yshift=0.5ex]{pt});
\end{tikzpicture}
\end{exampleblock}
\end{frame}
\end{document}
The result:
Gonzalo's answer is probably better (certainly more flexible), but I'm not going to throw this one away. There's nothing special in having fractions here, it's just a pain to get all the braces and semicolons correctly placed for the \node
commands. I've also relabeled the nodes to have abbreviated names instead of numbers.
\documentclass{beamer}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{arrows,shapes}
\begin{document}
\tikzstyle{every picture}+=[remember picture]
\everymath{\displaystyle}
\begin{frame}
\tikzstyle{na} = [baseline=-.5ex]
\begin{itemize}[<+-| alert@+>]
\item Class Prior Probability
\tikz[na]\node [coordinate] (nCPP) {};
\item Likelihood
\tikz[na]\node [coordinate] (nL) {};
\end{itemize}
\begin{equation*}
\frac{
\tikz[baseline]{\node[fill=blue!20,anchor=base] (tL) {$p(D|\theta)$};}
\tikz[baseline]{\node[fill=red!20,anchor=base] (tCPP) {$p(\theta)$};}
}
{
\tikz[baseline]{\node[fill=green!20,anchor=base] (tPPP) {$p(D)$};}
}
=
\tikz[baseline]{\node[fill=yellow!20,anchor=base] (tPP) {$p(\theta | D)$};}
\end{equation*}
\begin{itemize}[<+-| alert@+>]
\item Predictor Prior Probability
\tikz[na]\node [coordinate] (nPPP) {};
\item Posterior probability
\tikz[na] \node[coordinate] (nPP) {};
\end{itemize}
\begin{tikzpicture}[overlay]
\path[->]<1-> (nCPP) edge [bend left] (tCPP);
\path[->]<2-> (nL) edge [bend left] (tL);
\path[->]<3-> (nPPP) edge [out=0, in=0] (tPPP);
\path[->]<4-> (nPP) edge [out=0, in=-90] (tPP);
\end{tikzpicture}
\end{frame}
\end{document}
Full credit to Gonzalo's Code. This is just a cleaner (in my opinion) way of obtaining the same effect.
MWE:
\documentclass[10pt,english,compress]{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes,calc}
%My predefined color
\definecolor{myblue}{rgb}{0.1,0.15,0.7}
%Set color for Annotations
\colorlet{annotcol}{myblue!80!black}
%Store coordinates of points
\newcommand\tikzmark[1]{
\tikz[remember picture,overlay] \coordinate (#1);
}
%Command to add annotation above
\newcommand{\noteup}[3][0em,0em]{
\begin{tikzpicture}[
remember picture,
overlay]
\node[draw=annotcol,fill=white,ellipse,very thick,minimum width=2cm]
(mynode)
at ([shift=($({#1})+({0em,+5.5em})$)]{#2.north})
{\begin{minipage}{2cm}\centering #3\end{minipage}};
\draw[annotcol,very thick,->,>=latex]
(mynode.south) to[out=-90,in=+90] ([xshift=0.5em,yshift=1.3em]{#2});
\end{tikzpicture}
}
%Command to add annotation below
\newcommand{\notedown}[3][0em,0em]{
\begin{tikzpicture}[
remember picture,
overlay]
\node[draw=annotcol,fill=white,ellipse,very thick,minimum width=2cm]
(mynode)
at ([shift=($({#1})+({0em,-4em})$)]{#2.south})
{\begin{minipage}{2cm}\centering #3\end{minipage}};
\draw[annotcol,very thick,->,>=latex]
(mynode.north) to[out=90,in=-90] ([xshift=0.5em,yshift=-0.1em]{#2});
\end{tikzpicture}
}
%Beamer Slides
\begin{document}
\frame{
% Equation
\begin{center}
{\Large $\tikzmark{P}P = \tikzmark{PT}P_T + \tikzmark{PP}P^+ + \tikzmark{PN}P^-$}
\end{center}
%Annotations
\notedown{P}{Total Value of P}
\noteup[-1em,0em]{PT}{Value of P for T}
\noteup[5em,0em]{PP}{Value of P for +}
}
\end{document}