6

I am looking a way to generate a toggle region in PDF compiled by pdflatex. Something like this implemented with javascript in html

http://www.randomsnippets.com/2008/02/12/how-to-hide-and-show-your-div/

I remember long time ago I saw a post online to implement this function but I can't find that post anymore.

user1285419
  • 1,121
  • 2
    you can search for ocgx from Paul Gaborit. The manual has a few nifty examples. http://tex.stackexchange.com/questions/65096/how-to-make-a-diagram-composed-of-superimposed-layers-where-the-viewer-can-make – percusse Feb 01 '13 at 01:20
  • 1
    But collapsing won't be possible. – AlexG Feb 01 '13 at 09:27

1 Answers1

1

Your best bet would be to use PDF layers, i.e. . That's the only way you can emulate collapsing.

  • I doubt that collapsing works in addition to hide/display page content using ocgs. The reason is that the effect of changing the current transformation matrix within marked content (BDC ... EMC) is not local. – AlexG Feb 01 '13 at 12:03
  • @AlexG: You would have to put the rest of the page/block for both case (collapsed/uncollapsed) on different layers. Ugly, but it may work (I haven't tested this for pages, I know it works for blocks). – Martin Schröder Feb 01 '13 at 12:07
  • Ok, this may indeed be possible, but difficult in case of multiple vertically aligned collapsable blocks. Every possible combination of expanded and collapsed blocks would have to be prepared beforehand. – AlexG Feb 01 '13 at 13:09