From 59c4dc3a0037db2c2b8f805286b64b3527d5183e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 24 Mar 2016 22:28:05 +0000 Subject: ocgx2 (22mar16) git-svn-id: svn://tug.org/texlive/trunk@40126 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/ocgx2/ChangeLog | 4 +++ Master/texmf-dist/doc/latex/ocgx2/README | 10 +++++- Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty | 49 ++++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 2 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/ocgx2/ChangeLog b/Master/texmf-dist/doc/latex/ocgx2/ChangeLog index f3f359a7aea..8f0667e372e 100644 --- a/Master/texmf-dist/doc/latex/ocgx2/ChangeLog +++ b/Master/texmf-dist/doc/latex/ocgx2/ChangeLog @@ -1,3 +1,7 @@ +2016-03-22 + * v0.17 : ocgx2.sty + * new: option `ocgcolorlinks', enables OCG colour links for hyperref package + 2016-03-11 * v0.16 : ocgx2.sty * v0.6 : ocgbase.sty diff --git a/Master/texmf-dist/doc/latex/ocgx2/README b/Master/texmf-dist/doc/latex/ocgx2/README index cf2f2e54a61..66b3c041ebc 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.16 [2016/03/11] + Version 0.17 [2016/03/22] (C) 2015--\today Alexander Grahn ================================== @@ -27,6 +27,7 @@ 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 Also, it adds some minor improvements and bug fixes, such as package options, remembering option settings of re-opened ocgs, correct behaviour @@ -34,6 +35,12 @@ of layer switching links that were themselves placed on layers, correct listing of (nested) ocgs in the layers tab of PDF viewers, compatibility with the `animate' and `media9' packages. +Coloured links in the PDF viewer that are printed on paper in the default text +colour are enabled with + + \usepackage{hyperref} % do NOT set [ocgcolorlinks] here! + \usepackage[ocgcolorlinks]{ocgx2} + `ocgx2' uses code from file `tikzlibraryocgx.code.tex' by P. Gaborit to enable TikZ styles for creating PDF Layers and clickable layer switching links in the `tikzpicture' context. @@ -79,6 +86,7 @@ and : viewocg = always | never | ifvisible radiobtngrp = (string; environment-only option) tikz (package-only option, see above) + ocgcolorlinks (package-only option, see above) Package options have global scope. Environment options override package options locally. 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<>}{on} + \tl_gset:Nx\OBJ@OCG@view{\ocgbase_last_ocg:} + \ocgbase_new_ocg:nnn{OCPrint}{/Print<>}{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} -- cgit v1.2.3