I would like to create a show/hide button that appears on a typeset PDF so that when it is clicked, the content appears. This is similar to the ideas here: Hide all but one instances of a custom environment and here: hide proof environment for restructuring, but I would like the option to show up in the PDF itself as a simple button that could be clicked (or something similar) Ideally, this would end up looking something like this:

\newcommand{showhide}[1]{Does what I am describing}


\showhide{Displays a button, that when clicked, shows this text
and when clicked again, hides this text.}


Anyone know how do do this, or something similar?

  • 3
    Read documentation of ocgx. In the documents tree of your TeX distribution also a file demo-ocgx.pdf is included, try executing texdoc demo-ocgx on your command prompt. The according tex file is found in the source tree.
    – Speravir
    Apr 1, 2014 at 0:33
  • Or try the \tooltip macro from tex.stackexchange.com/a/164186
    – AlexG
    Sep 25, 2014 at 19:05


Browse other questions tagged .