I want to display ocgs in a pdf and use the ocgx package to achieve this. Sometimes the content I have in the environment is so long it needs a page break. This is incompatible with the ocg system and the content on the second page is always displayed instead of being optional. A simple fix would be to detect if the ocg is going to contain a page break and split the environment, e.g.
\begin{ocg}{Name}{label}{0}
\lipsum[1-10]
\end{ocg}
would be detected and the output would resemble the result of e.g.
\begin{ocg}{Name}{label1}{0}
\lipsum[1-3]
\end{ocg}
\clearpage
\begin{ocg}{Name}{label2}{0}
\lipsum[4-10]
\end{ocg}
How can I achieve this? I tried wrapping in a mdframed with beforebreak and afterbreak hooks to break and restart the ocg environment but I don't think ocgs like being nested in other environments...
ocgs-ppackage is making things unneccessarily difficult here. From all I see, you should be able to use\ocgto start and\endocgto end an OCG, without nesting problems. – Stephan Lehmke Dec 02 '13 at 16:00ocgx2package. – AlexG Mar 04 '16 at 12:06