I'm writing some math notes and I'd like for the reader to have the option to click on a certain phrase in the document (such as "click here to see more details") in order to make a more detailed version of a calculation appear.

This more detailed calculation should originally be hidden. Any reader who does not understand the shorter calculation (which skips steps) can click to expand the detailed version.

Is there a way to make this happen using Latex?


The ocgx2 package provides switchable layers for PDF. Because PDF is a static format and page breaks have to be known at the time of typesetting, the hidden layer will occupy empty space. You could put the text as an overlay with TikZ, but I'll leave this as an exercise.


\[ a^2 + b^2 = c^2 \]

\switchocg{details}{toggle details}


text below


enter image description here

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.