7

I want to replace a word by another one on the next slide. I know there are commands that allow to do so (say, \uncover), but they require to carefully calculate the numbers of the slides where the command is used. However, I intend to edit my presentation, which would mean that every time when the number of slides changes, I will have to edit all such comands. Are there simple ways to avoid the problem?

Zarko
  • 296,517
IiiI
  • 73
  • 1
    A traditional LaTeX way is, on the next slide, not to use the actual word, but a macro that points to a word, as in here is \myword{} on the next slide. That way, on the prior slide, you could say \def\myword{elephant} and then, on the next slide, what would show up would be here is elephant on the next slide – Steven B. Segletes Jun 15 '16 at 16:47
  • 2
    http://tex.stackexchange.com/questions/154521/relative-overlay-specification-in-beamer – Joseph Wright Jun 15 '16 at 16:47
  • 2
    http://www.texdev.net/2014/01/17/the-beamer-slide-overlay-concept/ – Joseph Wright Jun 15 '16 at 16:47
  • http://tug.org/TUGboat/tb35-1/tb109wright.pdf – Joseph Wright Jun 15 '16 at 16:49
  • I am new in this business, may I ask you to give a simple example, please... – IiiI Jun 15 '16 at 16:59
  • @Steven: I don't understand how to redefine the elephant on the next slide. – IiiI Jun 15 '16 at 17:04
  • Well, the way joseph interpreted your question is different than the way I interpreted it. It would be best if you posted a complete but minimum working example of code to show what you had in mind. – Steven B. Segletes Jun 15 '16 at 17:08
  • I want to have I see an elephant on the N-th slide, and I see a giraffe on the slides no. N+1, N+2, and so on, until the end of the frame. That is, an elephant should be replaced by a giraffe. – IiiI Jun 15 '16 at 17:13
  • "I am new in this business, may I ask you to give a simple example." From your question it sounds like you already have some working code. Please post your working code. And please point out which are the numbers you would prefer not to have to edit everytime you change something. Then someone will probably be able to post an answer based on Joseph Wright's first comment. – Willie Wong Jun 15 '16 at 17:40
  • @Willie: this is a text of an article which I adapt for a presentation. Of course, the paper is not devoted to elephants. – IiiI Jun 15 '16 at 17:46

2 Answers2

10
\documentclass{beamer}
\begin{document}

\begin{frame}{main title}{subtitle}
\begin{itemize}[<+->]
    \item foo
    \item bar \only<.>{baz}\only<+->{BAZ}
    \item foobar
\end{itemize}
\end{frame}

\end{document}

<.> the current slide

<+-> the next and following slide

and without itemize

\begin{frame}{main title}{subtitle}
\only<1>{elephant}\only<2->{giraffe}
\end{frame}
  • I am sure this works, but I meant a sentence, not an itemized structure... Is it possible to adapt it to my situation, which is like the following: I want to have I see an elephant on the N-th slide, and I see a giraffe on the slides no. N+1, N+2, and so on, until the end of the frame. – IiiI Jun 15 '16 at 17:52
  • That makes no difference: \includegraphics<.>{elephant}\includegraphics<+->{giraffe} –  Jun 15 '16 at 17:54
  • I copied your code to my file, it says ! LaTeX Error: File `elephant' not found. – IiiI Jun 15 '16 at 18:02
  • I gave an example with two images which I do not have! You have to adopt it and use image names which are exist on your system. For words simply use \only<.>{elephant}\only<+->{giraffe} –  Jun 15 '16 at 18:06
  • Are you sure in \only<.>{elephant}\only<+->{giraffe} ? Elephant is not visible. – IiiI Jun 15 '16 at 18:10
  • see extended answer –  Jun 15 '16 at 18:14
1

Another option is to use the \alt command. This displays either a default text or an alternate text, depending on the overlay specifications (see section 9.2 of the beamer documentation).

\documentclass{beamer}
\begin{document}

\begin{frame}{main title}{subtitle}
\begin{itemize}[<+->]
    \item foo
    \item bar \alt<.>{baz}{BAZ}
    \item foobar
\end{itemize}
\end{frame}

\end{document}
erik
  • 12,673