I remember long time ago, seeing PDF documents (such as online PDF versions of newspapers) that had hypertext boxes around paragraphs, such that when you clicked inside those boxes the surrounded paragraph will be zoomed in to exactly that paragraph in the Acrobat Reader window. I am not sure what tool was used to create those PDFs, and unfortunately I can't find one example at the moment.
Is it possible to reproduce such zoom-on-click feature with some pdflatex code?
To repeat: the requested feature is to create hypertext boxes around paragraphs or figures that when clicked the PDF viewer would zoom in into that region.
This feature can be useful in PDFs with lots of structure in a given page, such as small paragraphs or figures or figure captions scattered around the page.
(Beamer has a "zoom in" feature (\framezoom
) but it is not the same thing because that creates a new page with the zoomed region, and I just want to force the PDF reader to enclose the area in the same page by only zooming. I am also aware of marquee zoom in Acrobat but it is not what I am looking for because it is not aware of the content.)
Best Answer
The following code (for use with pdfLaTeX) defines the command
\zoombox[box line width]{contents}
. It creates a click-to-zoom box for fitting the second argument 'contents' into the AdobeReader window. A dotted line is drawn around the box if the optional 'box line width' is >0.EDIT: The code has been optimized for presentation PDFs (such as
beamer
generated ones) looked at in full screen mode. The zoom-to box is now centred on the screen when clicked, as requested by @alfC.The second example defines pairs of commands for marking opposing corners (lower left & upper right .OR. upper left & lower right) of a zoom box, and commands for marking text sequences/entire paragraphs.
The two commands for marking the corners of a zoom area are
and
They are meant to be used in picture-making environments, such as
pspicture
ortikzpicture
. Associated command pairs must be identified by unique labels.For marking text and paragraphs the following commands have been provided:
The starred versions insert horizontal space (negative
\parindent
on first line,\hfill
at the end of the paragraph).Zoom areas may be nested. However, smaller ones should be placed on top of bigger ones (i.e. to appear later in the code), in order not to be obscured.
Note that at least two
pdflatex
runs are necessary.EDIT:
A dvipdfmx/XeLaTeX version of the
\zoombox
macro is given in: How do I include a click-to-zoom thumbnail picture in a non-beamer document?