summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-03-23 21:29:19 +0000
committerKarl Berry <karl@freefriends.org>2017-03-23 21:29:19 +0000
commit254466162ae9104e0cfcf532852bb6738cc88ca2 (patch)
tree0e372a4561bfd62268bca2e1a16e0078e77d6368 /Master
parent92c843695cdf50eda50282ddd95705cf0aec67c5 (diff)
ocgx2 (23mar17)
git-svn-id: svn://tug.org/texlive/trunk@43587 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/ocgx2/ChangeLog6
-rw-r--r--Master/texmf-dist/doc/latex/ocgx2/README5
-rw-r--r--Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty5
-rw-r--r--Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty213
4 files changed, 165 insertions, 64 deletions
diff --git a/Master/texmf-dist/doc/latex/ocgx2/ChangeLog b/Master/texmf-dist/doc/latex/ocgx2/ChangeLog
index 1c060db422b..b14bae15848 100644
--- a/Master/texmf-dist/doc/latex/ocgx2/ChangeLog
+++ b/Master/texmf-dist/doc/latex/ocgx2/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-23
+ * v0.21 : ocgx2.sty
+ * v0.9 : ocgbase.sty
+ * fix: error when building document with nested OCGs
+ * new: ocgcolorlinks extending over line and page breaks
+
2017-03-16
* v0.20 : ocgx2.sty
* v0.8 : ocgbase.sty
diff --git a/Master/texmf-dist/doc/latex/ocgx2/README b/Master/texmf-dist/doc/latex/ocgx2/README
index 99e0f8f42c0..547a1362c6e 100644
--- a/Master/texmf-dist/doc/latex/ocgx2/README
+++ b/Master/texmf-dist/doc/latex/ocgx2/README
@@ -1,7 +1,7 @@
==================================
The `ocgx2' LaTeX Package
- Version 0.20 [2017/03/16]
+ Version 0.21 [2017/03/23]
(C) 2015--\today Alexander Grahn
==================================
@@ -27,7 +27,8 @@ To enable dvipdfmx support, pass `dvipdfmx' globally as a class option.
+ layers extending across page breaks
+ grouping layers into Radio Button Groups
- + OCG coloured links for hyperref
+ + OCG coloured links for hyperref that can extend over line and
+ page breaks
Also, it adds some minor improvements and bug fixes, such as package
options, remembering option settings of re-opened ocgs, correct behaviour
diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty
index 0b43c9e0e9b..5b1872cd213 100644
--- a/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty
+++ b/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty
@@ -94,7 +94,6 @@
% The Current Maintainer of this work is A. Grahn.
\RequirePackage{expl3}
-\RequirePackage{atenddvi}
\RequirePackage{pdfbase}
\def\g@ocgbase@date@tl{2017/03/16}
@@ -107,7 +106,7 @@
\seq_new:N\g_ocgbase_ocgorder_seq
\seq_new:N\g_ocgbase_offocgs_seq
-\AtEndDvi{
+\pbs_at_end_dvi:n{
\tl_if_empty:NF\g_ocgbase_ocgs_tl{
%global OCG array
\pbs_pdfobj:nnn{}{array}{\g_ocgbase_ocgs_tl}
@@ -295,7 +294,7 @@
\cs_new_nopar:Nn\ocgbase_ocgstack_pop:N{\seq_gpop:NN\g_ocgbase_ocgstack_seq#1}
%get top OCG on stack, without removing it
\cs_new_nopar:Nn\ocgbase_ocgstack_top:{
- \seq_item:Nn\g_ocgbase_ocgstack_seq{c_one}}
+ \seq_item:Nn\g_ocgbase_ocgstack_seq{\c_one}}
%command that inserts /OC <<OCMD with currently open OCGs>> entry;
%for use within annotation/xobject dicts
diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
index 76c57f22d2b..2654ce7309c 100644
--- a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
+++ b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
@@ -37,8 +37,8 @@
\RequirePackage{xparse}
\RequirePackage{l3keys2e}
-\def\g@ocgxii@date@tl{2017/03/16}
-\def\g@ocgxii@version@tl{0.20}
+\def\g@ocgxii@date@tl{2017/03/23}
+\def\g@ocgxii@version@tl{0.21}
\ProvidesExplPackage{ocgx2}{\g@ocgxii@date@tl}{\g@ocgxii@version@tl}
{ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
@@ -46,6 +46,22 @@
%creating global definitions
\cs_new:Npn\ocgxii@newkey#1#2{\tl_gset:cx{#1}{#2}}
+\AtBeginDocument{
+ \iow_now:Nx\@mainaux{
+ \token_to_str:N\providecommand\token_to_str:N\ocgxii@newkey[2]{}
+ \token_to_str:N\providecommand
+ \token_to_str:N\ocgxii@stack@on@page[2]{}
+ }
+}
+
+\msg_set:nnn{ocgx2}{missing~package}{
+ Package~`#1'~must~be~loaded~before~ocgx2.\\\\
+ Put\\\\
+ \space\space\string\usepackage#2{#1}\\
+ \space\space\string\usepackage[ocgcolorlinks]{ocgx2}\\\\
+ to~the~preamble~of~your~document.
+}
+
%package opts
%unknown package option error message
\msg_set:nnnn{ocgx2}{unknown~package~option}{Unknown~package~option~`#1'.}{
@@ -124,7 +140,7 @@
Get~an~up~to~date~version~of~`#1'.\\
Aborting.
}
-\@ifpackagelater{pdfbase}{2016/03/11}{}{
+\@ifpackagelater{pdfbase}{2017/03/23}{}{
\msg_error:nnn{xsavebox}{support~outdated}{pdfbase.sty}
\tex_endinput:D
}
@@ -248,8 +264,8 @@
}
\ocgxii@stack@on@page{0}{} %initialize
-%end-of-page action in output routine
-\cs_new_nopar:Nn\ocgxii_at_end_page:{
+%end-of-page action
+\pbs_eop_action:n{
%check whether end-of-page ocg stack has settled
\iow_shipout:Nx\@mainaux{
\token_to_str:N\ocgxii@newkey{ocgx2.oldstack.\int_use:N\g_ocgxii_page_int}{
@@ -276,19 +292,27 @@
\seq_map_variable:cNn{
g_pending_ocgs_on_\int_use:c{g_ocgxii_page_int}_seq
}\l_ocgxii_arg_tl{
- \ocgbase_oc_emc:
+ \str_if_eq_x:nnTF{\l_ocgxii_arg_tl}{(ocglink)}{
+ \ocgxii_colorlink_end:
+ }{
+ \ocgbase_oc_emc:
+ }
}
}
-%begin-of-page action in output routine
-\cs_new_nopar:Nn\ocgxii_at_begin_page:{
+%begin-of-page action (to output box background)
+\pbs_bop_action:n{
% re-open pending ocgs
\seq_set_eq:Nc\l_ocgxii_temp_seq{
g_pending_ocgs_on_\int_use:c{g_ocgxii_page_int}_seq
}
\seq_reverse:N\l_ocgxii_temp_seq
\seq_map_variable:NNn\l_ocgxii_temp_seq\l_ocgxii_arg_tl{
- \ocgbase_oc_bdc:n{\l_ocgxii_arg_tl}
+ \str_if_eq_x:nnTF{\l_ocgxii_arg_tl}{(ocglink)}{
+ \ocgxii_colorlink_begin:
+ }{
+ \ocgbase_oc_bdc:n{\l_ocgxii_arg_tl}
+ }
}
\int_gincr:N\g_ocgxii_page_int
% copy pending ocg stack from previous page, if it has not been initialized
@@ -303,17 +327,6 @@
}
\int_new:N\g_ocgxii_page_int %abs. page counter
-%modify output routine to manage ocgs spanning multiple pages
-\cs_set_eq:NN\ocgxii_outputpage_orig:\@outputpage
-\cs_set_nopar:Npn\@outputpage{
- \vbox_set:Nn\@outputbox{
- \ocgxii_at_begin_page:
- \box_use_clear:N\@outputbox
- \ocgxii_at_end_page:
- }
- \ocgxii_outputpage_orig:
-}
-
\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
@@ -511,7 +524,7 @@
\cs_new:Npn\showocgs{\showocg*}
\cs_new:Npn\hideocgs{\hideocg*}
\cs_new:Npn\setocgs{\actionsocg*}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cs_new:Nn\ocgxii_process_ocgref:NN{
\str_if_eq_x:nnF{#2}{}{
@@ -587,55 +600,125 @@
Line~\msg_line_number: :~unknown~option~`#1'.
}
-\cs_gset_eq:NN\ocgxii_atenddvi_checkimpl_orig:\AtEndDvi@CheckImpl%
-\def\AtEndDvi@CheckImpl{
- \ocgxii_atenddvi_checkimpl_orig:
- \cs_if_exist:NTF\AtEndDvi@LastPage{
- \int_compare:nF{\AtEndDvi@LastPage=\value{abspage}}{
- \cs_if_exist:NF\g_ocgxii_rerunwarned_tl{
- \tl_new:N\g_ocgxii_rerunwarned_tl
- \msg_warning:nn{ocgx2}{rerun}
- }
- }
- }{
- \cs_if_exist:NF\g_ocgxii_rerunwarned_tl{
- \tl_new:N\g_ocgxii_rerunwarned_tl
- \msg_warning:nn{ocgx2}{rerun}
- }
- }
-}
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% patch hyperref to ensure compatibility with our `ocgcolorlinks' option
-% similar to http://tex.stackexchange.com/a/104227;
-% add `ocgcolorlinks' support to all drivers
+%
+% Plus:
+%
+% * add `ocgcolorlinks' support to all drivers
+%
+% * allows for `ocgcolorlinks' extending over
+%
+% line-breaks AND page-breaks
+%
+% with pdftex, luatex, xetex, dvipdfmx drivers
+%
+% based on Ben Lerner's solution
+% http://tex.stackexchange.com/a/104227;
+% with some improvements
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\cs_new_nopar:Nn\ocgxii_enable_ocglinks:{
- \def\Hy@colorlink##1{
- \begingroup
- \def\Hy@ocgcolor{##1}
- \setbox0=\hbox\bgroup\color@begingroup\let\color@setgroup\begingroup
+\sys_if_output_pdf:TF{
+ \cs_new:Nn\ocgxii_literal_page:n{\pdfliteral~page~{#1}}
+}{
+ \bool_if:NT\g_ocgxii_dvipdfmx_bool{ %dvipdfmx/XeTeX
+ \cs_new:Nn\ocgxii_literal_page:n{\special{pdf:code~#1}}
}
- \def\Hy@endcolorlink{
- \color@endgroup\egroup
- \mbox{
- \ocgbase@oc@bdc{\OBJ@OCG@print}
- \rlap{\copy0}
- \ocgbase@oc@emc\ocgbase@oc@bdc{\OBJ@OCG@view}
+}
+
+\bool_if:nTF{\sys_if_output_dvi_p: && !\g_ocgxii_dvipdfmx_bool}{
+ % non-breakable links in dvips
+ \cs_new_nopar:Nn\ocgxii_enable_ocglinks:{
+ \def\Hy@colorlink##1{
\begingroup
- \expandafter\HyColor@UseColor\Hy@ocgcolor
- \box0
+ \def\Hy@ocgcolor{##1}
+ \setbox0=\hbox\bgroup\color@begingroup\let\color@setgroup\begingroup
+ }
+ \def\Hy@endcolorlink{
+ \color@endgroup\egroup
+ \mbox{
+ \ocgbase@oc@bdc{\OBJ@OCG@print}
+ \rlap{\copy0}
+ \ocgbase@oc@emc\ocgbase@oc@bdc{\OBJ@OCG@view}
+ \begingroup
+ \expandafter\HyColor@UseColor\Hy@ocgcolor
+ \box0
+ \endgroup
+ \ocgbase@oc@emc
+ }
\endgroup
+ }
+ }
+}{
+ % pdftex,luatex,xetex,dvipdfmx:
+ % ocgcolorlinks that extend over line and page breaks
+ \cs_new_nopar:Nn\ocgxii_enable_ocglinks:{
+ \def\Hy@colorlink##1{
+ \ifx\Hy@setbreaklinks\@gobble
+ \ifHy@breaklinks\Hy@breaklinkstrue\fi
+ \else
+ \Hy@breaklinkstrue
+ \fi
+ \ifHy@breaklinks
+ \seq_if_in:NnT\g_ocgbase_ocgstack_seq{(ocglink)}{
+ \msg_error:nn{ocgx2}{nested~breakable~ocgcolorlinks}
+ }
+ \ocgbase_ocgstack_push:n{(ocglink)}
+ \ocgxii_ocgstack_shipout:N\g_ocgbase_ocgstack_seq
+ \begingroup
+ \gdef\ocgxii@ocgcolor{##1}
+ \ocgxii_colorlink_begin:
+ \else
+ \begingroup
+ \def\ocgxii@ocgcolor{##1}
+ \setbox0=\hbox\bgroup\color@begingroup\let\color@setgroup\begingroup
+ \fi
+ }
+ \def\Hy@endcolorlink{
+ \ifHy@breaklinks
+ \ocgxii_colorlink_end:
+ \ocgbase_ocgstack_pop:N\l_trash_tl
+ \ocgxii_ocgstack_shipout:N\g_ocgbase_ocgstack_seq
+ \endgroup
+ \else
+ \color@endgroup\egroup
+ \mbox{
+ \ocgbase@oc@bdc{\OBJ@OCG@print}
+ \rlap{\copy0}
+ \ocgbase@oc@emc\ocgbase@oc@bdc{\OBJ@OCG@view}
+ \begingroup
+ \expandafter\HyColor@UseColor\ocgxii@ocgcolor
+ \box0
+ \endgroup
+ \ocgbase@oc@emc
+ }
+ \endgroup
+ \fi
+ }
+ \cs_new_nopar:Nn\ocgxii_colorlink_begin:{
+ \ocgxii_literal_page:n{q~7~Tr}
+ \vbox_to_zero:n{
+ \vss
+ \hbox_to_zero:n{\skip_horizontal:n{2\paperwidth}.\hss}
+ \skip_vertical:n{2\paperheight}
+ }
+ }
+ \cs_new_nopar:Nn\ocgxii_colorlink_end:{
+ \ocgbase@oc@bdc{\OBJ@OCG@print}
+ \ocgxii_literal_page:n{-88888~-88888~99999~99999~re~f}
+ \ocgbase@oc@emc
+ \ocgbase@oc@bdc{\OBJ@OCG@view}
+ \begingroup
+ \expandafter\HyColor@UseColor\ocgxii@ocgcolor
+ \ocgxii_literal_page:n{-88888~-88888~99999~99999~re~f}
+ \endgroup
\ocgbase@oc@emc
+ \ocgxii_literal_page:n{0~Tr~Q}
}
- \endgroup
}
}
-\RequirePackage{scrlfile}
-\bool_if:NT\l_ocgxii_ocgcolorlinks_bool{
- \PassOptionsToPackage{colorlinks}{hyperref}
- \AfterPackage*{hyperref}{
+\bool_if:nT\l_ocgxii_ocgcolorlinks_bool{
+ \@ifpackageloaded{hyperref}{
\Hy@colorlinkstrue
\Hy@AtBeginDocument{
\ocgbase_new_ocg:nnn{OCView}{/Print<</PrintState/OFF>>}{on}
@@ -644,8 +727,20 @@
\tl_gset:Nx\OBJ@OCG@print{\ocgbase_last_ocg:}
\ocgxii_enable_ocglinks:
}
+ }{
+ \msg_error:nnn{ocgx2}{missing~package}{hyperref}
}
}
+
+\msg_set:nnn{ocgx2}{nested~breakable~ocgcolorlinks}{
+ Breakable~OCG~color-links~cannot~be~nested.~Sorry.\\\\
+ Put\\\\
+ \space\space\string\hypersetup{breaklinks=false}...
+ \string\hypersetup{breaklinks=true}\\\\
+ around~the~outermost~of~a~group~of~nested~links.
+}
+\def\ocgxii@ocgcolor{{black}}
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% tikz related code follows (to be enabled with package option `tikz')