I need an appearing effect for text like the one (in javascript) here http://jsfiddle.net/VZvK7/.

However I don't know how to insert js code into LaTeX (apart from using the AcroTeX Bundle) and that would also force me to use Acrobat Reader, so I'd like to implement a similar effect in Beamer. Is it possible?

(of course I would love to see alternative approaches to this)

1 Answer 1


The basic idea is to put each letter into a single slide.

\usepackage{ragged2e}   %for justification


    \foreach \l in {#1}{%

    \foreach \i in {#2}{%
        \temporal<+>{}{\Large\bfseries \vphantom{Mpgjy}\i}{\vphantom{Mpgjy}\i}%        %the phantom removes the bumping



What I used:

  1. \comma: a macro for having commas in text without messing up the loop
  2. \myduration: a macro that sets a \transduration effect of .05 seconds. For each letter.
  3. \anitext: a macro for setting the animation effect using Beamer \temporal internally, in the example the text appears as bold and \Large and then goes back to normal.

Of course the text to be animated needs to be pre-processed so that each letter is followed by a comma. To do that I put the text to be animated into a separate file and used:

cat <finename> | fold -w1 | paste -sd+, -

Also, each space needs to be replaced by a \space macro (I did it via search&replace).

The first argument of the \anitext macro is equal to the number of characters in the original text (without the commas). It is also possible to add a comma after each couple of characterd (with fold -w2) but then the animation is less fluid.

enter image description here

In the MwE the animated text starts at slide number 2, so that the user can advance to slide number 2 when he wants to start the animation and then admire the fake animation :)

I used this also with longer text, up to 450 characters, and apart from the ridiculous number of slides of the resulting PDF, it works fine.

  • Effects like this are easy to get with common presentation programs (which I wouldn't mention the name of). They are annoying, to say the least.
    – egreg
    Commented Oct 4, 2014 at 19:31
  • @egreg I think I may have an idea which program you are referring to ;). Anyway, in general I agree (I wouldn't use this into some serious-professional-whatever presentation - if not for pissing off the public), but then, there are more use cases in heaven and earth than are dreamt in your philosophy, as the Poet famously said :)
    – d-cmst
    Commented Oct 4, 2014 at 19:38
  • 1
    Is there some way to do this more "automatic" using luatex?
    – TeXtnik
    Commented Jun 18, 2019 at 7:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .