# How can I create a show/hide button? [duplicate]

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:

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

\begin{document}

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

\end{document}


Anyone know how do do this, or something similar?

• 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 '14 at 0:33
• Or try the \tooltip macro from tex.stackexchange.com/a/164186 – AlexG Sep 25 '14 at 19:05