[Tex/LaTex] Equation over picture (overpic)

equationsgraphicsoverpic

Is there a way to place a mathematical equation over a picture? I am using the overpic package and \put command, but it doesn't work (\usemath, \begin{equation}...\end{equation}).

\begin{figure}[h!]
  \caption{Caption}
  \centering
   \begin{overpic}[width=\textwidth]{ipad-frame.jpg}
    \put(150,140){
     \color{black
     \begin{equation} 
     \cos\alpha = \frac{u \times v}{|u| \times |v|}
     \end{equation}
     }
    }
   \end{overpic}
\end{figure}

Any way to solve this?

Best Answer

you have to put the equation into a \parbox:

\documentclass{article}
\usepackage[abs]{overpic}
\usepackage{xcolor,varwidth}
\begin{document}

\begin{overpic}[grid,scale=0.5,unit=1mm]{tiger}
\put(30,60){\colorbox{white}{\parbox{0.4\linewidth}{%
     \begin{equation}
     \cos\alpha = \frac{u \times v}{|u| \times |v|}
     \end{equation}}}}
\end{overpic}

\end{document}

enter image description here