2

The MathJax JavaScript library contains a command that lets you create LaTeX slideshows, namely the \toggle command.

I would find it incredibly useful to produce the same effect in a PDF file, most prominently to consecutively draw complicated commutative diagrams. Hence, my questions:

  1. Can modern PDF documents contain slideshow elements of some kind?
  2. If so, is there a LaTeX package that allows me to create this effect in a PDF document?

Edit: By popular request, here's an example:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Toggle Math</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="Toggle Math">
        <meta name="author" content="Jesko">
        <script type="text/x-mathjax-config">
        MathJax.Hub.Config({
            tex2jax: {
                inlineMath:  [['$',  '$'  ]],
                displayMath: [['\\[','\\]'], ['$$','$$']],
                processEscapes: true
            },
            TeX: { 
                equationNumbers: { autoNumber: "AMS" },
                extensions: ["AMSmath.js", "AMSsymbols.js","action.js" ]
            } 
        });
        </script>        
        <script type="text/javascript"
          src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
        </script>
    </head>

    <body>
    <script type="math/tex">

      \toggle{x=1}{x=2}{x=3}\endtoggle

    </script>
    </body>
</html>

Just put that in a .html file and check it out.

  • 1
    Can you give an MWE to play with? – hpesoj626 Jan 10 '13 at 1:28
  • Sure, I added one. – Jesko Hüttenhain Jan 10 '13 at 7:59
  • Sounds like a presentation: look at beamer or powerdot: see Which package to use for presentations ? Beamer, Prosper, or Other. In beamer what you describe is called an 'overlay action', and generates one PDF page per 'effect'. – Joseph Wright Jan 10 '13 at 8:07
  • I'm assuming that 'change page' is acceptable to alter the display: you can also define clickable areas in PDF files to create internal links, but usually changing page suffices. – Joseph Wright Jan 10 '13 at 8:09
  • No, that's not what I want at all. I am picturing a commutative diagram inside a proof, with text above and below it, and I simply click inside the PDF to slideshow through it. I am well-aware that I can create slideshows with beamer, but that's not what I am looking for. In particular, 'change page' is not really a solution =/. – Jesko Hüttenhain Jan 10 '13 at 8:46
2

The code below reproduces your html example as a PDF. Use Adobe Reader for display.

\documentclass{article}
\usepackage{animate}

\begin{document}
\begin{animateinline}[step]{1}
  \strut$x=1$
\newframe
  \strut$x=2$
\newframe
  \strut$x=3$
\end{animateinline}
\end{document}
  • Perfect. I wish I had more than one upvote. Thanks! – Jesko Hüttenhain Jan 10 '13 at 12:17
  • @Jesko Thanks! Note that you will have to put multiline text into parboxes, preferably into minipages, and that all frames should place their text into minipages of same horizontal and vertical dimensions. Otherwise the text may be distorted. Thus, \begin{minipage}[t|c|b][<height>]{<width>} ... \end{minipage} – AlexG Jan 10 '13 at 12:49

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.