summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty')
-rw-r--r--Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty59
1 files changed, 44 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty b/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty
index a0b43e76df6..f305990370e 100644
--- a/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty
+++ b/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty
@@ -45,7 +45,7 @@
}
}
-\ProvidesExplPackage{fixocgx}{2015/01/23}{0.1}
+\ProvidesExplPackage{fixocgx}{2015/01/26}{0.2}
{ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
%re-implement ocg-p's `ocg' environment
@@ -54,14 +54,14 @@
\bool_gset_true:N\g_fxocg_nestedB_bool
\bool_gset_false:N\g_fxocg_nestedE_bool
\group_begin:
- \tl_if_exist:cTF{#3}{ %re-open existing layer
- \tl_set:Nx\l_tempa_tl{[ocgp]{ocg}{\use:c{#3.opts},#1}}
+ \tl_if_exist:cTF{fxocg@#3}{ %re-open existing layer
+ \tl_set:Nx\l_tempa_tl{[ocgp]{ocg}{\use:c{fxocg@#3.opts},#1}}
\exp_after:wN\setkeys\l_tempa_tl
\int_compare:nT{\@ocgp@listno=\c_zero}{
- \tl_gput_right:Nx\@ocgbase@ocgorder{~\use:c{#3}}
+ \tl_gput_right:Nx\@ocgbase@ocgorder{~\use:c{fxocg@#3}}
}
}{
- \tl_gset:cn{#3.opts}{#1}
+ \tl_gset:cn{fxocg@#3.opts}{#1}
\setkeys[ocgp]{ocg}{#1}
\mix_pdfobj:nnn{}{dict}{
/Type/OCG/Name~(#2)/Usage<<\@ocgp@print\@ocgp@export>>
@@ -70,14 +70,27 @@
\int_compare:nT{#4==\c_zero}{
\tl_gput_right:Nx\@ocgbase@offocgs{\space\g_mix_pdflastobj_tl}
}
- \tl_gset:cx{#3}{\g_mix_pdflastobj_tl}
- \tl_gset:cx{OCGpdfobj#3}{\g_mix_pdflastobj_tl}
+ \tl_gset:cx{fxocg@#3}{\g_mix_pdflastobj_tl}
\int_compare:nF{\@ocgp@listno=\c_one}{
\tl_gput_right:Nx\@ocgbase@ocgorder{~\g_mix_pdflastobj_tl}
}
+ \iow_now:Nx\@auxout{
+ \token_to_str:N\expandafter\xdef\token_to_str:N\csname
+ \space OCGpdfobj#3\endcsname{\g_mix_pdflastobj_tl}
+ }
}
- \group_end:
- \mix_pdfbdc:nn{/OC}{\use:c{#3}}
+ \bool_if:nT{
+ !\cs_if_exist_p:c{OCGpdfobj#3} ||
+ !\str_if_eq_x_p:nn{\use:c{OCGpdfobj#3}}{\use:c{fxocg@#3}}
+ }{
+ \cs_if_exist:NF\g_fxocg_rerunwarned_tl{
+ \tl_new:N\g_fxocg_rerunwarned_tl
+ \AtEndDocument{\msg_warning:nn{fixocgx}{rerun}}
+ }
+ }
+ \tl_gset:cx{OCGpdfobj#3}{\use:c{fxocg@#3}}
+ \group_end:
+ \mix_pdfbdc:nn{/OC}{\use:c{fxocg@#3}}
\ignorespaces
}{
\unskip
@@ -94,7 +107,7 @@
\tl_set:Nn\l_fxocg_ocglist_tl{}
\seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#1}
\seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{
- \tl_put_right:Nx\l_fxocg_ocglist_tl{~\use:c{OCGpdfobj\l_tempa_tl}}
+ \fxocg_process_ocgref:NN\l_fxocg_ocglist_tl\l_tempa_tl
}
\leavevmode
\mix_pdflink:nn{
@@ -108,7 +121,7 @@
\tl_set:Nn\l_fxocg_ocglist_tl{}
\seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#1}
\seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{
- \tl_put_right:Nx\l_fxocg_ocglist_tl{~\use:c{OCGpdfobj\l_tempa_tl}}
+ \fxocg_process_ocgref:NN\l_fxocg_ocglist_tl\l_tempa_tl
}
\leavevmode
\mix_pdflink:nn{
@@ -122,7 +135,7 @@
\tl_set:Nn\l_fxocg_ocglist_tl{}
\seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#1}
\seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{
- \tl_put_right:Nx\l_fxocg_ocglist_tl{~\use:c{OCGpdfobj\l_tempa_tl}}
+ \fxocg_process_ocgref:NN\l_fxocg_ocglist_tl\l_tempa_tl
}
\leavevmode
\mix_pdflink:nn{
@@ -136,17 +149,17 @@
\tl_set:Nn\l_fxocg_toswitch_tl{}
\seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#1}
\seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{
- \tl_put_right:Nx\l_fxocg_toswitch_tl{~\use:c{OCGpdfobj\l_tempa_tl}}
+ \fxocg_process_ocgref:NN\l_fxocg_toswitch_tl\l_tempa_tl
}
\tl_set:Nn\l_fxocg_toshow_tl{}
\seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#2}
\seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{
- \tl_put_right:Nx\l_fxocg_toshow_tl{~\use:c{OCGpdfobj\l_tempa_tl}}
+ \fxocg_process_ocgref:NN\l_fxocg_toshow_tl\l_tempa_tl
}
\tl_set:Nn\l_fxocg_tohide_tl{}
\seq_set_split:Nnn\l_fxocg_ocglistarg_seq{~}{#3}
\seq_map_variable:NNn\l_fxocg_ocglistarg_seq\l_tempa_tl{
- \tl_put_right:Nx\l_fxocg_tohide_tl{~\use:c{OCGpdfobj\l_tempa_tl}}
+ \fxocg_process_ocgref:NN\l_fxocg_tohide_tl\l_tempa_tl
}
\leavevmode
\mix_pdflink:nn{
@@ -161,6 +174,16 @@
}{#4}
}
+\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}}
+ }
+ }
+}
+
\group_begin:
\char_set_catcode_active:N\+\let+\space
\tl_gset:Nx\g_fxocg_gsoldwarning_tl{
@@ -189,3 +212,9 @@
}
\fi
}
+
+\msg_set:nnn{fixocgx}{rerun}{Rerun~to~get~OCG~references~right!}
+\msg_set:nnn{fixocgx}{undefined~OCG}{
+ Line~\msg_line_number: :~OCG~`#1'~is~not~defined.
+}
+\msg_set:nnn{fixocgx}{undefined~OCGs}{There~were~undefined~OCGs!}