summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/ocgx2/ChangeLog13
-rw-r--r--Master/texmf-dist/doc/latex/ocgx2/README44
-rw-r--r--Master/texmf-dist/doc/latex/ocgx2/README.md168
-rw-r--r--Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty4
-rw-r--r--Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty173
5 files changed, 313 insertions, 89 deletions
diff --git a/Master/texmf-dist/doc/latex/ocgx2/ChangeLog b/Master/texmf-dist/doc/latex/ocgx2/ChangeLog
index b14bae15848..fdf2ee2934d 100644
--- a/Master/texmf-dist/doc/latex/ocgx2/ChangeLog
+++ b/Master/texmf-dist/doc/latex/ocgx2/ChangeLog
@@ -1,3 +1,16 @@
+2017-03-30
+ * v0.24 : ocgx2.sty
+ * fix: \ocglinkprotect{...} messing up the graphics state (CTM)
+
+2017-03-30
+ * v0.23 : ocgx2.sty
+ * v0.10 : ocgbase.sty
+ * fix: nested ocgcolorlinks over multiple pages
+
+2017-03-26
+ * v0.22 : ocgx2.sty
+ * fix: nested ocgcolorlinks
+
2017-03-23
* v0.21 : ocgx2.sty
* v0.9 : ocgbase.sty
diff --git a/Master/texmf-dist/doc/latex/ocgx2/README b/Master/texmf-dist/doc/latex/ocgx2/README
index 8e6c2c7b9e1..c1c4dd797ce 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.22 [2017/03/26]
+ https://github.com/agrahn/ocgx2
(C) 2015--\today Alexander Grahn
==================================
@@ -21,23 +21,25 @@ packages and adds support for all known engines and back-ends including:
* (Xe)LaTeX --> (x)dvipdfmx
* pdfLaTeX, luaLaTeX
-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 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
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
+To enable dvipdfmx support, pass `dvipdfmx' globally as a class option.
+
+ * New features:
+
+ + PDF layers extending over page breaks
+ + grouping PDF layers into Radio Button Groups
+ + 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. With
+ pdfLaTeX/LuaLaTeX, OCG links can be nested.
+
+Coloured OCG links are enabled with
\usepackage{hyperref} % do NOT set [ocgcolorlinks] here!
\usepackage[ocgcolorlinks]{ocgx2}
@@ -127,6 +129,24 @@ been provided:
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
+
+ \ocglinkprotect{...}
+
+For example:
+
+ \href{http://ctan.org}{Visit me on
+ \ocglinkprotect{\includegraphics{ctan-lion}}!}
+
+Alternatively, the whole link can be placed inside
+
+ \hypersetup{breaklinks=false}...\hypersetup{breaklinks=true}
+
+to temporarily disable breakable links.
+
* * *
diff --git a/Master/texmf-dist/doc/latex/ocgx2/README.md b/Master/texmf-dist/doc/latex/ocgx2/README.md
new file mode 100644
index 00000000000..7468aebd3c8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/ocgx2/README.md
@@ -0,0 +1,168 @@
+# 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**
++ 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
+listintoolbar= always | never | iffirstuse
+
+showingui
+radiobtngrp = <group name>
+tikz
+ocgcolorlinks
+````
+**not in** `ocgx`, `ocg-p`:
+
+* `showingui` (same as `listintoolbar`)
+* `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}}!}
+````
+
+Alternatively, the whole link can be placed inside
+````latex
+\hypersetup{breaklinks=false}...\hypersetup{breaklinks=true}
+````
+to temporarily disable breakable links.
+
+## License
+
+This material is subject to the [LaTeX Project Public License](http://mirrors.ctan.org/help/Catalogue/licenses.lppl.html
+).
+
diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty
index 956f0fb86d2..ec2b8b9393a 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/03/16}
-\def\g@ocgbase@version@tl{0.8}
+\def\g@ocgbase@date@tl{2017/03/30}
+\def\g@ocgbase@version@tl{0.10}
\ProvidesExplPackage{ocgbase}{\g@ocgbase@date@tl}{\g@ocgbase@version@tl}
{support package for ocgx2.sty}
diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
index 5654fc279fe..76e68c39fca 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/26}
-\def\g@ocgxii@version@tl{0.22}
+\def\g@ocgxii@date@tl{2017/03/30}
+\def\g@ocgxii@version@tl{0.24}
\ProvidesExplPackage{ocgx2}{\g@ocgxii@date@tl}{\g@ocgxii@version@tl}
{ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
@@ -51,6 +51,8 @@
\token_to_str:N\providecommand\token_to_str:N\ocgxii@newkey[2]{}
\token_to_str:N\providecommand
\token_to_str:N\ocgxii@ocg@stack@on@page[2]{}
+ \token_to_str:N\providecommand
+ \token_to_str:N\ocgxii@lnkcol@stack@on@page[2]{}
}
}
@@ -257,6 +259,11 @@
\cs_new_nopar:Npn\ocgxii@lnkcol@stack@on@page#1#2{
\seq_gset_from_clist:cn{g_pending_lnkcols_on_#1_seq}{#2}
+ %re-add braces around items
+ \seq_map_inline:cn{g_pending_lnkcols_on_#1_seq}{
+ \seq_gpop_left:cN{g_pending_lnkcols_on_#1_seq}\l_trash_tl
+ \seq_gput_right:cn{g_pending_lnkcols_on_#1_seq}{{##1}}
+ }
}
\ocgxii@lnkcol@stack@on@page{0}{} %initialize
@@ -287,8 +294,8 @@
}
% now close the colourlink opened last
\seq_get:cNT{g_pending_lnkcols_on_\int_use:c{g_ocgxii_page_int}_seq}\l_tmpa_tl{
- \tl_gset:Nx\ocgxii@ocgcolor{{\l_tmpa_tl}}
- \ocgxii_colorlink_end:
+ \tl_gset:Nx\g_ocgxii_lnkcol_tl{{\l_tmpa_tl}}
+ \ocgxii_colourlink_end:
}
}
%check whether end-of-page ocg stack has settled
@@ -319,7 +326,7 @@
}\l_tmpb_tl{\ocgbase_oc_emc:}
}
-%begin-of-page action (to output box background)
+%begin-of-page action
\pbs_bop_action:n{
% re-open all pending ocgs in original order
\seq_set_eq:Nc\l_ocgxii_pending_ocgs_seq{
@@ -330,12 +337,9 @@
\ocgbase_oc_bdc:n{\l_tmpa_tl}
}
% re-open the colourlink opened last
- \seq_if_exist:cT{g_pending_lnkcols_on_\int_use:c{g_ocgxii_page_int}_seq}{
- \seq_gset_eq:Nc\g_ocgxii_lnk_color_seq{g_pending_lnkcols_on_\int_use:c{g_ocgxii_page_int}_seq}
- \seq_get:NNT\g_ocgxii_lnk_color_seq\l_tmpa_tl{
- \tl_gset:Nx\ocgxii@ocgcolor{{\l_tmpa_tl}}
- \ocgxii_colorlink_begin:
- }
+ \seq_get:cNT{g_pending_lnkcols_on_\int_use:c{g_ocgxii_page_int}_seq}\l_tmpa_tl{
+ \tl_gset:Nx\g_ocgxii_lnkcol_tl{{\l_tmpa_tl}}
+ \ocgxii_colourlink_begin:
}
\int_gincr:N\g_ocgxii_page_int
% copy pending ocg stack from previous page, if it has not been initialized
@@ -656,103 +660,122 @@
}
}
+\cs_new_nopar:Nn\ocgxii_colourlink_begin:{}
+\cs_new_nopar:Nn\ocgxii_colourlink_end:{}
+\cs_new_nopar:Nn\ocgxii_colourlink_nobreak_begin:{
+ \hbox_set:Nn0\bgroup\color@begingroup\tl_set_eq:NN\color@setgroup\group_begin:
+}
+\cs_new_nopar:Nn\ocgxii_colourlink_nobreak_end:{
+ \color@endgroup\egroup
+ \mbox{
+ \ocgbase_oc_bdc:n{\g_ocgxii_ocgprint_tl}
+ \hbox_to_zero:n{\box_use:N0\hss}
+ \ocgbase_oc_emc:\ocgbase_oc_bdc:n{\g_ocgxii_ocgview_tl}
+ \group_begin:
+ \exp_after:wN\HyColor@UseColor\l_ocgxii_lnkcol_tl
+ \box_use_clear:N0
+ \group_end:
+ \ocgbase_oc_emc:
+ }
+}
+
+\seq_new:N\g_ocgxii_lnk_color_seq %stack of colours of currently open links
+
\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
- \def\Hy@ocgcolor{##1}
- \setbox0=\hbox\bgroup\color@begingroup\let\color@setgroup\begingroup
+ \group_begin:
+ \tl_set:Nn\l_ocgxii_lnkcol_tl{##1}
+ \ocgxii_colourlink_nobreak_begin:
}
\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
+ \ocgxii_colourlink_nobreak_end:
+ \group_end:
}
}
}{
% pdftex,luatex,xetex,dvipdfmx:
% ocgcolorlinks that extend over line and page breaks
-
- \seq_new:N\g_ocgxii_lnk_color_seq %stack of colours of currently open links
-
\cs_new_nopar:Nn\ocgxii_enable_ocglinks:{
\def\Hy@colorlink##1{
- \ifx\Hy@setbreaklinks\@gobble
- \ifHy@breaklinks\Hy@breaklinkstrue\fi
- \else
+ \ifx\Hy@setbreaklinks\@gobble\else
\Hy@breaklinkstrue
\fi
\ifHy@breaklinks
\seq_get_left:NNT\g_ocgxii_lnk_color_seq\l_tmpa_tl{
- \tl_gset_eq:NN\ocgxii@ocgcolor\l_tmpa_tl
- \ocgxii_colorlink_end:
+ \tl_gset_eq:NN\g_ocgxii_lnkcol_tl\l_tmpa_tl
+ \ocgxii_colourlink_end:
}
- \begingroup
- \ocgxii_colorlink_begin:
+ \group_begin:
+ \ocgxii_colourlink_begin:
\seq_gpush:Nx\g_ocgxii_lnk_color_seq{{##1}}
\ocgxii_stack_shipout:NN\ocgxii@lnkcol@stack@on@page\g_ocgxii_lnk_color_seq
\else
- \begingroup
- \def\ocgxii@ocgcolor{##1}
- \setbox0=\hbox\bgroup\color@begingroup\let\color@setgroup\begingroup
+ \group_begin:
+ \tl_set:Nn\l_ocgxii_lnkcol_tl{##1}
+ \ocgxii_colourlink_nobreak_begin:
\fi
}
\def\Hy@endcolorlink{
\ifHy@breaklinks
\seq_gpop:NN\g_ocgxii_lnk_color_seq\l_tmpa_tl
- \tl_gset_eq:NN\ocgxii@ocgcolor\l_tmpa_tl
+ \tl_gset_eq:NN\g_ocgxii_lnkcol_tl\l_tmpa_tl
\ocgxii_stack_shipout:NN\ocgxii@lnkcol@stack@on@page\g_ocgxii_lnk_color_seq
- \ocgxii_colorlink_end:
- \endgroup
+ \ocgxii_colourlink_end:
+ \group_end:
\seq_get_left:NNT\g_ocgxii_lnk_color_seq\l_tmpa_tl{
- \tl_gset_eq:NN\ocgxii@ocgcolor\l_tmpa_tl
- \ocgxii_colorlink_begin:
+ \tl_gset_eq:NN\g_ocgxii_lnkcol_tl\l_tmpa_tl
+ \ocgxii_colourlink_begin:
}
\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
+ \ocgxii_colourlink_nobreak_end:
+ \group_end:
\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_gset_nopar:Nn\ocgxii_colourlink_begin:{
+ \ocgxii_literal_page:n{q~7~Tr}
+ }
+ \cs_gset_nopar:Nn\ocgxii_colourlink_end:{
+ \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}
+ \ocgbase_oc_bdc:n{\g_ocgxii_ocgprint_tl}
+ \ocgxii_literal_page:n{-88888~-88888~99999~99999~re~f}
+ \ocgbase_oc_emc:
+ \ocgbase_oc_bdc:n{\g_ocgxii_ocgview_tl}
+ \group_begin:
+ \exp_after:wN\HyColor@UseColor\g_ocgxii_lnkcol_tl
\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}
+ \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:
+ \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:
}
}
@@ -761,9 +784,9 @@
\Hy@colorlinkstrue
\Hy@AtBeginDocument{
\ocgbase_new_ocg:nnn{OCView}{/Print<</PrintState/OFF>>}{on}
- \tl_gset:Nx\OBJ@OCG@view{\ocgbase_last_ocg:}
+ \tl_gset:Nx\g_ocgxii_ocgview_tl{\ocgbase_last_ocg:}
\ocgbase_new_ocg:nnn{OCPrint}{/Print<</PrintState/ON>>}{off}
- \tl_gset:Nx\OBJ@OCG@print{\ocgbase_last_ocg:}
+ \tl_gset:Nx\g_ocgxii_ocgprint_tl{\ocgbase_last_ocg:}
\ocgxii_enable_ocglinks:
}
}{