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


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


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 1 '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 1 '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 1 '13 at 13:09

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.