Take the 2-minute tour ×
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.

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
add comment

3 Answers 3

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.

Alexander

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{hyperref}
\makeatletter
\InputIfFileExists{\jobname.zom}{}{}
\newsavebox\zbox
\newcounter{zoom}
\newwrite\zoomdat
\immediate\openout\zoomdat=\jobname.zom

\newcommand{\zoombox}[2][0]{%
  \sbox\zbox{#2}%
  \special{pdf: dest (zb\thezoom.out) [@thispage /Fit]}%
  \raisebox{-\dp\zbox}{\pdfsavepos}%
  \protected@write\zoomdat{}{%
    \string\expandafter\string\def\string\csname\space zb\thezoom.llx\string\endcsname{%
      \noexpand\number\pdflastxpos}%
    \string\expandafter\string\def\string\csname\space zb\thezoom.lly\string\endcsname{%
      \noexpand\number\pdflastypos}%
  }%
  \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
    <<
      /Type/Annot/Subtype/Link/H/N
      /Border [0 0 #1 [1 2]]
      /A <<
        /S/JavaScript
        /JS (
          if(typeof(zoomed\thezoom)=='undefined'){
            this.gotoNamedDest('zb\thezoom.out');
            var zoomed\thezoom=false;
          }
        )
        /Next <<
          /S/GoTo/D (zb\thezoom.in)
          /Next <<
            /S/JavaScript
            /JS(
              if(zoomed\thezoom){
                 this.gotoNamedDest('zb\thezoom.out');
                 zoomed\thezoom=false;
              }else{
                 zoomed\thezoom=true;
              }
            )
          >>
        >>
      >>
    >>}%
  \fi\fi%
  \usebox{\zbox}\raisebox{\ht\zbox}{\pdfsavepos}%
  \protected@write\zoomdat{}{%
    \string\expandafter\string\def\string\csname\space zb\thezoom.urx\string\endcsname{%
      \noexpand\number\pdflastxpos}%
    \string\expandafter\string\def\string\csname\space zb\thezoom.ury\string\endcsname{%
      \noexpand\number\pdflastypos}%
  }%
  \stepcounter{zoom}%
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

EDIT:

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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.