diff options
author | Karl Berry <karl@freefriends.org> | 2015-01-26 23:09:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-01-26 23:09:48 +0000 |
commit | b65cb372f41e2b342614a723f88757e2303267b3 (patch) | |
tree | 159a3ea555bc8e0ca320b47867e0984580e0c1ec /Master | |
parent | f0fbd4733f94a565e1410adc862480a14277fc7d (diff) |
fixocgx (26jan15)
git-svn-id: svn://tug.org/texlive/trunk@36149 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/fixocgx/ChangeLog | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fixocgx/README | 8 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty | 59 |
3 files changed, 56 insertions, 18 deletions
diff --git a/Master/texmf-dist/doc/latex/fixocgx/ChangeLog b/Master/texmf-dist/doc/latex/fixocgx/ChangeLog new file mode 100644 index 00000000000..309d0ed3b3b --- /dev/null +++ b/Master/texmf-dist/doc/latex/fixocgx/ChangeLog @@ -0,0 +1,7 @@ +2015-01-26 + * v0.2 + * Fix: It was not possible to reference an OCG before defining it. + +2015-01-23 + * v0.1 + * New: initial release diff --git a/Master/texmf-dist/doc/latex/fixocgx/README b/Master/texmf-dist/doc/latex/fixocgx/README index 9b618c3b652..f1cf698d995 100644 --- a/Master/texmf-dist/doc/latex/fixocgx/README +++ b/Master/texmf-dist/doc/latex/fixocgx/README @@ -1,7 +1,7 @@ ================================== The `fixocgx' LaTeX Package - Version 0.1 [2015/01/23] + Version 0.2 [2015/01/26] (C) 2015--\today Alexander Grahn ================================== @@ -28,13 +28,15 @@ For details about the usage, read the `ocgx' package manual. The `ocg' environment is documented in the `ocg-p' package manual. No attempt was made to fix the remaining commands from the `ocg-p' package -as these are substituted by the commands from `ocgx'. +as these are mostly substituted by the commands from `ocgx'. * * * -This material is subject to the LaTeX Project Public License. See +This material is subject to the LaTeX Project Public License version 1.3. + +See http://mirrors.ctan.org/help/Catalogue/licenses.lppl.html 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!} |