diff options
author | Karl Berry <karl@freefriends.org> | 2016-03-24 22:28:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-03-24 22:28:05 +0000 |
commit | 59c4dc3a0037db2c2b8f805286b64b3527d5183e (patch) | |
tree | 236322d41d583537327d91943a61c8284884fb88 /Master/texmf-dist/tex/latex/ocgx2 | |
parent | 1a557ffbce30b97ed2bc943d841e32516bc1557a (diff) |
ocgx2 (22mar16)
git-svn-id: svn://tug.org/texlive/trunk@40126 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ocgx2')
-rw-r--r-- | Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty index 96c1d329d83..acb40f60174 100644 --- a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty +++ b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty @@ -37,7 +37,7 @@ \RequirePackage{xparse} \RequirePackage{l3keys2e} -\ProvidesExplPackage{ocgx2}{2016/03/11}{0.16} +\ProvidesExplPackage{ocgx2}{2016/03/22}{0.17} {ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx} %creating global definitions @@ -52,6 +52,7 @@ \bool_new:N\g_ocgxii_dvipdfmx_bool \bool_new:N\l_ocgxii_tikz_bool +\bool_new:N\l_ocgxii_ocgcolorlinks_bool \keys_define:nn{ocgx2}{ xetex .code:n = { @@ -98,6 +99,9 @@ tikz .bool_set:N = \l_ocgxii_tikz_bool, tikz .default:n = true, + ocgcolorlinks .bool_set:N = \l_ocgxii_ocgcolorlinks_bool, + ocgcolorlinks .default:n = true, + unknown .code:n = { \msg_error:nnx{ocgx2}{unknown~package~option}{\l_keys_key_tl} } @@ -703,6 +707,49 @@ } } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% patch hyperref to ensure compatibility with our `ocgcolorlinks' option +% similar to http://tex.stackexchange.com/a/104227; +% add `ocgcolorlinks' support to all drivers +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\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 + } + \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 + } +} + +\RequirePackage{scrlfile} +\bool_if:NT\l_ocgxii_ocgcolorlinks_bool{ + \PassOptionsToPackage{colorlinks}{hyperref} + \AfterPackage*{hyperref}{ + \Hy@colorlinkstrue + \Hy@AtBeginDocument{ + \ocgbase_new_ocg:nnn{OCView}{/Print<</PrintState/OFF>>}{on} + \tl_gset:Nx\OBJ@OCG@view{\ocgbase_last_ocg:} + \ocgbase_new_ocg:nnn{OCPrint}{/Print<</PrintState/ON>>}{off} + \tl_gset:Nx\OBJ@OCG@print{\ocgbase_last_ocg:} + \ocgxii_enable_ocglinks: + } + } +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % tikz related code follows (to be enabled with package option `tikz') \bool_if:NF\l_ocgxii_tikz_bool{\endinput} |