# Is there a way to put an “expandable” or “click here to show text” section in a PDF?

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.

\documentclass{article}
\usepackage{ocgx2}
\usepackage{blindtext}
\begin{document}

$a^2 + b^2 = c^2$

\switchocg{details}{toggle details}

\begin{ocg}{details}{details}{off}
\blindtext
\end{ocg}

text below

\end{document}