15

I want this in the same frame, not a different frame. Here is an example of what I'd like:

\documentclass[mathserif]{beamer}
\usetheme{Copenhagen}
\usepackage{color,xcolor,ucs}
\usepackage{beamerthemesplit}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb,setspace,mathtools}
\begin{document}
\section{Introduction}
\frame{\frametitle{NPDE}
\begin{itemize}
    \pause
  \item item 1 here
    \pause
  \item item 2 here
    \pause
  \begin{equation*}
          \frac{\partial u}{\partial t}= {\color{red}u(n,t)}u(n+1,t) -u(n,t)u(n-1,t)
  \end{equation*}
  %then I want this on the next click:
  \pause
    \begin{equation}
        \notag
        \frac{\partial u}{\partial t}=u(n,t){\color{red}u(n+1,t)}-u(n,t)u(n-1,t)
  \end{equation}
\end{itemize}
}
\end{document}
  • 1
    But if you want the second part "on the next click", it will be on a different slide; perhaps you meant "I want this in the same frame, not a different frame"? – Gonzalo Medina Jul 22 '12 at 17:36
12

You can use the \only overlay specification:

\documentclass[mathserif]{beamer}
\usetheme{Copenhagen}
\usepackage{color,xcolor,ucs}
\usepackage{beamerthemesplit}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb,setspace,mathtools}
\begin{document}
\section{Introduction}
\frame{\frametitle{NPDE}
\begin{itemize}
    \pause
  \item item 1 here
    \pause
  \item item 2 here
    \pause
  \begin{equation*}
          \frac{\partial u}{\partial t}= \only<4>{\textcolor{red}{u(n,t)}u(n+1,t)}\only<5>{u(n,t)\textcolor{red}{u(n+1,t)}} -u(n,t)u(n-1,t)
  \end{equation*}
\end{itemize}
}
\end{document}

And here are the fourth and fifth slides showing the relevant equation:

enter image description here

  • YES!! thank you Gonzalo!! and yes I meant the same frame (I'm still new to latex, but thank you!) – norma Jul 22 '12 at 17:46
  • 3
    Adapting Gonzalo's suggestion, you could also define a command before \begin{document}, such as: \newcommand<>{\colorize}[4]{\only<#1>{#4}\only<#2>{\textcolor{#3}{#4}}} and use it as \colorize{4}{1-3,5-}{red}{u(n,t)} – anderstood Oct 1 '13 at 12:27
1

I know this is an old question, but the following is a bit more straightforward than the other answer provide (IMO).

Just add an overlay specification to the \textcolor command:

\documentclass[mathserif]{beamer}
\usetheme{Copenhagen}
\usepackage{color,xcolor,ucs}
\usepackage{beamerthemesplit}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb,setspace,mathtools}
\begin{document}
\section{Introduction}
\frame{\frametitle{NPDE}
\begin{itemize}
  \item<2-> item 1 here
  \item<3-> item 2 here
  \begin{equation*}
          \frac{\partial u}{\partial t}= \textcolor<3>{red}{u(n,t)}\textcolor<4>{red}{u(n+1,t)} -u(n,t)u(n-1,t)
  \end{equation*}
\end{itemize}
}
\end{document}
  • This is a better way to do any of such changes imho. Works with most if not all environments and commands. – gr4nt3d Apr 6 '18 at 18:42

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.