diff options
author | Karl Berry <karl@freefriends.org> | 2017-09-29 20:38:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-09-29 20:38:13 +0000 |
commit | 33a0cb402878424c71b1bcc8ec67eef49a0eb4dd (patch) | |
tree | 53de9080520f526b5a838d6910d0acd307b6afd8 | |
parent | 7517a8cc36ffb0c06ac028f06a69251551d2c939 (diff) |
ocgx2 (29sep17)
git-svn-id: svn://tug.org/texlive/trunk@45430 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/ocgx2/README.md | 160 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty | 110 |
3 files changed, 58 insertions, 218 deletions
diff --git a/Master/texmf-dist/doc/latex/ocgx2/README.md b/Master/texmf-dist/doc/latex/ocgx2/README.md deleted file mode 100644 index 07b40aecc83..00000000000 --- a/Master/texmf-dist/doc/latex/ocgx2/README.md +++ /dev/null @@ -1,160 +0,0 @@ -# The `ocgx2` LaTeX Package - -© 2015--`\today`, Alexander Grahn - -https://github.com/agrahn/ocgx2 - -## Introduction - -This package serves as a drop-in replacement for the already existing packages -**`ocgx`** by Paul Gaborit and **`ocg-p`** by Werner Moshammer for the creation of PDF -Layers. - -It re-implements the functionality of the **`ocg`**, **`ocgx`** and **`ocg-p`** packages and -adds support for all known engines and back-ends including: - -- LaTeX ⇒ dvips ⇒ ps2pdf/Distiller -- (Xe)LaTeX ⇒ (x)dvipdfmx -- pdfLaTeX, LuaLaTeX - -Also, it adds some features, improvements and bug fixes, such as package -options, remembering option settings of re-opened OCGs, correct behaviour 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, a re-implementation of **`hyperref`**'s -**`ocgcolorlink`** option. - -To enable dvipdfmx support, pass **`dvipdfmx`** globally as a class option. - ----- - -*New features:* - -+ layers extending across **page breaks** -+ grouping layers into **Radio Button Groups** (`ocg` environment option **`radiobtngrp=...`**) -+ re-implementing **`hyperref`**'s **`ocgcolorlinks`** option - -for creating OCG coloured links, which are printed on paper in the default -text colour and which can, unlike the original `hyperref` implementation, -extend over **line** and **page breaks**. Moreover, with pdfLaTeX/LuaLaTeX, OCG -coloured links can be **nested**. - -Coloured OCG links are enabled with - -````latex -\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. - -Just say: -````latex -\usepackage[tikz]{ocgx2} -```` -instead of -````latex -\usepackage{tikz} -\usetikzlibrary{ocgx} -```` -to enable these TikZ styles and read the `ocgx` documentation about their usage: -```` -texdoc ocgx -```` -The `/tikz/ocg/opts=<ocg options>` parameter adds to the list in section "How to -add TikZ scopes into OCGs" in the `ocgx` manual. It allows passing `ocg` -environment options (see below) to the TikZ scope. - -## Usage - -````latex -\usepackage[<options>]{ocgx2} - -\begin{ocg}[<options>]{<layer name>}{<layer id>}{<initial visibility>} - ... material to be put on a PDF layer ... -\end{ocg} -```` -With `<initial visibility>` = `( on | true | 1 ) | ( off | false | 0 )` - -and `<options>`: -```` -viewocg = always | never | ifvisible -printocg = always | never | ifvisible -exportocg = always | never | ifvisible - -showingui= true | false -radiobtngrp = <group name> -tikz -ocgcolorlinks -```` -**not in** `ocgx`, `ocg-p`: - -* `showingui` (to be preferred over `listintoolbar` of `ocgx/ocg-p`) -* `radiobtngrp = <group name>` (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. - -Layers can be added to one or several **Radio Button Groups** using the new option -`radiobtngrp`. From all layers within a Radio Button Group only one can be -enabled at a time. Enabling a layer, e. g. in the Layers tab of the PDF viewer, -automatically hides the previously visible layer. Option `radiobtngrp` can -be used repeatedly for the same OCG in order to add the layer to more than one -Radio Button Group. - -`ocg` environments can be nested and span multiple pages. - -See the `ocg-p` manual about the environment usage and the meaning of the -remaining options: -```` -texdoc ocg-p -```` - ----- - -Clickable links for switching PDF layer visibility are created with: -````latex -\switchocg{<layer IDs to toggle, space separated>}{<link text>} -\showocg{<layer IDs to switch ON, space separated>}{<link text>} -\hideocg{<layer IDs to switch OFF, space separated>}{<link text>} -\actionsocg{<IDs to toggle>}{<IDs to switch ON>}{<IDs to switch OFF>}{<link text>} -```` -For details about their usage, read the `ocgx` package manual: -```` -texdoc ocgx -```` -For compatibility with the `ocg-p` package, the following commands have -been provided: -````latex -\toggleocgs[triggerocg=...]{<layer IDs to toggle, space separated>}{<link text>} -\showocgs[triggerocg=...]{<layer IDs to switch ON, space separated>}{<link text>} -\hideocgs[triggerocg=...]{<layer IDs to switch OFF, space separated>}{<link text>} -\setocgs[triggerocg=...]{<IDs to toggle>}{<IDs to switch ON>}{<IDs to switch OFF>}{<link text>} -```` -See the `ocg-p` package manual for the meaning of `triggerocg=...`. - ----- - -Breakable OCG coloured links work best with normal text as link text. If the -link text is mixed with graphical content, such as from external files or -inline graphics (e. g. TikZ) and even `\fbox`-ed text, these graphical parts -must be enclosed in -````latex -\ocglinkprotect{...} -```` - -For example: -````latex -\href{http://ctan.org}{Visit me on \ocglinkprotect{\includegraphics{ctan-lion}}!} -```` - -## License - -This material is subject to the [LaTeX Project Public License](http://mirrors.ctan.org/macros/latex/base/lppl.txt). - diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty index 9dfe301840f..80b2a055979 100644 --- a/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty +++ b/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty @@ -96,8 +96,8 @@ \RequirePackage{expl3} \RequirePackage{pdfbase} -\def\g@ocgbase@date@tl{2017/09/14} -\def\g@ocgbase@version@tl{0.11} +\def\g@ocgbase@date@tl{2017/09/29} +\def\g@ocgbase@version@tl{0.12} \ProvidesExplPackage{ocgbase}{\g@ocgbase@date@tl}{\g@ocgbase@version@tl} {support package for ocgx2.sty} @@ -108,7 +108,7 @@ Get~an~up~to~date~version~of~`#1'.\\ Aborting. } -\@ifpackagelater{pdfbase}{2017/03/23}{}{ +\@ifpackagelater{pdfbase}{2017/09/29}{}{ \msg_error:nnn{ocgbase}{support~outdated}{pdfbase.sty} \tex_endinput:D } diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty index 96a42544a45..71efe68e459 100644 --- a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty +++ b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty @@ -35,8 +35,8 @@ \RequirePackage{xparse} \RequirePackage{l3keys2e} -\def\g@ocgxii@date@tl{2017/09/19} -\def\g@ocgxii@version@tl{0.31} +\def\g@ocgxii@date@tl{2017/09/29} +\def\g@ocgxii@version@tl{0.32} \ProvidesExplPackage{ocgx2}{\g@ocgxii@date@tl}{\g@ocgxii@version@tl} {ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx} @@ -706,15 +706,6 @@ % http://tex.stackexchange.com/a/104227; % with some improvements %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\sys_if_output_pdf:TF{ - \cs_new:Nn\ocgxii_literal_page:n{\pdfliteral~page~{#1}} -% \cs_new:Nn\ocgxii_literal_page:n{\pdfliteral~direct~{#1}} -}{ - \bool_if:NT\g_ocgxii_dvipdfmx_bool{ %dvipdfmx/XeTeX - \cs_new:Nn\ocgxii_literal_page:n{\special{pdf:code~#1}} -% \cs_new:Nn\ocgxii_literal_page:n{\special{pdf:literal~direct~#1}} - } -} \cs_new_nopar:Nn\ocgxii_colourlink_begin:{} \cs_new_nopar:Nn\ocgxii_colourlink_end:{} @@ -794,58 +785,67 @@ \fi } } - \cs_gset_nopar:Nn\ocgxii_colourlink_begin:{ - \ocgxii_literal_page:n{q~7~Tr} - } - \cs_gset_nopar:Nn\ocgxii_colourlink_end:{ - %this should keep empty link annots from flooding the page with link colour - \sys_if_output_pdf:TF{ - % with pdftex/luatex we provide a default glyph (`.') which we place - % beyond the page limits - \vbox_to_zero:n{ - \vss - \hbox_overlap_right:n{\skip_horizontal:n{2\paperwidth}.} - \skip_vertical:n{2\paperheight} + \bool_if:NT\l_ocgxii_ocgcolorlinks_bool{ + \cs_gset_nopar:Nn\ocgxii_colourlink_begin:{ + \pbs_literal:nn{page}{q~7~Tr} + } + \cs_gset_nopar:Nn\ocgxii_colourlink_end:{ + %this should keep empty link annots from flooding the page with link colour + \sys_if_output_pdf:TF{ + % with pdftex/luatex we provide a default glyph (`.') which we place + % beyond the page limits + \vbox_to_zero:n{ + \vss + \hbox_overlap_right:n{\skip_horizontal:n{2\paperwidth}.} + \skip_vertical:n{2\paperheight} + } + }{ + %with XeLaTeX we place an invisibly downscaled `.' from the LM font + %directly after the link text + \sys_if_engine_xetex:T{\hbox_overlap_left:n{\g_ocgxii_lmroman_tl .}} } - }{ - %with XeLaTeX we place an invisibly downscaled `.' from the LM - %OTF font directly after the link text - \sys_if_engine_xetex:T{\hbox_overlap_left:n{\g_ocgxii_lmroman_tl .}} + \ocgbase_oc_bdc:n{\ocgxii@OCPrint} + \pbs_literal:nn{page}{-88888~-88888~99999~99999~re~f} + \ocgbase_oc_emc: + \ocgbase_oc_bdc:n{\ocgxii@OCView} + \group_begin: + \exp_after:wN\HyColor@UseColor\g_ocgxii_lnkcol_tl + \pbs_literal:nn{page}{-88888~-88888~99999~99999~re~f} + \group_end: + \ocgbase_oc_emc: + \pbs_literal:nn{page}{0~Tr~Q} } - \ocgbase_oc_bdc:n{\ocgxii@OCPrint} - \ocgxii_literal_page:n{-88888~-88888~99999~99999~re~f} - \ocgbase_oc_emc: - \ocgbase_oc_bdc:n{\ocgxii@OCView} - \group_begin: - \exp_after:wN\HyColor@UseColor\g_ocgxii_lnkcol_tl - \ocgxii_literal_page:n{-88888~-88888~99999~99999~re~f} - \group_end: - \ocgbase_oc_emc: - \ocgxii_literal_page:n{0~Tr~Q} } } % user command for protecting graphical content (external file, inline % [e. g. TikZ], \fbox{...}) inside breakable ocgcolorlink -\DeclareDocumentCommand\ocglinkprotect{m}{ - \seq_get_left:NNT\g_ocgxii_lnk_color_seq\l_tmpa_tl{ - \tl_gset_eq:NN\g_ocgxii_lnkcol_tl\l_tmpa_tl - \ocgxii_colourlink_end: - \group_begin: - \tl_set_eq:NN\l_ocgxii_lnkcol_tl\l_tmpa_tl - \ocgxii_colourlink_nobreak_begin: - } - #1 - \seq_get_left:NNT\g_ocgxii_lnk_color_seq\l_tmpa_tl{ - \ocgxii_colourlink_nobreak_end: - \group_end: - \sys_if_output_pdf:T{\vbox_to_zero:n{ % avoid mixing up CTM - \vss - \hbox_to_zero:n{\skip_horizontal:n{2\paperwidth}.\hss} - \skip_vertical:n{2\paperheight} - }} - \ocgxii_colourlink_begin: +\bool_if:NTF\l_ocgxii_ocgcolorlinks_bool{ + \DeclareDocumentCommand\ocglinkprotect{m}{ + \seq_get_left:NNT\g_ocgxii_lnk_color_seq\l_tmpa_tl{ + \tl_gset_eq:NN\g_ocgxii_lnkcol_tl\l_tmpa_tl + \ocgxii_colourlink_end: + \group_begin: + \tl_set_eq:NN\l_ocgxii_lnkcol_tl\l_tmpa_tl + \ocgxii_colourlink_nobreak_begin: + } + \sys_if_output_pdf:TF{ + \hbox_set:Nn\l_tmpb_box{#1} + \hbox_to_wd:nn{\box_wd:N\l_tmpb_box}{ + \vrule~width~\c_zero_dim~height~\box_ht:N\l_tmpb_box~ + depth~\box_dp:N\l_tmpb_box + \pbs_pdfxform:nnnnn{1}{0}{}{}{\l_tmpb_box} + \pbs_pdfrefxform:n{\pbs_pdflastxform:} + } + }{#1} + \seq_get_left:NNT\g_ocgxii_lnk_color_seq\l_tmpa_tl{ + \ocgxii_colourlink_nobreak_end: + \group_end: + \ocgxii_colourlink_begin: + } } +}{ + \DeclareDocumentCommand\ocglinkprotect{m}{#1} } % option ocgcolorlinks and beamer are not compatible |