The Beamer class for presentations provides a way (using the \framezoom command) to include a picture in the document on which one can click to zoom in, and then zoom back out with another click. How can I get the same effect in a non-beamer document; more specifically, in an article-class document compiled using XeLaTeX?

Is there a package that provides this functionality to a document in the article class?


Here is a solution that works with XeLaTeX and LaTeX->dvipdfmx in any document class. It uses some JavaScript and hence works best in AdobeReader. Just insert the code below into the document preamble. The code defines the command

\zoombox[box line width]{general text}

to be used in the document. It makes general text clickable to toggle between zoomed-in and zoomed-out states. In the zoomed-in state general text is magnified just enough to fit entirely into the application window.

In your case, general text should be something like \inlcudegraphics[scale=0.1]{picture}, which includes your picture at its original resolution but scaled down to the desired size of the thumbnail. That is, only one version of the picture needs to be included.

Note that the document requires at least two runs of (Xe)LaTeX.



  \special{pdf: dest (zb\thezoom.out) [@thispage /Fit]}%
    \string\expandafter\string\def\string\csname\space zb\thezoom.llx\string\endcsname{%
    \string\expandafter\string\def\string\csname\space zb\thezoom.lly\string\endcsname{%
  \ifcsname zb\thezoom.llx\endcsname\ifcsname zb\thezoom.urx\endcsname%
    \special{pdf: dest (zb\thezoom.in) [ @thispage /FitR
      \hypercalcbp{\csname zb\thezoom.llx\endcsname sp}
      \hypercalcbp{\csname zb\thezoom.lly\endcsname sp}
      \hypercalcbp{\csname zb\thezoom.urx\endcsname sp}
      \hypercalcbp{\csname zb\thezoom.ury\endcsname sp}
    \special{pdf: ann
      width  \the\wd\zbox\space
      height \the\ht\zbox\space
      depth  \the\dp\zbox\space
      /Border [0 0 #1 [1 2]]
      /A <<
        /JS (
            var zoomed\thezoom=false;
        /Next <<
          /S/GoTo/D (zb\thezoom.in)
          /Next <<
    \string\expandafter\string\def\string\csname\space zb\thezoom.urx\string\endcsname{%
    \string\expandafter\string\def\string\csname\space zb\thezoom.ury\string\endcsname{%


Optional argument box line width added to \zoombox macro. Adds a dotted line around the zoom area of given line width, measured in screen pixels. Default: 0 (no visible box).

A pdftex version of the \zoombox macro is given in: Automatic "Zoom in" hypertext boxes in PDF.


As far as I can see the \framezoom command doesn't use javascript or something similar but simply generate two slides (one with the large picture) and some links between both slides. This could certainly be done with article too: You could e.g. put the large versions on empty pages at the end of the article.


You can use the ocgtools package. It provides the \ocgpicture command.

  • Thank you. Unfortunately for me, ocgtools doesn't work with XeLaTeX, and so I cannot use this package.
    – gphilip
    Oct 16 '10 at 21:26

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.