TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 8 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.