This question already has an answer here:

I'm using Gummi on Ubuntu 14.04. I like Gummi because it gives me a live preview as I type lots of maths equations. But this is besides the point.

My question: Is there a way to "attach" an expandable\collapsible [+] / [-] type button to a given paragraph so that when the button is clicked within the PDF the associated paragraph either appears or disappears?

When writing up my maths notes this would be a very useful feature as it would allow to either display or hide proofs. Sometimes, it's nice just to have the results shown, without the proofs. On the other hand, it would be desirable to have the proofs to hand when required.

Please note I would like this functionality within the compiled PDF, not the actual tex code.


As suggested by Martin Schröder in the comments here is a similar question regarding ocgx.

marked as duplicate by Bruno Le Floch, user13907, user36296, barbara beeton, Zarko Oct 5 '16 at 18:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    I would guess that this functionality is mostly dependent on your choice of PDF viewer... there are a number of similar questions on this site dealing with advanced capabilities of PDF output, you may want to try looking around for them. In addition, I know that the microtype manual contains somewhat similar features as you are asking about – darthbith Sep 23 '14 at 16:29
  • 1
    Welcome to TeX.SX! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. A suggestion: Do us a favour and change your username to something more telling than "user1234". – Martin Schröder Sep 23 '14 at 16:33
  • I think you have two options: Either use OCGs or ECMAScript. Since neither is TeX-specific, I kindly suggest that you ask your question on Stack Overflow and then come back when you know what must be changed in the PDF. – Martin Schröder Sep 23 '14 at 16:37
  • Regarding ocgs, I don't seem to find much online. I do however find ocgx, the demo PDF of which does not seem to provide what I'm looking for on the face of it. Am I missing something? – Pixel Sep 23 '14 at 16:57
  • 1
    @pbs Check the demo at archive.cs.uu.nl/mirror/CTAN/macros/latex/contrib/ocgx/…, check slide 2, with the "Hide" and "Show" buttons. – 1010011010 Sep 23 '14 at 17:21

Browse other questions tagged or ask your own question.