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

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – cryingshadow Jan 1 '15 at 13:42
4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.