diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-07 22:42:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-07 22:42:51 +0000 |
commit | 5242a77f951726f37e97cc73e0109bc8d18f617e (patch) | |
tree | c871da59f739fee3c21ed9b6daf61d86c2c19f32 /Master | |
parent | 5a673be1e4c328c044a8bd4f2fe3ca81ed571a34 (diff) |
ocgx2 (7mar17)
git-svn-id: svn://tug.org/texlive/trunk@43425 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/ocgx2/ChangeLog | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/ocgx2/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty | 261 |
3 files changed, 178 insertions, 89 deletions
diff --git a/Master/texmf-dist/doc/latex/ocgx2/ChangeLog b/Master/texmf-dist/doc/latex/ocgx2/ChangeLog index 8f0667e372e..9b9338e40ac 100644 --- a/Master/texmf-dist/doc/latex/ocgx2/ChangeLog +++ b/Master/texmf-dist/doc/latex/ocgx2/ChangeLog @@ -1,3 +1,7 @@ +2017-03-07 + * v0.18 : ocgx2.sty + * fix: workaround for A-Reader bug when placing OCG switches on OCGs + 2016-03-22 * v0.17 : ocgx2.sty * new: option `ocgcolorlinks', enables OCG colour links for hyperref package diff --git a/Master/texmf-dist/doc/latex/ocgx2/README b/Master/texmf-dist/doc/latex/ocgx2/README index 66b3c041ebc..f8e57ece789 100644 --- a/Master/texmf-dist/doc/latex/ocgx2/README +++ b/Master/texmf-dist/doc/latex/ocgx2/README @@ -1,7 +1,7 @@ ================================== The `ocgx2' LaTeX Package - Version 0.17 [2016/03/22] + Version 0.18 [2017/03/07] (C) 2015--\today Alexander Grahn ================================== diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty index acb40f60174..36db66b8cfd 100644 --- a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty +++ b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty @@ -37,7 +37,7 @@ \RequirePackage{xparse} \RequirePackage{l3keys2e} -\ProvidesExplPackage{ocgx2}{2016/03/22}{0.17} +\ProvidesExplPackage{ocgx2}{2017/03/07}{0.18} {ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx} %creating global definitions @@ -375,19 +375,35 @@ %re-implement commands from ocg-p.sty / ocgx.sty (all engines including %ps2pdf [gs>=9.15]) -\DeclareDocumentCommand\switchocg{o m +m}{ +\DeclareDocumentCommand\switchocg{s o m +m}{ \leavevmode - \IfNoValueTF{#1}{ - \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#2} - \ocgxii_pdflink:nn{ - /Subtype/Link\ocgxii@insert@OC - /A <</S/SetOCGState/State [ - \str_if_eq:VnF\l_ocgxii_u_list_tl{}{/Toggle~\l_ocgxii_u_list_tl}]>> - /Border [0~0~0] - }{#3} + \bool_if:nTF{ + \IfBooleanTF{#1}{\c_true_bool}{\c_false_bool} || + \IfValueTF{#2}{\c_true_bool}{\c_false_bool} }{ - \ocgxii_ocglist_process_idlist:nn{#1}{#2} - \ocgxii_pdflink:nn{ + % implemented as Widget annot (non-breakable) + \ocgxii_ocglist_process_idlist:nn{ + \IfValueTF{#2}{#2}{triggerocg=onmouseup} + }{#3} + \hbox_set:Nn\l_tmpa_box{#4} + %dummy Widget, workaround for AR bug; + %see https://forums.adobe.com/message/5787612#5787612 + \bool_if:nT{ + !\cs_if_exist:NTF\ocgxii@insert@OC{ + \tl_if_blank_p:V\ocgxii@insert@OC + }{ + \c_true_bool + } + }{\pbs_pdfannot:nnnn{ + \dim_use:N\box_wd:N\l_tmpa_box}{ + \dim_use:N\box_ht:N\l_tmpa_box}{ + \dim_use:N\box_dp:N\l_tmpa_box + }{/Subtype/Widget/F~2}} + \pbs_pdfannot:nnnn{ + \dim_use:N\box_wd:N\l_tmpa_box}{ + \dim_use:N\box_ht:N\l_tmpa_box}{ + \dim_use:N\box_dp:N\l_tmpa_box + }{ /Subtype/Widget/Ff~65536/FT/Btn/H/I /T~(ocgx2@\int_use:N\g_ocgxii_widcount_int) \ocgxii@insert@OC @@ -405,25 +421,49 @@ /X <</S/SetOCGState/State [/Toggle~\l_ocgxii_x_list_tl]>> } >> - }{\mbox{#3}} %Widget annots should not be broken across lines + }\box_use_clear:N\l_tmpa_box \pbs_appendtofields:n{\pbs_pdflastann:} \int_gincr:N\g_ocgxii_widcount_int + }{ + \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#3} + \pbs_pdflink:nn{ + /Subtype/Link + /A <</S/SetOCGState/State [ + \str_if_eq:VnF\l_ocgxii_u_list_tl{}{/Toggle~\l_ocgxii_u_list_tl}]>> + /Border [0~0~0] + }{#4} } } -\DeclareDocumentCommand\showocg{o m +m}{ +\DeclareDocumentCommand\showocg{s o m +m}{ \leavevmode - \IfNoValueTF{#1}{ - \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#2} - \ocgxii_pdflink:nn{ - /Subtype/Link\ocgxii@insert@OC - /A <</S/SetOCGState/State [ - \str_if_eq:VnF\l_ocgxii_u_list_tl{}{/ON~\l_ocgxii_u_list_tl}]>> - /Border [0~0~0] - }{#3} + \bool_if:nTF{ + \IfBooleanTF{#1}{\c_true_bool}{\c_false_bool} || + \IfValueTF{#2}{\c_true_bool}{\c_false_bool} }{ - \ocgxii_ocglist_process_idlist:nn{#1}{#2} - \ocgxii_pdflink:nn{ + % implemented as Widget annot (non-breakable) + \ocgxii_ocglist_process_idlist:nn{ + \IfValueTF{#2}{#2}{triggerocg=onmouseup} + }{#3} + \hbox_set:Nn\l_tmpa_box{#4} + %dummy Widget, workaround for AR bug; + %see https://forums.adobe.com/message/5787612#5787612 + \bool_if:nT{ + !\cs_if_exist:NTF\ocgxii@insert@OC{ + \tl_if_blank_p:V\ocgxii@insert@OC + }{ + \c_true_bool + } + }{\pbs_pdfannot:nnnn{ + \dim_use:N\box_wd:N\l_tmpa_box}{ + \dim_use:N\box_ht:N\l_tmpa_box}{ + \dim_use:N\box_dp:N\l_tmpa_box + }{/Subtype/Widget/F~2}} + \pbs_pdfannot:nnnn{ + \dim_use:N\box_wd:N\l_tmpa_box}{ + \dim_use:N\box_ht:N\l_tmpa_box}{ + \dim_use:N\box_dp:N\l_tmpa_box + }{ /Subtype/Widget/Ff~65536/FT/Btn/H/I /T~(ocgx2@\int_use:N\g_ocgxii_widcount_int) \ocgxii@insert@OC @@ -441,25 +481,49 @@ /X <</S/SetOCGState/State [/ON~\l_ocgxii_x_list_tl]>> } >> - }{\mbox{#3}} %Widget annots should not be broken across lines + }\box_use_clear:N\l_tmpa_box \pbs_appendtofields:n{\pbs_pdflastann:} \int_gincr:N\g_ocgxii_widcount_int + }{ + \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#3} + \pbs_pdflink:nn{ + /Subtype/Link + /A <</S/SetOCGState/State [ + \str_if_eq:VnF\l_ocgxii_u_list_tl{}{/ON~\l_ocgxii_u_list_tl}]>> + /Border [0~0~0] + }{#4} } } -\DeclareDocumentCommand\hideocg{o m +m}{ +\DeclareDocumentCommand\hideocg{s o m +m}{ \leavevmode - \IfNoValueTF{#1}{ - \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#2} - \ocgxii_pdflink:nn{ - /Subtype/Link\ocgxii@insert@OC - /A <</S/SetOCGState/State [ - \str_if_eq:VnF\l_ocgxii_u_list_tl{}{/OFF~\l_ocgxii_u_list_tl}]>> - /Border [0~0~0] - }{#3} + \bool_if:nTF{ + \IfBooleanTF{#1}{\c_true_bool}{\c_false_bool} || + \IfValueTF{#2}{\c_true_bool}{\c_false_bool} }{ - \ocgxii_ocglist_process_idlist:nn{#1}{#2} - \ocgxii_pdflink:nn{ + % implemented as Widget annot (non-breakable) + \ocgxii_ocglist_process_idlist:nn{ + \IfValueTF{#2}{#2}{triggerocg=onmouseup} + }{#3} + \hbox_set:Nn\l_tmpa_box{#4} + %dummy Widget, workaround for AR bug; + %see https://forums.adobe.com/message/5787612#5787612 + \bool_if:nT{ + !\cs_if_exist:NTF\ocgxii@insert@OC{ + \tl_if_blank_p:V\ocgxii@insert@OC + }{ + \c_true_bool + } + }{\pbs_pdfannot:nnnn{ + \dim_use:N\box_wd:N\l_tmpa_box}{ + \dim_use:N\box_ht:N\l_tmpa_box}{ + \dim_use:N\box_dp:N\l_tmpa_box + }{/Subtype/Widget/F~2}} + \pbs_pdfannot:nnnn{ + \dim_use:N\box_wd:N\l_tmpa_box}{ + \dim_use:N\box_ht:N\l_tmpa_box}{ + \dim_use:N\box_dp:N\l_tmpa_box + }{ /Subtype/Widget/Ff~65536/FT/Btn/H/I /T~(ocgx2@\int_use:N\g_ocgxii_widcount_int) \ocgxii@insert@OC @@ -477,50 +541,67 @@ /X <</S/SetOCGState/State [/OFF~\l_ocgxii_x_list_tl]>> } >> - }{\mbox{#3}} %Widget annots should not be broken across lines + }\box_use_clear:N\l_tmpa_box \pbs_appendtofields:n{\pbs_pdflastann:} \int_gincr:N\g_ocgxii_widcount_int + }{ + \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#3} + \pbs_pdflink:nn{ + /Subtype/Link + /A <</S/SetOCGState/State [ + \str_if_eq:VnF\l_ocgxii_u_list_tl{}{/OFF~\l_ocgxii_u_list_tl}]>> + /Border [0~0~0] + }{#4} } } -\DeclareDocumentCommand\actionsocg{o m m m +m}{ +\DeclareDocumentCommand\actionsocg{s o m m m +m}{ \leavevmode - \IfNoValueTF{#1}{ - \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#2} - \tl_set_eq:NN\l_ocgxii_toswitch_u_tl\l_ocgxii_u_list_tl - \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#3} - \tl_set_eq:NN\l_ocgxii_toshow_u_tl\l_ocgxii_u_list_tl - \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#4} - \tl_set_eq:NN\l_ocgxii_tohide_u_tl\l_ocgxii_u_list_tl - \ocgxii_pdflink:nn{ - /Subtype/Link\ocgxii@insert@OC - /A <</S/SetOCGState - /State [ - \str_if_eq:VnF{\l_ocgxii_toswitch_u_tl}{}{ - /Toggle~\l_ocgxii_toswitch_u_tl}~ - \str_if_eq:VnF{\l_ocgxii_toshow_u_tl}{}{/ON~\l_ocgxii_toshow_u_tl}~ - \str_if_eq:VnF{\l_ocgxii_tohide_u_tl}{}{/OFF~\l_ocgxii_tohide_u_tl} - ] - >> - /Border [0~0~0] - }{#5} + \bool_if:nTF{ + \IfBooleanTF{#1}{\c_true_bool}{\c_false_bool} || + \IfValueTF{#2}{\c_true_bool}{\c_false_bool} }{ - \ocgxii_ocglist_process_idlist:nn{#1}{#2} + % implemented as Widget annot (non-breakable) + \ocgxii_ocglist_process_idlist:nn{ + \IfValueTF{#2}{#2}{triggerocg=onmouseup} + }{#3} \tl_set_eq:NN\l_ocgxii_toswitch_e_tl\l_ocgxii_e_list_tl \tl_set_eq:NN\l_ocgxii_toswitch_x_tl\l_ocgxii_x_list_tl \tl_set_eq:NN\l_ocgxii_toswitch_d_tl\l_ocgxii_d_list_tl \tl_set_eq:NN\l_ocgxii_toswitch_u_tl\l_ocgxii_u_list_tl - \ocgxii_ocglist_process_idlist:nn{#1}{#3} + \ocgxii_ocglist_process_idlist:nn{ + \IfValueTF{#2}{#2}{triggerocg=onmouseup} + }{#4} \tl_set_eq:NN\l_ocgxii_toshow_e_tl\l_ocgxii_e_list_tl \tl_set_eq:NN\l_ocgxii_toshow_x_tl\l_ocgxii_x_list_tl \tl_set_eq:NN\l_ocgxii_toshow_d_tl\l_ocgxii_d_list_tl \tl_set_eq:NN\l_ocgxii_toshow_u_tl\l_ocgxii_u_list_tl - \ocgxii_ocglist_process_idlist:nn{#1}{#4} + \ocgxii_ocglist_process_idlist:nn{ + \IfValueTF{#2}{#2}{triggerocg=onmouseup} + }{#5} \tl_set_eq:NN\l_ocgxii_tohide_e_tl\l_ocgxii_e_list_tl \tl_set_eq:NN\l_ocgxii_tohide_x_tl\l_ocgxii_x_list_tl \tl_set_eq:NN\l_ocgxii_tohide_d_tl\l_ocgxii_d_list_tl \tl_set_eq:NN\l_ocgxii_tohide_u_tl\l_ocgxii_u_list_tl - \ocgxii_pdflink:nn{ + \hbox_set:Nn\l_tmpa_box{#6} + %dummy Widget, workaround for AR bug; + %see https://forums.adobe.com/message/5787612#5787612 + \bool_if:nT{ + !\cs_if_exist:NTF\ocgxii@insert@OC{ + \tl_if_blank_p:V\ocgxii@insert@OC + }{ + \c_true_bool + } + }{\pbs_pdfannot:nnnn{ + \dim_use:N\box_wd:N\l_tmpa_box}{ + \dim_use:N\box_ht:N\l_tmpa_box}{ + \dim_use:N\box_dp:N\l_tmpa_box + }{/Subtype/Widget/F~2}} + \pbs_pdfannot:nnnn{ + \dim_use:N\box_wd:N\l_tmpa_box}{ + \dim_use:N\box_ht:N\l_tmpa_box}{ + \dim_use:N\box_dp:N\l_tmpa_box + }{ /Subtype/Widget/Ff~65536/FT/Btn/H/I /T~(ocgx2@\int_use:N\g_ocgxii_widcount_int) \ocgxii@insert@OC @@ -586,17 +667,36 @@ ]>> } >> - }{\mbox{#5}} %Widget annots should not be broken across lines + }\box_use_clear:N\l_tmpa_box \pbs_appendtofields:n{\pbs_pdflastann:} \int_gincr:N\g_ocgxii_widcount_int + }{ + \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#3} + \tl_set_eq:NN\l_ocgxii_toswitch_u_tl\l_ocgxii_u_list_tl + \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#4} + \tl_set_eq:NN\l_ocgxii_toshow_u_tl\l_ocgxii_u_list_tl + \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#5} + \tl_set_eq:NN\l_ocgxii_tohide_u_tl\l_ocgxii_u_list_tl + \pbs_pdflink:nn{ + /Subtype/Link + /A <</S/SetOCGState + /State [ + \str_if_eq:VnF{\l_ocgxii_toswitch_u_tl}{}{ + /Toggle~\l_ocgxii_toswitch_u_tl}~ + \str_if_eq:VnF{\l_ocgxii_toshow_u_tl}{}{/ON~\l_ocgxii_toshow_u_tl}~ + \str_if_eq:VnF{\l_ocgxii_tohide_u_tl}{}{/OFF~\l_ocgxii_tohide_u_tl} + ] + >> + /Border [0~0~0] + }{#6} } } % mimic commands from ocg-p -\let\toggleocgs\switchocg -\let\showocgs\showocg -\let\hideocgs\hideocg -\let\setocgs\actionsocg +\def\toggleocgs{\switchocg*} +\def\showocgs{\showocg*} +\def\hideocgs{\hideocg*} +\def\setocgs{\actionsocg*} \cs_new:Nn\ocgxii_process_ocgref:NN{ \str_if_eq_x:nnF{#2}{}{ @@ -672,23 +772,6 @@ Line~\msg_line_number: :~unknown~option~`#1'. } -% dvipdfmx and xelatex workaround for ocg buttons within `tikzpicture' context -\cs_new:Nn\ocgxii_pdflink:nn{ - \bool_if:nTF{ - \g_ocgxii_dvipdfmx_bool && \cs_if_exist_p:N\pgfpictureid - }{ - \hbox_set:Nn\l_tmpa_box{#2} - \pbs_pdfannot:nnnn{ - \dim_use:N\box_wd:N\l_tmpa_box}{ - \dim_use:N\box_ht:N\l_tmpa_box}{ - \dim_use:N\box_dp:N\l_tmpa_box - }{#1} - \box_use_clear:N\l_tmpa_box - }{ - \pbs_pdflink:nn{#1}{#2} - } -} - \cs_gset_eq:NN\ocgxii_atenddvi_checkimpl_orig:\AtEndDvi@CheckImpl% \def\AtEndDvi@CheckImpl{ \ocgxii_atenddvi_checkimpl_orig: @@ -780,7 +863,9 @@ % ref ref/.style={ /tikz/execute at begin scope={% - \begin{ocg}[\ocgxii@opts]{\ocgxii@name}{#1}{\ocgxii@visibility}}, + \begin{ocg}[\ocgxii@opts]{% + \ifx\empty\ocgxii@name\empty#1\else\ocgxii@name\fi% + }{#1}{\ocgxii@visibility}}, /tikz/execute at end scope={\end{ocg}}, }, }, @@ -794,7 +879,7 @@ in (path picture bounding box.center) node[inner sep=0pt,anchor=center,outer sep=0pt] - {\switchocg{#1}{\phantom{\rule{\x3}{\y3}}}}; + {\switchocg*{#1}{\phantom{\rule{\x3}{\y3}}}}; } }, }, @@ -842,7 +927,7 @@ in (path picture bounding box.center) node[inner sep=0pt,anchor=center] - {\showocg{#1}{\phantom{\rule{\x3}{\y3}}}}; + {\showocg*{#1}{\phantom{\rule{\x3}{\y3}}}}; }, }, }, @@ -856,7 +941,7 @@ in (path picture bounding box.center) node[inner sep=0pt,anchor=center] - {\hideocg{#1}{\phantom{\rule{\x3}{\y3}}}}; + {\hideocg*{#1}{\phantom{\rule{\x3}{\y3}}}}; }, }, }, @@ -870,7 +955,7 @@ in (path picture bounding box.center) node[inner sep=0pt,anchor=center] - {\actionsocg{#1}{#2}{#3}{\phantom{\rule{\x3}{\y3}}}}; + {\actionsocg*{#1}{#2}{#3}{\phantom{\rule{\x3}{\y3}}}}; }, }, }, |