summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-06-18 23:16:56 +0000
committerKarl Berry <karl@freefriends.org>2015-06-18 23:16:56 +0000
commit26b356cbc850146913b65b02a9f2060d94f74e1d (patch)
tree1423a679697fe0c67841d1db1e8df811fd47e3cb
parent0dab54f456cb3cdc9da2762f1fa4ca773990d91c (diff)
ocgx2 (18jun15)
git-svn-id: svn://tug.org/texlive/trunk@37602 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/ocgx2/ChangeLog40
-rw-r--r--Master/texmf-dist/tex/latex/ocgx2/fixocgx.sty22
-rw-r--r--Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty470
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check4
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc2
-rw-r--r--Master/tlpkg/tlpsrc/ocgx2.tlpsrc0
6 files changed, 535 insertions, 3 deletions
diff --git a/Master/texmf-dist/doc/latex/ocgx2/ChangeLog b/Master/texmf-dist/doc/latex/ocgx2/ChangeLog
new file mode 100644
index 00000000000..eb812c271e7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/ocgx2/ChangeLog
@@ -0,0 +1,40 @@
+2015-06-18
+ * v0.6
+ * new: package renamed to `ocgx2'; no more dependency on ocgx and ocg-p
+ packages
+ * new: options `viewocg', `printocg', `exportocg', `listintoolbar' also
+ available as package options
+ * new: package-only option `tikz' enables P. Garborit's `ocgx' TikZ library
+ * Fix: OCG ID lists with leading/trailings spaces passed as
+ argument to the OCG visibilty setting commands caused an error; the same
+ with empty arguments.
+ Improved behaviour of ocg switching links that are themselves part of OCGs.
+
+2015-06-15
+ * v0.5
+ * Fix: OCG ID lists with leading/trailings spaces passed as
+ argument to the OCG visibilty setting commands caused an error; the same
+ with empty arguments.
+ Improved behaviour of visibilty setting links that are themselves
+ part of OCGs.
+
+2015-03-16
+ * v0.4
+ * Fix: no more PS specials from `ocg-p.sty' in dvipdfmx mode
+
+2015-03-11
+ * v0.3
+ * New: ocg environment option `viewocg=always|never|ifvisible' added;
+ macro \fxocg@insert@OC allows package authors to insert
+ /OC <<OCMD with currently open OCGs>> entries into (suitable) pdf objects,
+ i. e. XObjects & Annotations, to make them PDF-layer aware.
+ * Fix: dead tikz-generated ocg buttons (from tikzlibraryocgx.code.tex) with
+ dvipdfmx/xelatex
+
+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 as `fixocgx'
diff --git a/Master/texmf-dist/tex/latex/ocgx2/fixocgx.sty b/Master/texmf-dist/tex/latex/ocgx2/fixocgx.sty
new file mode 100644
index 00000000000..256a71b2e07
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/ocgx2/fixocgx.sty
@@ -0,0 +1,22 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% fixocgx.sty
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\usepackage{expl3}
+
+\ExplSyntaxOn
+
+\msg_interrupt:nnn{Package~`fixocgx':}{
+ This~package~is~obsolete~and~replaced~by~package~`ocgx2'.\\\\
+ Remove\\\\
+ \space\space\string\usepackage{ocgx}\\
+ \space\space\string\usepackage{fixocgx}\\\\
+ from~and~add\\\\
+ \space\space\string\usepackage{ocgx2}\\\\
+ to~the~document~preamble.
+}{
+ Read~the~manual~(`texdoc~ocgx2')~for~further~information.
+}
+
+\ExplSyntaxOff
diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
new file mode 100644
index 00000000000..a23dfcc6338
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
@@ -0,0 +1,470 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% ocgx2.sty
+%
+% Copyright 2015--\today, Alexander Grahn
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% The intent of this package is to be a drop-in replacement for the already
+% existing CTAN package `ocgx' by Paul Garborit.
+%
+% It re-implements the functionality of the ocg, ocgx and ocg-p packages
+% and adds support for all known engines and backends including
+% latex+dvips+ps2pdf, xelatex, latex+dvipdfm, lualatex.
+%
+% Adds some minor improvements, such as package options, remembering option
+% settings of reopened ocgs, correct behaviour of ocg switching links that were
+% themselves placed on layers, compatibility with the animate and media9
+% packages.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://mirrors.ctan.org/help/Catalogue/licenses.lppl.html
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is A. Grahn.
+
+\RequirePackage{xparse}
+\RequirePackage{atenddvi}
+\RequirePackage{ifpdf}
+\RequirePackage{l3keys2e}
+
+\AtBeginDocument{
+ \@ifpackageloaded{media9}{}{\RequirePackage{media9}}
+ \@ifpackagelater{media9}{2015/01/21}{}{
+ \PackageError{ocgx2}{%
+ Requires package `media9' v0.49 [2015/01/21] or\MessageBreak
+ newer, but only v\g@mix@version@tl\space[\g@mix@date@tl] is available
+ }{}%
+ }
+}
+
+\ProvidesExplPackage{ocgx2}{2015/06/18}{0.6}
+{ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
+
+%re-implement ocg-p's `ocg' environment
+\DeclareDocumentEnvironment{ocg}{O{}mmm}{
+ \bool_if:NT\g_ocgxii_nestedB_bool{\tl_gput_right:Nx\@ocgbase@ocgorder{~[}}
+ \bool_gset_true:N\g_ocgxii_nestedB_bool
+ \bool_gset_false:N\g_ocgxii_nestedE_bool
+ \group_begin:
+ \ocgxii_reset_cmd_opts: % ... to the user-set package options
+ \tl_if_exist:cTF{ocgxii@#3}{ %re-open existing layer
+ \tl_set:Nx\l_tempa_tl{\use:c{ocgxii@#3.opts},#1}
+ \keys_set:nV{ocgxii/user}\l_tempa_tl
+ \int_compare:nT{\l_ocgxii_listno_tl=\c_zero}{
+ \tl_gput_right:Nx\@ocgbase@ocgorder{~\use:c{ocgxii@#3}}
+ }
+ }{
+ \tl_gset:cn{ocgxii@#3.opts}{#1}
+ \keys_set:nn{ocgxii/user}{#1}
+ \mix_pdfobj:nnn{}{dict}{
+ /Type/OCG/Name~(#2)/Usage<<
+ \l_ocgxii_view_tl\l_ocgxii_print_tl\l_ocgxii_export_tl>>
+ }
+ \tl_gput_right:Nx\@ocgbase@ocgs{\space\g_mix_pdflastobj_tl}
+ \int_compare:nT{#4==\c_zero}{
+ \tl_gput_right:Nx\@ocgbase@offocgs{\space\g_mix_pdflastobj_tl}
+ }
+ \tl_gset:cx{ocgxii@#3}{\g_mix_pdflastobj_tl}
+ \int_compare:nF{\l_ocgxii_listno_tl=\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}
+ }
+ }
+ \bool_if:nT{
+ !\cs_if_exist_p:c{OCGpdfobj#3} ||
+ !\str_if_eq_x_p:nn{\use:c{OCGpdfobj#3}}{\use:c{ocgxii@#3}}
+ }{
+ \cs_if_exist:NF\g_ocgxii_rerunwarned_tl{
+ \tl_new:N\g_ocgxii_rerunwarned_tl
+ \AtEndDocument{\msg_warning:nn{ocgx2}{rerun}}
+ }
+ }
+ \tl_gset:cx{OCGpdfobj#3}{\use:c{ocgxii@#3}}
+ \seq_gput_left:Nx\g_fixocg_ocgstack_seq{\use:c{ocgxii@#3}}
+ \group_end:
+ \mix_pdfbdc:nn{/OC}{\use:c{ocgxii@#3}}
+ \ignorespaces
+}{
+ \unskip
+ \mix_pdfemc:
+ \seq_gpop_left:NN\g_fixocg_ocgstack_seq\l_tempa_tl
+ \bool_if:NT\g_ocgxii_nestedE_bool{\tl_gput_right:Nx\@ocgbase@ocgorder{~]}}
+ \bool_gset_true:N\g_ocgxii_nestedE_bool
+ \bool_gset_false:N\g_ocgxii_nestedB_bool
+}
+\bool_new:N\g_ocgxii_nestedB_bool % nested OCG begin
+\bool_new:N\g_ocgxii_nestedE_bool % nested OCG end
+
+%stack of PDF obj references of currently open OCGs
+\seq_new:N\g_fixocg_ocgstack_seq
+%macro that inserts /OC <<OCMD with currently open OCGs>> entry;
+%for use within annotation dicts
+\tl_set:Nn\ocgxii@insert@OC{
+ \seq_if_empty:NF\g_fixocg_ocgstack_seq{
+ /OC~<</Type/OCMD/OCGs~[\seq_use:Nn\g_fixocg_ocgstack_seq{~}]/P/AllOn>>
+ }
+}
+
+%re-implement commands from ocgx.sty (all engines including ps2pdf [gs>=9.15])
+\DeclareDocumentCommand\switchocg{m +m}{
+ \tl_set:Nn\l_ocgxii_ocglist_tl{}
+ \tl_set:Nx\l_ocglistarg_tl{#1}\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{
+ \ocgxii_process_ocgref:NN\l_ocgxii_ocglist_tl\l_tempa_tl
+ }
+ \leavevmode
+ \ocgxii_pdflink:nn{
+ /Subtype/Link\ocgxii@insert@OC
+ /A <</S/SetOCGState/State [
+ \str_if_eq:VnF{\l_ocgxii_ocglist_tl}{}{/Toggle~\l_ocgxii_ocglist_tl}]>>
+ /Border [0~0~0]
+ }{#2}
+}
+
+\DeclareDocumentCommand\showocg{m +m}{
+ \tl_set:Nn\l_ocgxii_ocglist_tl{}
+ \tl_set:Nx\l_ocglistarg_tl{#1}\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{
+ \ocgxii_process_ocgref:NN\l_ocgxii_ocglist_tl\l_tempa_tl
+ }
+ \leavevmode
+ \ocgxii_pdflink:nn{
+ /Subtype/Link\ocgxii@insert@OC
+ /A <</S/SetOCGState/State [
+ \str_if_eq:VnF{\l_ocgxii_ocglist_tl}{}{/ON~\l_ocgxii_ocglist_tl}]>>
+ /Border [0~0~0]
+ }{#2}
+}
+
+\DeclareDocumentCommand\hideocg{m +m}{
+ \tl_set:Nn\l_ocgxii_ocglist_tl{}
+ \tl_set:Nx\l_ocglistarg_tl{#1}\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{
+ \ocgxii_process_ocgref:NN\l_ocgxii_ocglist_tl\l_tempa_tl
+ }
+ \leavevmode
+ \ocgxii_pdflink:nn{
+ /Subtype/Link\ocgxii@insert@OC
+ /A <</S/SetOCGState/State [
+ \str_if_eq:VnF{\l_ocgxii_ocglist_tl}{}{/OFF~\l_ocgxii_ocglist_tl}]>>
+ /Border [0~0~0]
+ }{#2}
+}
+
+\DeclareDocumentCommand\actionsocg{m m m +m}{
+ \tl_set:Nx\l_ocglistarg_tl{#1}\tl_trim_spaces:N\l_ocglistarg_tl
+ \tl_set:Nn\l_ocgxii_toswitch_tl{}
+ \seq_set_split:NnV\l_ocgxii_ocglistarg_seq{~}\l_ocglistarg_tl
+ \seq_map_variable:NNn\l_ocgxii_ocglistarg_seq\l_tempa_tl{
+ \ocgxii_process_ocgref:NN\l_ocgxii_toswitch_tl\l_tempa_tl
+ }
+ \tl_set:Nx\l_ocglistarg_tl{#2}\tl_trim_spaces:N\l_ocglistarg_tl
+ \tl_set:Nn\l_ocgxii_toshow_tl{}
+ \seq_set_split:NnV\l_ocgxii_ocglistarg_seq{~}\l_ocglistarg_tl
+ \seq_map_variable:NNn\l_ocgxii_ocglistarg_seq\l_tempa_tl{
+ \ocgxii_process_ocgref:NN\l_ocgxii_toshow_tl\l_tempa_tl
+ }
+ \tl_set:Nx\l_ocglistarg_tl{#3}\tl_trim_spaces:N\l_ocglistarg_tl
+ \tl_set:Nn\l_ocgxii_tohide_tl{}
+ \seq_set_split:NnV\l_ocgxii_ocglistarg_seq{~}\l_ocglistarg_tl
+ \seq_map_variable:NNn\l_ocgxii_ocglistarg_seq\l_tempa_tl{
+ \ocgxii_process_ocgref:NN\l_ocgxii_tohide_tl\l_tempa_tl
+ }
+ \leavevmode
+ \ocgxii_pdflink:nn{
+ /Subtype/Link\ocgxii@insert@OC
+ /A <</S/SetOCGState
+ /State [
+ \str_if_eq:VnF{\l_ocgxii_toswitch_tl}{}{/Toggle~\l_ocgxii_toswitch_tl}~
+ \str_if_eq:VnF{\l_ocgxii_toshow_tl}{}{/ON~\l_ocgxii_toshow_tl}~
+ \str_if_eq:VnF{\l_ocgxii_tohide_tl}{}{/OFF~\l_ocgxii_tohide_tl}
+ ]
+ >>
+ /Border [0~0~0]
+ }{#4}
+}
+
+% mimic commands from ocg-p
+\let\toggleocgs\switchocg
+\let\showocgs\showocg
+\let\hideocgs\hideocg
+\let\setocgs\actionsocg
+
+\cs_new:Nn\ocgxii_process_ocgref:NN{
+ \str_if_eq_x:nnF{#2}{}{
+ \tl_if_exist:cTF{OCGpdfobj#2}{\tl_put_right:Nx#1{~\use:c{OCGpdfobj#2}}}{
+ \msg_warning:nnx{ocgx2}{undefined~OCG}{#2}
+ \cs_if_exist:NF\g_ocgxii_refundefwarned_tl{
+ \tl_new:N\g_ocgxii_refundefwarned_tl
+ \AtEndDocument{\msg_warning:nn{ocgx2}{undefined~OCGs}}
+ }
+ }
+ }
+}
+
+%package opts
+\keys_define:nn{ocgxii}{
+ viewocg .choice:,
+ viewocg / always .code:n={
+ \tl_gset:Nn\g_ocgxii_view_tl{/View<</ViewState/ON>>}},
+ viewocg / never .code:n={
+ \tl_gset:Nn\g_ocgxii_view_tl{/View<</ViewState/OFF>>}},
+ viewocg / ifvisible .code:n={\tl_gclear_new:N\g_ocgxii_view_tl},
+ viewocg .default:n={ifvisible},
+
+ printocg .choice:,
+ printocg / always .code:n={
+ \tl_gset:Nn\g_ocgxii_print_tl{/Print<</PrintState/ON>>}},
+ printocg / never .code:n={
+ \tl_gset:Nn\g_ocgxii_print_tl{/Print<</PrintState/OFF>>}},
+ printocg / ifvisible .code:n={\tl_gclear_new:N\g_ocgxii_print_tl},
+ printocg .default:n={ifvisible},
+
+ exportocg .choice:,
+ exportocg / always .code:n={
+ \tl_gset:Nn\g_ocgxii_export_tl{/Export<</ExportState/ON>>}},
+ exportocg / never .code:n={
+ \tl_gset:Nn\g_ocgxii_export_tl{/Export<</ExportState/OFF>>}},
+ exportocg / ifvisible .code:n={\tl_gclear_new:N\g_ocgxii_export_tl},
+ exportocg .default:n={ifvisible},
+
+ listintoolbar .choices:nn = {always,never,iffirstuse}{
+ \tl_gset:Nx\g_ocgxii_listno_tl{\int_eval:n{\l_keys_choice_int-\c_one}}
+ },
+ listintoolbar .default:n={iffirstuse},
+
+ tikz .bool_set:N = \l_ocgxii_tikz_bool,
+ tikz .default:n = true
+}
+
+%package options preset
+\keys_set:nn{ocgxii}{viewocg,printocg,exportocg,listintoolbar,tikz=false}
+\ProcessKeysOptions{ocgxii} %process package options
+
+%command opts
+\keys_define:nn{ocgxii/user}{
+ viewocg .choice:,
+ viewocg / always .code:n={
+ \tl_set:Nn\l_ocgxii_view_tl{/View<</ViewState/ON>>}},
+ viewocg / never .code:n={
+ \tl_set:Nn\l_ocgxii_view_tl{/View<</ViewState/OFF>>}},
+ viewocg / ifvisible .code:n={
+ \tl_clear:N\l_ocgxii_view_tl},
+ viewocg .default:n={ifvisible},
+
+ printocg .choice:,
+ printocg / always .code:n={
+ \tl_set:Nn\l_ocgxii_print_tl{/Print<</PrintState/ON>>}},
+ printocg / never .code:n={
+ \tl_set:Nn\l_ocgxii_print_tl{/Print<</PrintState/OFF>>}},
+ printocg / ifvisible .code:n={
+ \tl_clear:N\l_ocgxii_print_tl},
+ printocg .default:n={ifvisible},
+
+ exportocg .choice:,
+ exportocg / always .code:n={
+ \tl_set:Nn\l_ocgxii_export_tl{/Export<</ExportState/ON>>}},
+ exportocg / never .code:n={
+ \tl_set:Nn\l_ocgxii_export_tl{/Export<</ExportState/OFF>>}},
+ exportocg / ifvisible .code:n={\tl_clear:N\l_ocgxii_export_tl},
+ exportocg .default:n={ifvisible},
+
+ listintoolbar .choices:nn = {always,never,iffirstuse}{
+ \tl_set:Nx\l_ocgxii_listno_tl{\int_eval:n{\l_keys_choice_int-\c_one}}
+ },
+ listintoolbar .default:n={iffirstuse}
+}
+
+\cs_new:Nn\ocgxii_reset_cmd_opts:{
+ \tl_set_eq:NN\l_ocgxii_view_tl\g_ocgxii_view_tl
+ \tl_set_eq:NN\l_ocgxii_print_tl\g_ocgxii_print_tl
+ \tl_set_eq:NN\l_ocgxii_export_tl\g_ocgxii_export_tl
+ \tl_set_eq:NN\l_ocgxii_listno_tl\g_ocgxii_listno_tl
+}
+
+\group_begin:
+\char_set_catcode_active:N\+\let+\space
+\tl_gset:Nx\g_ocgxii_gsoldwarning_tl{
+ {product~(Ghostscript)~search~{pop~pop~pop~true}{pop~false}ifelse~
+ revision~915~lt~and~{
+ (\token_to_str:N\n
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n
+ @@++++++++++++Warning:+Ghostscript+too+old!++++++++++++++@@\token_to_str:N\n
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n
+ @@+++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+Package+`ocgx2'+requires+Ghostscript+version+>=+9.15.+@@\token_to_str:N\n
+ @@+Otherwise,+PDF+layers+will+not+work.++++++++++++++++++@@\token_to_str:N\n
+ @@+++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+Get+current+version+from++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+http://www.ghostscript.com/download+++++++++++++++++++@@\token_to_str:N\n
+ @@+++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n)
+ print}~if}~?pdfmark
+}
+\group_end:
+
+\AtBeginDocument{
+ \ifpdf\else
+ \bool_if:NF\g_mix_dvipdfmx_bool{
+ \AtEndDvi{\special{ps::[nobreak]\g_ocgxii_gsoldwarning_tl}}
+ }
+ \fi
+}
+
+\msg_set:nnn{ocgx2}{rerun}{Rerun~to~get~OCG~references~right!}
+\msg_set:nnn{ocgx2}{undefined~OCG}{
+ Line~\msg_line_number: :~OCG~`#1'~is~not~defined.
+}
+\msg_set:nnn{ocgx2}{undefined~OCGs}{There~were~undefined~OCGs!}
+
+% dvipdfmx and xelatex workaround for ocg buttons within `tikzpicture' context
+\cs_set:Nn\ocgxii_pdflink:nn{
+ \bool_if:nTF{
+ \g_mix_dvipdfmx_bool && \cs_if_exist_p:N\pgfpictureid
+ }{
+ \hbox_set:Nn\l_tmpa_box{#2}
+ \mix_pdfannot:nnnn{
+ \dim_use:N\box_wd:N\l_tmpa_box}{
+ \dim_use:N\box_ht:N\l_tmpa_box}{
+ \dim_use:N\box_dp:N\l_tmpa_box
+ }{#1}
+ \box_use_clear:N\l_tmpa_box
+ }{
+ \mix_pdflink:nn{#1}{#2}
+ }
+}
+
+% tikz related code follows (enabled with package option `tikz')
+
+\bool_if:NF\l_ocgxii_tikz_bool{\endinput}
+\ExplSyntaxOff
+\RequirePackage{tikz}
+\usetikzlibrary{calc}
+
+% Copyright notice: The code that follows until the end of the file was
+% copied from Paul Garborit's `tikzlibraryocgx.code.tex' without modification
+\tikzset{
+ ocg/.style={ocg/.cd,#1,/tikz/.cd},
+ ocg={
+ % parameters
+ name/.store in=\ocgx@name,
+ visibity/.store in=\ocgx@visibility,
+ status/.is choice,
+ status/visible/.style={visibity=1},
+ status/invisible/.style={visibity=0},
+ % default values
+ name=,
+ status=visible,
+ % ref
+ ref/.style={
+ /tikz/execute at begin scope={\ocg{\ocgx@name}{#1}{\ocgx@visibility}},
+ /tikz/execute at end scope={\endocg},
+ },
+ },
+ switch ocg/.style={
+ postaction={
+ path picture={
+ \path let
+ \p1 = (path picture bounding box.south west),
+ \p2 = (path picture bounding box.north east),
+ \p3 = (\x2-\x1,\y2-\y1)
+ in
+ (path picture bounding box.center)
+ node[inner sep=0pt,anchor=center,outer sep=0pt]
+ {\switchocg{#1}{\phantom{\rule{\x3}{\y3}}}};
+ }
+ },
+ },
+ switch ocg with mark on/.style 2 args={
+ postaction={
+ path picture={
+ \begin{ocg}{#1}{#1}{1}
+ \draw
+ (path picture bounding box.south west)
+ --
+ (path picture bounding box.north east)
+ (path picture bounding box.south east)
+ --
+ (path picture bounding box.north west)
+ ;
+ \end{ocg}
+ },
+ switch ocg={#1 #2},
+ }
+ },
+ switch ocg with mark off/.style 2 args={
+ postaction={
+ path picture={
+ \begin{ocg}{#1}{#1}{0}
+ \draw
+ (path picture bounding box.south west)
+ --
+ (path picture bounding box.north east)
+ (path picture bounding box.south east)
+ --
+ (path picture bounding box.north west)
+ ;
+ \end{ocg}
+ },
+ switch ocg={#1 #2},
+ }
+ },
+ show ocg/.style={
+ postaction={
+ path picture={
+ \path let
+ \p1 = (path picture bounding box.south west),
+ \p2 = (path picture bounding box.north east),
+ \p3 = (\x2-\x1,\y2-\y1)
+ in
+ (path picture bounding box.center)
+ node[inner sep=0pt,anchor=center]
+ {\showocg{#1}{\phantom{\rule{\x3}{\y3}}}};
+ },
+ },
+ },
+ hide ocg/.style={
+ postaction={
+ path picture={
+ \path let
+ \p1 = (path picture bounding box.south west),
+ \p2 = (path picture bounding box.north east),
+ \p3 = (\x2-\x1,\y2-\y1)
+ in
+ (path picture bounding box.center)
+ node[inner sep=0pt,anchor=center]
+ {\hideocg{#1}{\phantom{\rule{\x3}{\y3}}}};
+ },
+ },
+ },
+ actions ocg/.style n args={3}{
+ postaction={
+ path picture={
+ \path let
+ \p1 = (path picture bounding box.south west),
+ \p2 = (path picture bounding box.north east),
+ \p3 = (\x2-\x1,\y2-\y1)
+ in
+ (path picture bounding box.center)
+ node[inner sep=0pt,anchor=center]
+ {\actionsocg{#1}{#2}{#3}{\phantom{\rule{\x3}{\y3}}}};
+ },
+ },
+ },
+}
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 056947bf620..8876d2aad17 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -233,7 +233,7 @@ my @TLP_working = qw(
filecontents filedate filehook fileinfo filemod
findhyph fink finstrut fira first-latex-doc
fix2col fixfoot fixlatvian fixltxhyph fixme fixmetodonotes
- fixocgx fixpdfmag
+ fixpdfmag
fjodor
flabels flacards flagderiv flashcards flashmovie flipbook flippdf
float floatflt floatrow
@@ -394,7 +394,7 @@ my @TLP_working = qw(
nrc ntgclass ntheorem ntheorem-vn nuc
numberedblock numericplots numname numprint
oberdiek objectz obnov
- ocg-p ocgx ocherokee ocr-b ocr-b-outline ocr-latex octavo
+ ocg-p ocgx ocgx2 ocherokee ocr-b ocr-b-outline ocr-latex octavo
odsfile ofs
ogham oinuit oldlatin oldstandard oldstyle
onlyamsmath onrannual opcit opensans opteng optional
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index 70df7e14e67..a96c19a22cf 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -365,7 +365,6 @@ depend finstrut
depend fixfoot
depend fixme
depend fixmetodonotes
-depend fixocgx
depend fjodor
depend flabels
depend flacards
@@ -679,6 +678,7 @@ depend numname
depend numprint
depend ocg-p
depend ocgx
+depend ocgx2
depend ocr-latex
depend octavo
depend oldstyle
diff --git a/Master/tlpkg/tlpsrc/ocgx2.tlpsrc b/Master/tlpkg/tlpsrc/ocgx2.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/ocgx2.tlpsrc