In my ocgx package, I would use the new ocg-p package instead of the ocg package. With pdflatex or lualatex, all is good. But with xelatex, I obviously can't use \pdfstartlink and \pdfendlink (these primitives are provided by pdftex or luatex).
How to emulate these two primitives with xetex?
Here is an example of current code in my ocgx package:
\long\def\switchocg#1#2{%
\def\ocgx@list{}%
\ocgx@listOCG#1 ENDOFOCGS %
\leavevmode%
\pdfstartlink user {%
/Subtype /Link
/A << /S/SetOCGState /State [/Toggle \ocgx@list] >>
/Border [0 0 0]
}%
#2\pdfendlink%
}
\pdfstartlink user {...} ... \pdfstartlink user {...} ... \pdfendlink ... \pdfendlink? Doesn't seem to be relevant for @Paul's problem. What might this be good for? Do mouse events bubble through superimposed PDF annotations? – AlexG Dec 10 '12 at 12:07\pdfstartlinkand\pdfendlinkwith XeTeX.\pdfstartlinkcan be nested,\special{pdf:bann}cannot. – Heiko Oberdiek Dec 10 '12 at 12:45\switchocg{foo}{footext\switchocg{bar}{bartext}footext cont'd}, isn't really wanted by the OP. Maybe @Paul could comment on this. – AlexG Dec 11 '12 at 10:19