I've been writing a mathematical text for some time, and seeing as it is the 21st century, I would like this text to be interactive and dynamic, probably in PDF format. The main function that I am looking to implement is a sort of "spoiler text" environment where the user can click a button to reveal content that is otherwise collapsed and unseen. This could be used to hide answers to exercises or proofs for theorems, etc.
I am led to believe that this is possible by using some form of Javascript embedded in LaTeX. Can somebody point me to a reference that would allow me to implement this, or better yet, explain to me how I should design this "spoiler text" environment?
Best Answer
Ok, this is an ugly hack, but if nothing else works, well, this will work. This is from The PracTEX Journal, 2006, No. 4, Article revision 2006/11/03, Hypertext capabilities with pdfTEX by Federico Garcia.
This is via pdfTEX primitives, so I have no idea what is going on with it. It makes a postit note in the document that you click on to see the text.
Instructions:
Also note: This works fine in Adobe. It doesn't work at all in Sumatra PDF. Well, the note shows up, but you can't click it. So this is a bit risky (So is javascript for that matter, as a lot of PDF readers avoid it for security reasons).
A bit more from the article:
Well, that is one way. A terrible, terrible way, but it would technically work.