summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ocgx2
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-04-02 03:01:41 +0000
committerNorbert Preining <norbert@preining.info>2022-04-02 03:01:41 +0000
commit0a334de875944625912f2bf2d918122bb55c0dad (patch)
tree7a13a8f48bf68f95926e9ff2b70eb9048562b2ed /macros/latex/contrib/ocgx2
parent18e3709c9fe9554f72b8fa347bd27ae4b76b841e (diff)
CTAN sync 202204020301
Diffstat (limited to 'macros/latex/contrib/ocgx2')
-rw-r--r--macros/latex/contrib/ocgx2/ChangeLog12
-rw-r--r--macros/latex/contrib/ocgx2/ocgbase.sty22
-rw-r--r--macros/latex/contrib/ocgx2/ocgx2.sty82
3 files changed, 84 insertions, 32 deletions
diff --git a/macros/latex/contrib/ocgx2/ChangeLog b/macros/latex/contrib/ocgx2/ChangeLog
index 0597209e2f..2c6de07b3f 100644
--- a/macros/latex/contrib/ocgx2/ChangeLog
+++ b/macros/latex/contrib/ocgx2/ChangeLog
@@ -1,3 +1,9 @@
+2022-04-01
+ * v0.54: ocgx2.sty
+ * v0.21: ocgbase.sty
+ * new: expanding ocmd env arguments
+ * fix: a few internal macros \protected
+
2021-06-16
* v0.53: ocgx2.sty
* fix: tikz option breaks package loading
@@ -20,7 +26,7 @@
* v0.49: ocgx2.sty
* fix: `ocgcolorlinks': fixing misplaced page content resulting from
\pdfliteral{} inserted by others (such as TikZ)
-
+
2019-11-07
* v0.48: ocgx2.sty
* fix: link-making commands failed with empty option arg
@@ -37,7 +43,7 @@
2019-09-19
* v0.45: ocgx2.sty
* new: using comma for separating OCG ids in \showocg, \hideocg etc.; <space>
- still accepted for compatibility with ocgx/ocg-p
+ still accepted for compatibility with ocgx/ocg-p
2019-09-17
* v0.44: ocgx2.sty
@@ -129,7 +135,7 @@
2017-05-12
* v0.26: ocgx2.sty
* fix: OCView, OCPrint (ocgcolorlinks related OCGs) settings saved for
- possible re-opening by the user
+ possible re-opening by the user
2017-04-25
* v0.25: ocgx2.sty
diff --git a/macros/latex/contrib/ocgx2/ocgbase.sty b/macros/latex/contrib/ocgx2/ocgbase.sty
index 0d1cc4a73d..e8df5e87df 100644
--- a/macros/latex/contrib/ocgx2/ocgbase.sty
+++ b/macros/latex/contrib/ocgx2/ocgbase.sty
@@ -102,8 +102,8 @@
\RequirePackage{l3keys2e}
-\def\g@ocgbase@date@tl{2021/06/11}
-\def\g@ocgbase@version@tl{0.20}
+\def\g@ocgbase@date@tl{2022/04/01}
+\def\g@ocgbase@version@tl{0.21}
\ProvidesExplPackage{ocgbase}{\g@ocgbase@date@tl}{\g@ocgbase@version@tl}
{support package for ocgx2.sty}
@@ -229,7 +229,7 @@
%macro for starting OCG object (and nested children) insertion into Order
%hierarchy (shown as tree structure in the viewers `Layers' tab
-\cs_new_protected:Nn\ocgbase_tree_node_begin:n{ % #1: OCG obj
+\cs_new_protected_nopar:Nn\ocgbase_tree_node_begin:n{ % #1: OCG obj
%get the parent node from stack
\seq_get:NN\g_ocgbase_tree_nd_stack_seq\l__ocgbase_prnt_tl
\tl_if_exist:cTF{g_ocgbase_nd_\l__ocgbase_prnt_tl _chld_tl}{
@@ -281,7 +281,7 @@
% the node which refers to the same OCG (arg #2 remains un-modified), or
% the last sibling inserted (arg #2 is cleared);
% the node id of the sibling found is returned in arg #1
-\cs_new:Nn\ocgbase_traverse_siblings:NN{
+\cs_new_protected:Nn\ocgbase_traverse_siblings:NN{
% #1: current node (in/out), #2: OCG obj (in/out)
\str_if_eq:eeF{#2}{\tl_use:c{g_ocgbase_nd_#1_ocg_tl}}{
\tl_if_exist:cTF{g_ocgbase_nd_#1_sbl_tl}{
@@ -293,7 +293,7 @@
}
}
-\cs_new:Nn\ocgbase_build_order:Nn{
+\cs_new_protected_nopar:Nn\ocgbase_build_order:Nn{
% (recursive macro)
% #1: tl var to which the OCG order is written (output)
% #2: starting node id (input; usually `1')
@@ -474,8 +474,8 @@
\RequirePackage{l3keys2e}
-\def\g@ocgbase@date@tl{2021/06/11}
-\def\g@ocgbase@version@tl{0.20}
+\def\g@ocgbase@date@tl{2022/04/01}
+\def\g@ocgbase@version@tl{0.21}
\ProvidesExplPackage{ocgbase}{\g@ocgbase@date@tl}{\g@ocgbase@version@tl}
{support package for ocgx2.sty}
@@ -592,7 +592,7 @@
\tl_gset:Nx\g_ocgbase_last_ocg_tl{\pdf_object_ref_last:}
\tl_gset:cx{g_pbs_objname_\pdf_object_ref_last: _tl}{
g_object_\int_use:N\g_ocgbase_int _pdf
- }
+ }
\int_gincr:N\g_ocgbase_int
}
@@ -606,7 +606,7 @@
%macro for starting OCG object (and nested children) insertion into Order
%hierarchy (shown as tree structure in the viewers `Layers' tab
-\cs_new_protected:Nn\ocgbase_tree_node_begin:n{ % #1: OCG obj
+\cs_new_protected_nopar:Nn\ocgbase_tree_node_begin:n{ % #1: OCG obj
%get the parent node from stack
\seq_get:NN\g_ocgbase_tree_nd_stack_seq\l__ocgbase_prnt_tl
\tl_if_exist:cTF{g_ocgbase_nd_\l__ocgbase_prnt_tl _chld_tl}{
@@ -658,7 +658,7 @@
% the node which refers to the same OCG (arg #2 remains un-modified), or
% the last sibling inserted (arg #2 is cleared);
% the node id of the sibling found is returned in arg #1
-\cs_new:Nn\ocgbase_traverse_siblings:NN{
+\cs_new_protected:Nn\ocgbase_traverse_siblings:NN{
% #1: current node (in/out), #2: OCG obj (in/out)
\str_if_eq:eeF{#2}{\tl_use:c{g_ocgbase_nd_#1_ocg_tl}}{
\tl_if_exist:cTF{g_ocgbase_nd_#1_sbl_tl}{
@@ -670,7 +670,7 @@
}
}
-\cs_new:Nn\ocgbase_build_order:Nn{
+\cs_new_protected_nopar:Nn\ocgbase_build_order:Nn{
% (recursive macro)
% #1: tl var to which the OCG order is written (output)
% #2: starting node id (input; usually `1')
diff --git a/macros/latex/contrib/ocgx2/ocgx2.sty b/macros/latex/contrib/ocgx2/ocgx2.sty
index cb9c7822d0..46c42aca35 100644
--- a/macros/latex/contrib/ocgx2/ocgx2.sty
+++ b/macros/latex/contrib/ocgx2/ocgx2.sty
@@ -45,8 +45,8 @@
\RequirePackage{l3keys2e}
- \def\g@ocgxii@date@tl{2021/06/16}
- \def\g@ocgxii@version@tl{0.53}
+ \def\g@ocgxii@date@tl{2022/04/01}
+ \def\g@ocgxii@version@tl{0.54}
\ProvidesExplPackage{ocgx2}{\g@ocgxii@date@tl}{\g@ocgxii@version@tl}
{ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
@@ -250,6 +250,8 @@
\ocgxii_end_ocmd:
}
+ \cs_new_protected_nopar:Nn\ocgxii_protected_dummy_cs:n{}
+
\cs_new_protected_nopar:Nn\ocgxii_begin_ocmd:nn{ % #1: id,
\bool_if:nTF{ % #2: visib. expr. or policy
\tl_if_blank:oTF{#1}{
@@ -263,17 +265,33 @@
}{
% new ocmd
\group_begin:
- \ocgxii_ocmd_read_visbility:nN{#2}\l_ocgxii_ocmd_visibility_tl
+ \cs_set_eq:NN\AllOn \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AnyOn \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AnyOff\ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AllOff\ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\Not \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\And \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\Or \ocgxii_protected_dummy_cs:n
+ \ocgxii_ocmd_read_visbility:xN{#2}\l_ocgxii_ocmd_visibility_tl
\pbs_pdfobj:nnn{}{dict}{/Type/OCMD\l_ocgxii_ocmd_visibility_tl}
%if only visb. policy is given, generate equivalent visib. expression,
%needed for stack of open layers and \ocgxii_make_oc_entry: command
- \ocgxii_ocmd_make_equiv_ve:nN{#2}\l_ocgxii_ocmd_equiv_ve_tl
+ \ocgxii_ocmd_make_equiv_ve:xN{#2}\l_ocgxii_ocmd_equiv_ve_tl
\tl_gset:co{ocgx2.ocmd.\pbs_pdflastobj:}{\l_ocgxii_ocmd_equiv_ve_tl}
\group_end:
\tl_set:Nx\l_ocgxii_cur_ocmd_tl{\pbs_pdflastobj:}
\tl_if_blank:oF{#1}{
\tl_gset:cx{ocgxii_ocmd_#1}{\pbs_pdflastobj:}
- \iow_now:Nn\@mainaux{\ocgxii@newkeynoexp{ocgx2.ocmd.#1}{#2}}
+ \group_begin:
+ \cs_set_eq:NN\AllOn \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AnyOn \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AnyOff\ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AllOff\ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\Not \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\And \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\Or \ocgxii_protected_dummy_cs:n
+ \iow_now:Nx\@mainaux{\exp_not:N\ocgxii@newkeynoexp{ocgx2.ocmd.#1}{#2}}
+ \group_end:
}
}
\ocgbase_open_stack_push:n{\l_ocgxii_cur_ocmd_tl}
@@ -282,6 +300,7 @@
\ocgbase_oc_bdc:n{\l_ocgxii_cur_ocmd_tl}
}
\cs_generate_variant:Nn\ocgxii_begin_ocmd:nn{on}
+
\cs_new_protected_nopar:Nn\ocgxii_end_ocmd:{
\ocgbase_oc_emc:
\ocgbase_open_stack_pop:N\l_trash_tl
@@ -296,6 +315,8 @@
\tl_clear_new:N#2
\clist_map_inline:nn{#1}{\ocgxii_omcd_parse_argument:nN{##1}#2}
}
+ \cs_generate_variant:Nn\ocgxii_ocmd_read_visbility:nN{xN}
+
\cs_new_protected_nopar:Nn\ocgxii_omcd_parse_argument:nN{
\cs_set_eq:NN\AllOn \ocgxii_vp_check:n
\cs_set_eq:NN\AnyOn \ocgxii_vp_check:n
@@ -450,6 +471,8 @@
\tl_clear_new:N#2
\clist_map_inline:nn{#1}{\ocgxii_omcd_convert_vp:nN{##1}#2}
}
+ \cs_generate_variant:Nn\ocgxii_ocmd_make_equiv_ve:nN{xN}
+
\cs_new_protected_nopar:Nn\ocgxii_omcd_convert_vp:nN{
\cs_set_eq:NN\AllOn \ocgxii_vp_check:n
\cs_set_eq:NN\AnyOn \ocgxii_vp_check:n
@@ -533,7 +556,7 @@
latter~may~be~used~as~fallback~by~non-conforming~PDF~viewers.
}
%command that builds /OC entry from open layer stack
- \cs_new_nopar:Nn\ocgxii_make_oc_entry:{
+ \cs_new_protected_nopar:Nn\ocgxii_make_oc_entry:{
\group_begin:
\tl_gclear:N\g_ocgxii_oc_entry_tl
\tl_clear:N\l_tempa_tl
@@ -712,7 +735,7 @@
}
}
- \cs_new_protected:Nn\ocgxii_commalist_process:n{
+ \cs_new_protected_nopar:Nn\ocgxii_commalist_process:n{
\seq_set_split:Nnn\l_tmpa_seq{,}{#1}
\ocgxii_ocglist_build:Nn\l_ocgxii_e_list_tl{\seq_item:Nn\l_tmpa_seq{1}}
\ocgxii_ocglist_build:Nn\l_ocgxii_x_list_tl{\seq_item:Nn\l_tmpa_seq{2}}
@@ -1124,7 +1147,7 @@
%we'll be using the downscaled space character (32) from the pzdr
% (dingbats) font at the end of every ocgcolorlink in order to prevent
% empty links from flooding the page with link colour
- \cs_new_nopar:Npn\ocgxii_tiny_space_char:{
+ \cs_new_protected_nopar:Npn\ocgxii_tiny_space_char:{
\group_begin: \font\l_tmpa_tl=pzdr~scaled~1\l_tmpa_tl\char32 \group_end:
}
@@ -1183,13 +1206,13 @@
}
}
\bool_if:NT\l_ocgxii_ocgcolorlinks_bool{
- \cs_gset_nopar:Nn\ocgxii_colourlink_begin:{
+ \cs_gset_protected_nopar:Nn\ocgxii_colourlink_begin:{
%tiny space char put here in order to neutralise possible transformation
%matrix modifications from previous \pdfliteral{} (TikZ makes a lot use of it)
\hbox_overlap_left:n{\ocgxii_tiny_space_char:}
\pbs_literal:nn{page}{q~7~Tr}
}
- \cs_gset_nopar:Nn\ocgxii_colourlink_end:{
+ \cs_gset_protected_nopar:Nn\ocgxii_colourlink_end:{
%a tiny space char should keep empty link annots from flooding the page
% with link colour
\hbox_overlap_left:n{\ocgxii_tiny_space_char:}
@@ -1557,8 +1580,8 @@
\RequirePackage{l3keys2e}
-\def\g@ocgxii@date@tl{2021/06/16}
-\def\g@ocgxii@version@tl{0.53}
+\def\g@ocgxii@date@tl{2022/04/01}
+\def\g@ocgxii@version@tl{0.54}
\ProvidesExplPackage{ocgx2}{\g@ocgxii@date@tl}{\g@ocgxii@version@tl}
{ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
@@ -1762,6 +1785,8 @@
\ocgxii_end_ocmd:
}
+\cs_new_protected_nopar:Nn\ocgxii_protected_dummy_cs:n{}
+
\cs_new_protected_nopar:Nn\ocgxii_begin_ocmd:nn{ % #1: id,
\bool_if:nTF{ % #2: visib. expr. or policy
\tl_if_blank:oTF{#1}{
@@ -1775,7 +1800,14 @@
}{
% new ocmd
\group_begin:
- \ocgxii_ocmd_read_visbility:nN{#2}\l_ocgxii_ocmd_visibility_tl
+ \cs_set_eq:NN\AllOn \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AnyOn \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AnyOff\ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AllOff\ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\Not \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\And \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\Or \ocgxii_protected_dummy_cs:n
+ \ocgxii_ocmd_read_visbility:xN{#2}\l_ocgxii_ocmd_visibility_tl
\pdf_object_new:xn{g_object_\int_use:N\g_ocgbase_int _pdf}{dict}
\pdf_object_write:xx{g_object_\int_use:N\g_ocgbase_int _pdf}{
/Type/OCMD\l_ocgxii_ocmd_visibility_tl
@@ -1786,13 +1818,22 @@
\int_gincr:N\g_ocgbase_int
%if only visb. policy is given, generate equivalent visib. expression,
%needed for stack of open layers and \ocgxii_make_oc_entry: command
- \ocgxii_ocmd_make_equiv_ve:nN{#2}\l_ocgxii_ocmd_equiv_ve_tl
+ \ocgxii_ocmd_make_equiv_ve:xN{#2}\l_ocgxii_ocmd_equiv_ve_tl
\tl_gset:co{ocgx2.ocmd.\pdf_object_ref_last:}{\l_ocgxii_ocmd_equiv_ve_tl}
\group_end:
\tl_set:Nx\l_ocgxii_cur_ocmd_tl{\pdf_object_ref_last:}
\tl_if_blank:oF{#1}{
\tl_gset:cx{ocgxii_ocmd_#1}{\pdf_object_ref_last:}
- \iow_now:Nn\@mainaux{\ocgxii@newkeynoexp{ocgx2.ocmd.#1}{#2}}
+ \group_begin:
+ \cs_set_eq:NN\AllOn \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AnyOn \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AnyOff\ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\AllOff\ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\Not \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\And \ocgxii_protected_dummy_cs:n
+ \cs_set_eq:NN\Or \ocgxii_protected_dummy_cs:n
+ \iow_now:Nx\@mainaux{\exp_not:N\ocgxii@newkeynoexp{ocgx2.ocmd.#1}{#2}}
+ \group_end:
}
}
\ocgbase_open_stack_push:n{\l_ocgxii_cur_ocmd_tl}
@@ -1801,6 +1842,7 @@
\ocgbase_oc_bdc:n{\l_ocgxii_cur_ocmd_tl}
}
\cs_generate_variant:Nn\ocgxii_begin_ocmd:nn{on}
+
\cs_new_protected_nopar:Nn\ocgxii_end_ocmd:{
\ocgbase_oc_emc:
\ocgbase_open_stack_pop:N\l_trash_tl
@@ -1815,6 +1857,8 @@
\tl_clear_new:N#2
\clist_map_inline:nn{#1}{\ocgxii_omcd_parse_argument:nN{##1}#2}
}
+\cs_generate_variant:Nn\ocgxii_ocmd_read_visbility:nN{xN}
+
\cs_new_protected_nopar:Nn\ocgxii_omcd_parse_argument:nN{
\cs_set_eq:NN\AllOn \ocgxii_vp_check:n
\cs_set_eq:NN\AnyOn \ocgxii_vp_check:n
@@ -1969,6 +2013,8 @@
\tl_clear_new:N#2
\clist_map_inline:nn{#1}{\ocgxii_omcd_convert_vp:nN{##1}#2}
}
+\cs_generate_variant:Nn\ocgxii_ocmd_make_equiv_ve:nN{xN}
+
\cs_new_protected_nopar:Nn\ocgxii_omcd_convert_vp:nN{
\cs_set_eq:NN\AllOn \ocgxii_vp_check:n
\cs_set_eq:NN\AnyOn \ocgxii_vp_check:n
@@ -2052,7 +2098,7 @@
latter~may~be~used~as~fallback~by~non-conforming~PDF~viewers.
}
%command that builds /OC entry from open layer stack
-\cs_new_nopar:Nn\ocgxii_make_oc_entry:{
+\cs_new_protected_nopar:Nn\ocgxii_make_oc_entry:{
\group_begin:
\tl_gclear:N\g_ocgxii_oc_entry_tl
\tl_clear:N\l_tempa_tl
@@ -2226,7 +2272,7 @@
}
}
-\cs_new_protected:Nn\ocgxii_commalist_process:n{
+\cs_new_protected_nopar:Nn\ocgxii_commalist_process:n{
\seq_set_split:Nnn\l_tmpa_seq{,}{#1}
\ocgxii_ocglist_build:Nn\l_ocgxii_e_list_tl{\seq_item:Nn\l_tmpa_seq{1}}
\ocgxii_ocglist_build:Nn\l_ocgxii_x_list_tl{\seq_item:Nn\l_tmpa_seq{2}}
@@ -2617,7 +2663,7 @@
% we'll be using the downscaled space character (32) from the pzdr
% (dingbats) font at the start and at the end of every ocgcolorlink
-\cs_new_nopar:Npn\ocgxii_tiny_space_char:{
+\cs_new_protected_nopar:Npn\ocgxii_tiny_space_char:{
\group_begin: \font\l_tmpa_tl=pzdr~scaled~1\l_tmpa_tl\char32 \group_end:
}