summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ocgx2
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-11-26 22:30:27 +0000
committerKarl Berry <karl@freefriends.org>2015-11-26 22:30:27 +0000
commit249e1802e166afcb824ea15688c6fff18f40ff80 (patch)
tree74011c9fe13fccc01e25e5329bf8561800270d57 /Master/texmf-dist/tex/latex/ocgx2
parente17b5de3039e7ff6bc1ff3f6a4335a58c3b2c444 (diff)
ocgx2 (26nov15)
git-svn-id: svn://tug.org/texlive/trunk@38952 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ocgx2')
-rw-r--r--Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty97
-rw-r--r--Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty43
2 files changed, 82 insertions, 58 deletions
diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty
index 445d42a2752..33794d6558d 100644
--- a/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty
+++ b/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty
@@ -2,7 +2,7 @@
%
% ocgbase.sty
%
-% low-level macros for OCG creation, /OC-marked content and
+% low-level macros for OCG creation, marking optional content and
% for managment of global (document-wide) OCG related lists;
%
% (automatic) OCG configuration in the PDF catalog
@@ -29,7 +29,7 @@
%
% Commands defined:
%
-% \ocgbase_new_ocg:xxx
+% \ocgbase_new_ocg:nnn
% \ocgbase@new@ocg (LaTeX2e version)
% #1: name (as shown in the Layers Tab of the Reader GUI)
% #2: usage dict (may be empty), see PDF reference:
@@ -40,7 +40,7 @@
% \ocgbase_last_ocg:
% \ocgbase@last@ocg (LaTeX2e version)
% inserts ID of PDF object created during most recent call of
-% \ocgbase_new_ocg:xxx
+% \ocgbase_new_ocg:nnn
%
% --------
%
@@ -55,11 +55,18 @@
% \ocgbase_add_to_off_list:n
% \ocgbase@add@to@off@list (LaTeX2e version)
% #1: PDF object ID of OCG
-% macro for belated setting of initial non-visibility of an OCG
+% macro for setting initial visibility to `off'
%
% --------
%
-% \ocgbase_add_ocg_to_radiobtn_grp:xxx
+% \ocgbase_del_from_off_list:n
+% \ocgbase@del@from@off@list (LaTeX2e version)
+% #1: PDF object ID of OCG
+% macro for setting initial visibility to `on'
+%
+% --------
+%
+% \ocgbase_add_ocg_to_radiobtn_grp:nnn
% \ocgbase@add@ocg@to@radiobtn@grp
% add OCG #2 (obj ref) to radio button group `#1' (string),
% #3: (0|1|false|true) list OCG as part of group `#1' in the Layers Tab)
@@ -70,11 +77,11 @@
% \ocgbase@oc@bdc
% #1: OCG obj ref
% mark begin of optional content belonging to OCG #1 in the current
-% content stream
+% content stream
%
% \ocgbase_oc_emc:
% \ocgbase@oc@emc
-% mark end of optional content in the current content stream
+% mark end of optional content in the current content stream
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -94,8 +101,8 @@
\RequirePackage{l3keys2e}
\RequirePackage{atenddvi}
-\def\g@ocgbase@date@tl{2015/11/23}
-\def\g@ocgbase@version@tl{0.3}
+\def\g@ocgbase@date@tl{2015/11/26}
+\def\g@ocgbase@version@tl{0.4}
\ProvidesExplPackage{ocgbase}{\g@ocgbase@date@tl}{\g@ocgbase@version@tl}
{support package for ocgx2.sty}
@@ -120,8 +127,8 @@
}
\tl_new:N\g_ocgbase_ocgs_tl %takes ocg object refs
-\tl_new:N\g_ocgbase_offocgs_tl
\seq_new:N\g_ocgbase_ocgorder_seq
+\seq_new:N\g_ocgbase_offocgs_seq
\AtEndDvi{
\tl_if_empty:NF\g_ocgbase_ocgs_tl{
@@ -130,8 +137,8 @@
\tl_set:Nx\l_ocgbase_ocgarray_tl{\pbs_pdflastobj:}
\tl_new:N\l_ocgbase_offocgentry_tl
%global OFF list
- \tl_if_empty:NF\g_ocgbase_offocgs_tl{
- \pbs_pdfobj:nnn{}{array}{\g_ocgbase_offocgs_tl}
+ \seq_if_empty:NF\g_ocgbase_offocgs_seq{
+ \pbs_pdfobj:nnn{}{array}{\seq_use:Nn\g_ocgbase_offocgs_seq{~}}
\tl_set:Nx\l_ocgbase_offocgentry_tl{/OFF~\pbs_pdflastobj:}
}
%global Order list
@@ -229,76 +236,84 @@
}
%macro for inserting new OCG object
-\cs_new:Nn\ocgbase_new_ocg:nnn{
+\cs_new_nopar:Nn\ocgbase_new_ocg:nnn{
\pbs_pdfobj:nnn{}{dict}{
/Type/OCG/Name~(#1)~\tl_if_blank:oF{#2}{/Usage<<#2>>}
}
\tl_gput_right:Nx\g_ocgbase_ocgs_tl{~\g_pbs_pdflastobj_tl}
\bool_if:nT{
- \str_if_eq_p:nn{#3}{\c_zero} ||
- \str_if_eq_p:nn{#3}{off} ||
- \str_if_eq_p:nn{#3}{false}
+ \str_if_eq_x_p:nn{#3}{\c_zero} ||
+ \str_if_eq_x_p:nn{#3}{off} ||
+ \str_if_eq_x_p:nn{#3}{false}
}{
- \tl_gput_right:Nx\g_ocgbase_offocgs_tl{~\g_pbs_pdflastobj_tl}
- \tl_new:c{off:\g_pbs_pdflastobj_tl}
+ \ocgbase_add_to_off_list:n{\g_pbs_pdflastobj_tl}
}
\tl_gset_eq:NN\g_ocgbase_last_ocg_tl\g_pbs_pdflastobj_tl
}
-\cs_generate_variant:Nn\ocgbase_new_ocg:nnn{xxx}
-\cs_new:Nn\ocgbase_last_ocg:{\g_ocgbase_last_ocg_tl}
+\cs_new_nopar:Nn\ocgbase_last_ocg:{\g_ocgbase_last_ocg_tl}
%macro for appending OCG object to global `Order' list
% in Layers Tab of the GUI
-\cs_new:Nn\ocgbase_add_to_order_list:n{
+\cs_new_nopar:Nn\ocgbase_add_to_order_list:n{
\seq_gput_right:Nx\g_ocgbase_ocgorder_seq{#1}
}
-%macro for belated appending an OCG object ref to the global `OFF' list
+%macro for appending an OCG object to the global `OFF' list
+%(initial non-visibility)
+\cs_new_nopar:Nn\ocgbase_add_to_off_list:n{
+ \seq_if_in:NxF\g_ocgbase_offocgs_seq{#1}{
+ \seq_gput_right:Nx\g_ocgbase_offocgs_seq{#1}
+ }
+}
+
+%macro for removing an OCG object from global `OFF' list
%(initial non-visibility)
-\cs_new:Nn\ocgbase_add_to_off_list:n{
- \tl_if_exist:cF{off:#1}{
- \tl_gput_right:Nx\g_ocgbase_offocgs_tl{~#1}\tl_new:c{off:#1}
+\cs_new_nopar:Nn\ocgbase_del_from_off_list:n{
+ \seq_if_in:NxT\g_ocgbase_offocgs_seq{#1}{
+ \ocgbase_seq_gremove_all:Nx\g_ocgbase_offocgs_seq{#1}
}
}
+\cs_set_eq:NN\ocgbase_seq_gremove_all:Nn\seq_gremove_all:Nn
+\cs_generate_variant:Nn\ocgbase_seq_gremove_all:Nn{Nx}
-\cs_new:Nn\ocgbase_add_ocg_to_radiobtn_grp:nnn{
+\cs_new_nopar:Nn\ocgbase_add_ocg_to_radiobtn_grp:nnn{
% #1: rbtn group name,
% #2: OCG obj ref,
% #3: visible in Layers Tab
- \seq_if_in:NnF\g_ocgbase_ocgorder_seq{#1}{
- \seq_gput_right:Nn\g_ocgbase_ocgorder_seq{#1}
+ \seq_if_in:NxF\g_ocgbase_ocgorder_seq{#1}{
+ \seq_gput_right:Nx\g_ocgbase_ocgorder_seq{#1}
\seq_new:c{g_ocgbase_#1_rbtn_order_seq}
\seq_new:c{g_ocgbase_#1_rbtn_groups_seq}
}
- \seq_if_in:cnTF{g_ocgbase_#1_rbtn_order_seq}{#2}{
+ \seq_if_in:cxTF{g_ocgbase_#1_rbtn_order_seq}{#2}{
\bool_if:nT{
- \str_if_eq_p:nn{#3}{\c_zero} ||
- \str_if_eq_p:nn{#3}{false}
+ \str_if_eq_x_p:nn{#3}{\c_zero} ||
+ \str_if_eq_x_p:nn{#3}{false}
}{
- \seq_gremove_all:cn{g_ocgbase_#1_rbtn_order_seq}{#2}
+ \ocgbase_seq_gremove_all:cx{g_ocgbase_#1_rbtn_order_seq}{#2}
}
}{
\bool_if:nF{
- \str_if_eq_p:nn{#3}{\c_zero} ||
- \str_if_eq_p:nn{#3}{false}
+ \str_if_eq_x_p:nn{#3}{\c_zero} ||
+ \str_if_eq_x_p:nn{#3}{false}
}{
- \seq_gput_right:cn{g_ocgbase_#1_rbtn_order_seq}{#2}
+ \seq_gput_right:cx{g_ocgbase_#1_rbtn_order_seq}{#2}
}
}
- \seq_gput_right:cn{g_ocgbase_#1_rbtn_groups_seq}{#2}
+ \seq_gput_right:cx{g_ocgbase_#1_rbtn_groups_seq}{#2}
}
-\cs_generate_variant:Nn\ocgbase_add_ocg_to_radiobtn_grp:nnn{xxx}
% OC-marked content
-\cs_new:Nn\ocgbase_oc_bdc:n{\pbs_pdfbdc:nn{/OC}{#1}}
-\cs_new:Nn\ocgbase_oc_emc:{\pbs_pdfemc:}
+\cs_new_nopar:Nn\ocgbase_oc_bdc:n{\pbs_pdfbdc:nn{/OC}{#1}}
+\cs_new_nopar:Nn\ocgbase_oc_emc:{\pbs_pdfemc:}
%l2e versions
-\cs_gset_eq:NN\ocgbase@new@ocg\ocgbase_new_ocg:xxx
+\cs_gset_eq:NN\ocgbase@new@ocg\ocgbase_new_ocg:nnn
\cs_gset_eq:NN\ocgbase@last@ocg\ocgbase_last_ocg:
\cs_gset_eq:NN\ocgbase@add@to@order@list\ocgbase_add_to_order_list:n
\cs_gset_eq:NN\ocgbase@add@to@off@list\ocgbase_add_to_off_list:n
-\cs_gset_eq:NN\ocgbase@add@ocg@to@radiobtn@grp\ocgbase_add_ocg_to_radiobtn_grp:xxx
+\cs_gset_eq:NN\ocgbase@del@from@off@list\ocgbase_del_from_off_list:n
+\cs_gset_eq:NN\ocgbase@add@ocg@to@radiobtn@grp\ocgbase_add_ocg_to_radiobtn_grp:nnn
\cs_gset_eq:NN\ocgbase@oc@bdc\ocgbase_oc_bdc:n
\cs_gset_eq:NN\ocgbase@oc@emc\ocgbase_oc_emc:
diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
index 946682d0332..2bf8d2273ba 100644
--- a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
+++ b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
@@ -38,7 +38,7 @@
\RequirePackage{l3keys2e}
\RequirePackage{afterpage}
-\ProvidesExplPackage{ocgx2}{2015/11/23}{0.11}
+\ProvidesExplPackage{ocgx2}{2015/11/26}{0.12}
{ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
%creating global definitions
@@ -135,14 +135,22 @@
}{
\bool_gset_false:N\g_ocgxii_nestedB_bool
}
+ \bool_if:nTF{ %initial visibility
+ \str_if_eq_p:nn{#4}{\c_one} ||
+ \str_if_eq_p:nn{#4}{on} ||
+ \str_if_eq_p:nn{#4}{true}
+ }{
+ \ocgbase_del_from_off_list:n{\tl_use:c{ocgxii@#3}}
+ }{
+ \ocgbase_add_to_off_list:n{\tl_use:c{ocgxii@#3}}
+ }
}{
\tl_gset:cn{ocgxii@#3.opts}{#1}
\keys_set:nn{ocgx2/user}{#1}
- \ocgbase_new_ocg:xxx{#2}{
+ \ocgbase_new_ocg:nnn{#2}{
\l_ocgxii_view_tl\l_ocgxii_print_tl\l_ocgxii_export_tl
}{#4}
\tl_gset:cx{ocgxii@#3}{\ocgbase_last_ocg:}
- \tl_gset:cn{ocgxii_#3_is_listed}{0}
\int_compare:nTF{\l_ocgxii_listno_tl=\c_one}{
\bool_gset_false:N\g_ocgxii_nestedB_bool
}{
@@ -153,7 +161,7 @@
}
}
\seq_map_inline:Nn\l_ocgxii_rbgrps_seq{% process list of radio btn groups
- \ocgbase_add_ocg_to_radiobtn_grp:xxx{##1}{\tl_use:c{ocgxii@#3}}{
+ \ocgbase_add_ocg_to_radiobtn_grp:nnn{##1}{\tl_use:c{ocgxii@#3}}{
\int_compare:nTF{\l_ocgxii_listno_tl=\c_one}{false}{true}
}
}
@@ -164,7 +172,7 @@
\c_false_bool
}
}{
- \cs_if_exist:NF\g_ocgxii_rerunwarned_tl{
+ \tl_if_exist:NF\g_ocgxii_rerunwarned_tl{
\tl_new:N\g_ocgxii_rerunwarned_tl
\AtEndDocument{\msg_warning:nn{ocgx2}{rerun}}
}
@@ -190,7 +198,7 @@
\bool_new:N\g_ocgxii_nestedB_bool % nested OCG begin
\bool_new:N\g_ocgxii_nestedE_bool % nested OCG end
-\cs_gset:Nn\ocgxii_ocgstack_shipout:N{
+\cs_new_nopar:Nn\ocgxii_ocgstack_shipout:N{
\iow_shipout_x:Nx\@mainaux{
\token_to_str:N\ocgxii@stack@on@page{
\exp_not:N\int_use:N\g_ocgxii_page_int
@@ -212,7 +220,7 @@
%end of page action in output routine
\cs_new_nopar:Nn\ocgxii_at_end_page:{
%check whether end-of-page ocg stack has settled
- \iow_now:Nx\@mainaux{
+ \iow_shipout:Nx\@mainaux{
\token_to_str:N\ocgxii@newkey{ocgx2.oldstack.\int_use:N\g_ocgxii_page_int}{
\seq_use:cn{g_pending_ocgs_on_\int_use:c{g_ocgxii_page_int}_seq}{,}
}
@@ -228,7 +236,7 @@
\c_false_bool
}
}{
- \cs_if_exist:NF\g_ocgxii_rerunwarned_tl{
+ \tl_if_exist:NF\g_ocgxii_rerunwarned_tl{
\tl_new:N\g_ocgxii_rerunwarned_tl
\AtEndDocument{\msg_warning:nn{ocgx2}{rerun}}
}
@@ -251,9 +259,9 @@
\seq_map_variable:NNn\l_ocgxii_temp_seq\l_ocgxii_arg_tl{
\ocgbase_oc_bdc:n{\l_ocgxii_arg_tl}
}
- % copy pending ocg stack to next page, if it has not been initialized yet
- % from aux file
\int_gincr:N\g_ocgxii_page_int
+ % copy pending ocg stack from previous page, if it has not been initialized
+ % yet from aux file
\seq_if_exist:cF{g_pending_ocgs_on_\int_use:c{g_ocgxii_page_int}_seq}{
\seq_gset_eq:cc{
g_pending_ocgs_on_\int_use:c{g_ocgxii_page_int}_seq
@@ -280,20 +288,20 @@
%macro that inserts /OC <<OCMD with currently open OCGs>> entry;
%for use within annotation dicts
-\tl_set:Nn\ocgxii@insert@OC{
+\cs_new_nopar:Npn\ocgxii@insert@OC{
\seq_if_empty:NF\g_ocgxii_ocgstack_seq{
/OC~<</Type/OCMD/OCGs~[\seq_use:Nn\g_ocgxii_ocgstack_seq{~}]/P/AllOn>>
}
}
-\cs_set:Nn\ocgxii_ocglist_reset:{
+\cs_new_nopar:Nn\ocgxii_ocglist_reset:{
\tl_clear_new:N\l_ocgxii_u_list_tl
\tl_clear_new:N\l_ocgxii_d_list_tl
\tl_clear_new:N\l_ocgxii_e_list_tl
\tl_clear_new:N\l_ocgxii_x_list_tl
}
-\cs_set:Nn\ocgxii_ocglist_build:Nn{
+\cs_new_nopar:Nn\ocgxii_ocglist_build:Nn{
\tl_set:Nx\l_ocglistarg_tl{#2}\tl_trim_spaces:N\l_ocglistarg_tl
\seq_set_split:NnV\l_ocgxii_ocglistarg_seq{~}\l_ocglistarg_tl
\seq_map_variable:NNn\l_ocgxii_ocglistarg_seq\l_tempa_tl{
@@ -309,7 +317,7 @@
\ocgxii_ocglist_build:Nn\l_ocgxii_u_list_tl{\seq_item:Nn\l_tmpa_seq{4}}
}
-\cs_set:Nn\ocgxii_ocglist_process_idlist:nn{
+\cs_new_nopar:Nn\ocgxii_ocglist_process_idlist:nn{
\ocgxii_ocglist_reset:
\tl_set:Nx\l_ocgxii_opt_tl{#1}\tl_remove_all:Nn\l_ocgxii_opt_tl{~}
\str_case_x:nnF{\l_ocgxii_opt_tl}{
@@ -335,7 +343,8 @@
\int_new:N\g_ocgxii_widcount_int% widget counter
-%re-implement commands from ocg-p.sty / ocgx.sty (all engines including ps2pdf [gs>=9.15])
+%re-implement commands from ocg-p.sty / ocgx.sty (all engines including
+%ps2pdf [gs>=9.15])
\DeclareDocumentCommand\switchocg{o m +m}{
\leavevmode
\IfNoValueTF{#1}{
@@ -558,7 +567,7 @@
\str_if_eq_x:nnF{#2}{}{
\tl_if_exist:cTF{ocgx2.ocg.#2}{\tl_put_right:Nx#1{~\tl_use:c{ocgx2.ocg.#2}}}{
\msg_warning:nnx{ocgx2}{undefined~OCG}{#2}
- \cs_if_exist:NF\g_ocgxii_refundefwarned_tl{
+ \tl_if_exist:NF\g_ocgxii_refundefwarned_tl{
\tl_new:N\g_ocgxii_refundefwarned_tl
\AtEndDocument{\msg_warning:nn{ocgx2}{undefined~OCGs}}
}
@@ -627,7 +636,7 @@
}
% dvipdfmx and xelatex workaround for ocg buttons within `tikzpicture' context
-\cs_set:Nn\ocgxii_pdflink:nn{
+\cs_new:Nn\ocgxii_pdflink:nn{
\bool_if:nTF{
\g_ocgxii_dvipdfmx_bool && \cs_if_exist_p:N\pgfpictureid
}{