diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty b/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty index b3db3ee36e0..b40059ee689 100644 --- a/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty +++ b/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty @@ -52,7 +52,7 @@ } } -\ProvidesExplPackage{fixocgx}{2015/03/16}{0.4} +\ProvidesExplPackage{fixocgx}{2015/06/15}{0.5} {ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx} %re-implement ocg-p's `ocg' environment @@ -140,71 +140,81 @@ } %re-implement commands from ocgx.sty (all engines including ps2pdf [gs>=9.15]) -\long\def\switchocg#1#2{ +\DeclareDocumentCommand\switchocg{mm}{ \tl_set:Nn\l_fxocg_ocglist_tl{} - \seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#1} + \tl_set:Nx\l_ocglistarg_tl{#1}\tl_trim_spaces:N\l_ocglistarg_tl + \seq_set_split:NnV\l_fxocg_ocglistarg_seq{~}\l_ocglistarg_tl \seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{ \fxocg_process_ocgref:NN\l_fxocg_ocglist_tl\l_tempa_tl } \leavevmode \fxocg_pdflink:nn{ - /Subtype/Link - /A <</S/SetOCGState /State [/Toggle~\l_fxocg_ocglist_tl]>> + /Subtype/Link\fxocg@insert@OC + /A <</S/SetOCGState/State [ + \str_if_eq:VnF{\l_fxocg_ocglist_tl}{}{/Toggle~\l_fxocg_ocglist_tl}]>> /Border [0~0~0] }{#2} } -\long\def\showocg#1#2{ +\DeclareDocumentCommand\showocg{mm}{ \tl_set:Nn\l_fxocg_ocglist_tl{} - \seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#1} + \tl_set:Nx\l_ocglistarg_tl{#1}\tl_trim_spaces:N\l_ocglistarg_tl + \seq_set_split:NnV\l_fxocg_ocglistarg_seq{~}\l_ocglistarg_tl \seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{ \fxocg_process_ocgref:NN\l_fxocg_ocglist_tl\l_tempa_tl } \leavevmode \fxocg_pdflink:nn{ - /Subtype/Link - /A <</S/SetOCGState/State [/ON~\l_fxocg_ocglist_tl]>> + /Subtype/Link\fxocg@insert@OC + /A <</S/SetOCGState/State [ + \str_if_eq:VnF{\l_fxocg_ocglist_tl}{}{/ON~\l_fxocg_ocglist_tl}]>> /Border [0~0~0] }{#2} } -\long\def\hideocg#1#2{ +\DeclareDocumentCommand\hideocg{mm}{ \tl_set:Nn\l_fxocg_ocglist_tl{} - \seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#1} + \tl_set:Nx\l_ocglistarg_tl{#1}\tl_trim_spaces:N\l_ocglistarg_tl + \seq_set_split:NnV\l_fxocg_ocglistarg_seq{~}\l_ocglistarg_tl \seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{ \fxocg_process_ocgref:NN\l_fxocg_ocglist_tl\l_tempa_tl } \leavevmode \fxocg_pdflink:nn{ - /Subtype/Link - /A <</S/SetOCGState/State [/OFF~\l_fxocg_ocglist_tl]>> + /Subtype/Link\fxocg@insert@OC + /A <</S/SetOCGState/State [ + \str_if_eq:VnF{\l_fxocg_ocglist_tl}{}{/OFF~\l_fxocg_ocglist_tl}]>> /Border [0~0~0] }{#2} } -\long\def\actionsocg#1#2#3#4{ +\DeclareDocumentCommand\actionsocg{mmmm}{ + \tl_set:Nx\l_ocglistarg_tl{#1}\tl_trim_spaces:N\l_ocglistarg_tl \tl_set:Nn\l_fxocg_toswitch_tl{} - \seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#1} + \seq_set_split:NnV\l_fxocg_ocglistarg_seq{~}\l_ocglistarg_tl \seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{ \fxocg_process_ocgref:NN\l_fxocg_toswitch_tl\l_tempa_tl } + \tl_set:Nx\l_ocglistarg_tl{#2}\tl_trim_spaces:N\l_ocglistarg_tl \tl_set:Nn\l_fxocg_toshow_tl{} - \seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#2} + \seq_set_split:NnV\l_fxocg_ocglistarg_seq{~}\l_ocglistarg_tl \seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{ \fxocg_process_ocgref:NN\l_fxocg_toshow_tl\l_tempa_tl } + \tl_set:Nx\l_ocglistarg_tl{#3}\tl_trim_spaces:N\l_ocglistarg_tl \tl_set:Nn\l_fxocg_tohide_tl{} - \seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#3} + \seq_set_split:NnV\l_fxocg_ocglistarg_seq{~}\l_ocglistarg_tl \seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{ \fxocg_process_ocgref:NN\l_fxocg_tohide_tl\l_tempa_tl } \leavevmode \fxocg_pdflink:nn{ - /Subtype/Link + /Subtype/Link\fxocg@insert@OC /A <</S/SetOCGState /State [ - /Toggle~\l_fxocg_toswitch_tl~/ON~\l_fxocg_toshow_tl - /OFF~\l_fxocg_tohide_tl + \str_if_eq:VnF{\l_fxocg_toswitch_tl}{}{/Toggle~\l_fxocg_toswitch_tl}~ + \str_if_eq:VnF{\l_fxocg_toshow_tl}{}{/ON~\l_fxocg_toshow_tl}~ + \str_if_eq:VnF{\l_fxocg_tohide_tl}{}{/OFF~\l_fxocg_tohide_tl} ] >> /Border [0~0~0] @@ -212,11 +222,13 @@ } \cs_new:Nn\fxocg_process_ocgref:NN{ - \tl_if_exist:cTF{OCGpdfobj#2}{\tl_put_right:Nx#1{~\use:c{OCGpdfobj#2}}}{ - \msg_warning:nnx{fixocgx}{undefined~OCG}{#2} - \cs_if_exist:NF\g_fxocg_refundefwarned_tl{ - \tl_new:N\g_fxocg_refundefwarned_tl - \AtEndDocument{\msg_warning:nn{fixocgx}{undefined~OCGs}} + \str_if_eq_x:nnF{#2}{}{ + \tl_if_exist:cTF{OCGpdfobj#2}{\tl_put_right:Nx#1{~\use:c{OCGpdfobj#2}}}{ + \msg_warning:nnx{fixocgx}{undefined~OCG}{#2} + \cs_if_exist:NF\g_fxocg_refundefwarned_tl{ + \tl_new:N\g_fxocg_refundefwarned_tl + \AtEndDocument{\msg_warning:nn{fixocgx}{undefined~OCGs}} + } } } } |