3

I have a picture in a beamer frame, and I want to add text and equations to it, but not all at once. Rather, I want to add them step by step.

I know how to do this using a combination of \only<..> and \begin{overpic}, but the problem is that I have to keep repeating everthing in each \only.

Any help about how to do that without repeating everything?

EDIT:

\documentclass{beamer}
\usefonttheme[onlymath]{serif}
\usepackage{mathrsfs}
\usepackage[percent]{overpic}

\usetheme{Warsaw}
\usetheme{Berlin}

\begin{document}


\begin{frame}{First Diagram}
%%%%%%%%%%%%%%%%%%%%%%%%
\only<1-1> {


    \begin{columns}[T] % align columns
    \begin{column}{.5\textwidth}
    \begin{overpic}[scale=.5 ]{me.jpg}
     \put(55,5) {$\bar{u}(3)$}
    \end{overpic}

    \end{column}%
    %\hfill%
    \begin{column}{.5\textwidth}
    $\mathscr{M}=\int \bar u(3) $
    \end{column}%
    \end{columns}
}

\only<2-2> {


    \begin{columns}[T] % align columns
    \begin{column}{.5\textwidth}
    \begin{overpic}[scale=.5 ]{me.jpg}
         \put(55,5) {$\bar{u}(3)$}
     \put (35,17) {$ ig \gamma^\mu$}
    \end{overpic}

    \end{column}%
    %\hfill%
    \begin{column}{.5\textwidth}
    $\mathscr{M}=\int \bar u(3) ig \gamma^\mu$
    \end{column}%
    \end{columns}
}

\end{frame}

\end{document}

These two slides are the results of the code, and they're as I want them to be

enter image description here

1 Answers1

5

You could use a tikzpicture to do this fairly easily. The technique described by Caramdir in this answer helps with specifying appropriate locations for the textual additions. Another answer there explains how to use a grid to help with positioning, should that be required.

\documentclass{beamer}
\usefonttheme[onlymath]{serif}
\usepackage{mathrsfs,tikz}

\usetheme{Warsaw}
\usetheme{Berlin}

\begin{document}
  \begin{frame}{First Diagram}
      \begin{columns}[T] % align columns
        \begin{column}{.5\textwidth}
          \begin{tikzpicture}
            % ref: https://tex.stackexchange.com/a/9561/ - Caramdir
            \node (image) [anchor=south west, inner sep=0pt] {\includegraphics[scale=.5]{example-image-a}};
            \begin{scope}[x={(image.south east)}, y={(image.north west)}]
                \node <1-> at (.55,.05) {$\bar{u}(3)$};
                \node <2-> at (.35,.17) {$ ig \gamma^\mu$};
            \end{scope}
          \end{tikzpicture}
        \end{column}%
        \begin{column}{.5\textwidth}
          $\mathscr{M}=\int \bar u(3) $\onslide<2->{$ig \gamma^\mu$}
        \end{column}%
      \end{columns}
  \end{frame}
\end{document}

incremental additions

cfr
  • 198,882