summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-10-04 18:37:38 +0000
committerKarl Berry <karl@freefriends.org>2012-10-04 18:37:38 +0000
commit44ee0abf2e2a1ed4ed69374b15a65d8c0bdadd3e (patch)
tree2f0763052184c8121d070ae2c5955cdbd8bbc311
parentbb68138f5309f867ed9b80a6850794104832254f (diff)
ocgx
git-svn-id: svn://tug.org/texlive/trunk@27878 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/ocgx/README1
-rw-r--r--Master/texmf-dist/doc/latex/ocgx/demo-ocgx.pdfbin690074 -> 690079 bytes
-rw-r--r--Master/texmf-dist/doc/latex/ocgx/ocgx-manual-en.pdfbin298007 -> 332391 bytes
-rw-r--r--Master/texmf-dist/source/latex/ocgx/demo-ocgx.tex (renamed from Master/texmf-dist/doc/latex/ocgx/demo-ocgx.tex)0
-rw-r--r--Master/texmf-dist/source/latex/ocgx/ocgx-example-1.tex (renamed from Master/texmf-dist/doc/latex/ocgx/ocgx-example-1.tex)0
-rw-r--r--Master/texmf-dist/source/latex/ocgx/ocgx-manual-en.tex (renamed from Master/texmf-dist/doc/latex/ocgx/ocgx-manual-en.tex)232
-rw-r--r--Master/texmf-dist/tex/latex/ocgx/ocgx.sty2
7 files changed, 166 insertions, 69 deletions
diff --git a/Master/texmf-dist/doc/latex/ocgx/README b/Master/texmf-dist/doc/latex/ocgx/README
index ceaa2325e3f..6930d370280 100644
--- a/Master/texmf-dist/doc/latex/ocgx/README
+++ b/Master/texmf-dist/doc/latex/ocgx/README
@@ -6,6 +6,7 @@ LaTeX package to use OCG (Optional Content Groups) within a PDF document without
license
=======
+
Copyright (C) 2012 by Paul Gaborit
This file may be distributed and/or modified
diff --git a/Master/texmf-dist/doc/latex/ocgx/demo-ocgx.pdf b/Master/texmf-dist/doc/latex/ocgx/demo-ocgx.pdf
index 879b7e485b8..55845d25aa3 100644
--- a/Master/texmf-dist/doc/latex/ocgx/demo-ocgx.pdf
+++ b/Master/texmf-dist/doc/latex/ocgx/demo-ocgx.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/ocgx/ocgx-manual-en.pdf b/Master/texmf-dist/doc/latex/ocgx/ocgx-manual-en.pdf
index 7b4fabcaeb8..8458c34ed29 100644
--- a/Master/texmf-dist/doc/latex/ocgx/ocgx-manual-en.pdf
+++ b/Master/texmf-dist/doc/latex/ocgx/ocgx-manual-en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/ocgx/demo-ocgx.tex b/Master/texmf-dist/source/latex/ocgx/demo-ocgx.tex
index 0d82850d3b7..0d82850d3b7 100644
--- a/Master/texmf-dist/doc/latex/ocgx/demo-ocgx.tex
+++ b/Master/texmf-dist/source/latex/ocgx/demo-ocgx.tex
diff --git a/Master/texmf-dist/doc/latex/ocgx/ocgx-example-1.tex b/Master/texmf-dist/source/latex/ocgx/ocgx-example-1.tex
index 37808b74832..37808b74832 100644
--- a/Master/texmf-dist/doc/latex/ocgx/ocgx-example-1.tex
+++ b/Master/texmf-dist/source/latex/ocgx/ocgx-example-1.tex
diff --git a/Master/texmf-dist/doc/latex/ocgx/ocgx-manual-en.tex b/Master/texmf-dist/source/latex/ocgx/ocgx-manual-en.tex
index e2e7571e8b0..d6f8869c4bf 100644
--- a/Master/texmf-dist/doc/latex/ocgx/ocgx-manual-en.tex
+++ b/Master/texmf-dist/source/latex/ocgx/ocgx-manual-en.tex
@@ -6,7 +6,7 @@
% 2. under the GNU Public License.
\documentclass[a4paper]{ltxdoc}
-\usepackage[vmargin=2cm,hmargin=3.5cm]{geometry}
+\usepackage[vmargin=2cm,hmargin=3.5cm,nohead]{geometry}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
@@ -25,34 +25,41 @@
stringstyle=\ttfamily\color{green!50!black},
showspaces=false,
showstringspaces=false,
- backgroundcolor=\color{cyan!10},
+ backgroundcolor=\color{blue!10},
fontadjust=true,
aboveskip=1ex,
belowskip=1ex,
emphstyle=\color{blue}\bfseries,
keepspaces=true,
flexiblecolumns=true,
- emph={switchOCG,showOCG,hideOCG,actionsOCG,usetikzlibrary}
+ emph={switchocg,showocg,hideocg,actionsocg,usetikzlibrary,node}
}
+\makeatletter
\newenvironment{prog}[1]{\vspace{1ex}--- \texttt{\emph{#1}} ---}{}
-\newcommand{\TeXexample}[3][]{
- \ifthenelse{\equal{#1}{}}{\begin{prog}{#2}}{\begin{prog}{#2 (#1)}}
- \lstinputlisting[style=TeXcode,aboveskip=0ex,#3]{#2}
- \end{prog}
+\makeatother
+\newcommand{\TeXexample}[3][]{%
+ \begin{minipage}{1.0\linewidth}
+ \ifthenelse{\equal{#1}{}}{\begin{prog}{#2}}{\begin{prog}{#2 (#1)}}
+ \lstinputlisting[style=TeXcode,aboveskip=0ex,#3]{#2}
+ \end{prog}
+ \end{minipage}
}
\usepackage{url}
\usepackage[colorlinks]{hyperref}
\usepackage[english]{babel}
\usepackage[babel]{microtype}
-\usepackage{parskip}
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{.4\baselineskip plus .5\baselineskip minus .2\baselineskip}
\usepackage{tikz}
\usetikzlibrary{shadows}
\usepackage[all]{nowidow}
\usepackage{ocgx}
+\usepackage{filecontents}
\newcounter{mynotes}
\newenvironment{note}{%
+ \vspace{5pt}
\tikzpicture
\node[%draw=black,line width=.1pt,
rounded corners=1em,
@@ -80,6 +87,7 @@
\newverbcommand\code{\color{red}}{}
\newverbcommand\style{\hspace{-2em}\color{red}}{}
+\newcommand\defaultvalue[1]{\hfill(#1)}
\newcommand\argument[1]{\textcolor{black}{\ttfamily #1}}
\newcommand\TikZ{Ti\emph{k}Z}
@@ -102,14 +110,31 @@ these layers can be displayed or not. Links can enable or disable the
display of OCGs.
The \code+ocgx+ package does not use Javascript embedded in the PDF
-document to enable or disable OCGs. Thus, it is usable with several PDF
-readers (to date, it has been successfully tested with \emph{Acrobat
- Reader}, \emph{Foxit Reader}, and \emph{Evince}).
+document to enable (to show) or disable (to hide) OCGs.
+
+\begin{note}
+ OCGs are usable with several PDF readers: to date, it has been
+ successfully tested with \emph{Acrobat Reader}, \emph{Foxit Reader},
+ and \emph{Evince}. The management of OGCs by \emph{Evince} is not yet
+ fully debugged: it still sometimes crash!
+\end{note}
\section{Usage}
Here is a simple example.
+\begin{filecontents*}{ocgx-example-1.tex}
+\documentclass{article}
+\usepackage{ocgx}
+\begin{document}
+\begin{ocg}{OCG 1}{ocg1}{1}
+ first example.
+\end{ocg}
+
+\switchocg{ocg1}{Button.}
+\end{document}
+\end{filecontents*}
+
\TeXexample{ocgx-example-1.tex}{}
This document creates an OCG called \emph{ocg1} containing the text
@@ -126,6 +151,16 @@ OCG by clicking the link ``\emph{Button.}''.
\url{http://www.texample.net/weblog/2008/nov/02/creating-pdf-layers/}.
\end{note}
+The following code creates an OCG named \emph{OCG name} with
+\emph{refocg} as internal reference. The content of this OCG is
+``\emph{content...}''. This OCG is visible (the third argument is 1).
+
+\begin{filecontents*}{ocgx-example-2}
+\begin{ocg}{OCG name}{refocg}{1}
+ content...
+\end{ocg}
+\end{filecontents*}
+\TeXexample{ocgx-example-2}{}
\DescribeEnv{ocg}%
The \code+ocg+ environment (provided by the package \code+ocg+) creates
@@ -136,16 +171,6 @@ indicates whether the OCG should be visible or not (1 for visible, 0 for
invisible). The content of the environment (any \TeX material) is added
into the OCG.
-The following code creates an OCG named \emph{OCG name} with
-\emph{refocg} as internal reference. The content of this OCG is
-``\emph{content...}''. This OCG is visible (the third argument is 1).
-
-\begin{lstlisting}[style=TeXcode]
- \begin{ocg}{OCG name}{refocg}{1}
- content...
- \end{ocg}
-\end{lstlisting}
-
\begin{note}
The same reference can be used with several \code+ocg+ environments (not
necessarily in the same page). All materials are grouped in the same
@@ -182,7 +207,7 @@ visibility status of OCGs whose references are \emph{ocg1} and
\emph{ocg2}:
\begin{lstlisting}[style=TeXcode]
- \switchocg{ocg1 ocg2}{toggle}
+\switchocg{ocg1 ocg2}{toggle}
\end{lstlisting}
\DescribeMacro{\showocg}%
@@ -195,7 +220,7 @@ The following code creates the link \emph{show} which makes visible the
OCGs whoses references are \emph{ocg1} and \emph{ocg2}:
\begin{lstlisting}[style=TeXcode]
- \showocg{ocg1 ocg2}{show}
+\showocg{ocg1 ocg2}{show}
\end{lstlisting}
\DescribeMacro{\hideocg}%
@@ -206,12 +231,13 @@ invisible remains invisible.
The following code creates the link \emph{hide} which makes invisible
the OCGs whoses references are \emph{ocg1} and \emph{ocg2}:
+
\begin{lstlisting}[style=TeXcode]
- \hideocg{ocg1 ocg2}{hide}
+\hideocg{ocg1 ocg2}{hide}
\end{lstlisting}
\DescribeMacro{\actionsocg}%
-The \code+\actionsocg+ macro transforms its fourth argument in a
+The \code+\actionsocg+ macro transforms its fourth argument into a
clickable link. Its three first arguments are lists of references of
OCGs. The first list contains references of OCGs which visibility status
is to be toggled. The second list contains references of OCGs to be set
@@ -222,73 +248,139 @@ visibility status of the OCG named \emph{ocg1}, to make visible the OCG
named \emph{ocg3}, and to make invisible OCG named \emph{ocg2}:
\begin{lstlisting}[style=TeXcode]
- \actionsocg{ocg1}{ocg3}{ocg2}{actions}
+\actionsocg{ocg1}{ocg3}{ocg2}{actions}
\end{lstlisting}
\subsection{Usage with \TikZ{}}
You can use the \code+ocgx+ package with \TikZ{}. The package provides a
-\TikZ{} library offering five specific styles to transform a path
-(\code+\path+ or \code+\node+) in a clickable link. To use it, simply
-add the following lines in your preamble:
+\TikZ{} library offering some specific styles to add material to OCGs,
+or to transform a path (\code+\path+ or \code+\node+) into a clickable
+link. To use it, simply add the following lines in your preamble:
-\begin{lstlisting}[style=TeXcode]
- \usepackage{tikz}
- \usetikzlibrary{ocgx}
-\end{lstlisting}
+\begin{filecontents*}{ocgx-tikz-preamble}
+\usepackage{tikz}
+\usetikzlibrary{ocgx}
+\end{filecontents*}
+\TeXexample{ocgx-tikz-preamble}{}
+
+\subsubsection*{How to add \TikZ{} scopes into OCGs}
\begin{list}{}
\item
-\noindent\style+/tikz/switch ocg+\argument{=\{\emph{<OCGs list>}\}}
-This style transforms the path or the current node in a link acting as
-if it was produced by the macro \code+\switchocg+ (the visibility status
-of referenced OCGs is reversed).
+ \noindent\style+/tikz/ocg+\argument{=\{\emph{<ocg options>}\}}
+
+ The \code+ocg+ family is used to specify the options used to add a
+ scope into an OCG.
+
+ \begin{list}{}
+ \item
+
+ \noindent\style+/tikz/ocg/ref+\argument{=\emph{<refname>}}\defaultvalue{no
+ default}
+
+ This option add the current scope to the OCG referenced by
+ \texttt{refname}. If this OCG does not exist, it is created with
+ \texttt{name} and visibility \texttt{status} specified by the
+ two options below.
+
+ \noindent\style+/tikz/ocg/name+\argument{=\emph{<name>}}\defaultvalue{no
+ default, initially empty}
+
+ It is the \texttt{\emph{name}} of the OCG as it appears in the PDF
+ viewer. If the OCG is already created, this option is useless.
+
+ \noindent\style+/tikz/ocg/status+\argument{=\emph{<visibility>}}\defaultvalue{no
+ default, initially \texttt{visible}}
+
+ Specify the initial visibility state of the OCG. Permissible values
+ are \texttt{visible}, and \texttt{invisible}. If the OCG is already
+ created, this option is useless.
+
+ \end{list}
+
+ \begin{note}
+ If you prefer, you can also use the \code+ogc+ environment in a
+ \code+tikzpicture+. The \code+pgfonlayer+ environment is special:
+ inside, you must reuse options below, or use a new \code+ocg+
+ environment.
+ \end{note}
+
+\end{list}
+
+\subsubsection*{How to transform nodes or paths into clickable links}
-\noindent\style+/tikz/show ocg+\argument{=\{\emph{<OCGs list>}\}}
+\begin{list}{}
+\item
+
+\noindent\style+/tikz/switch ocg+\argument{=\{\emph{<OCGs list>}\}}
+
+ This style transforms the current path or the current node in a link acting as
+ if it was produced by the macro \code+\switchocg+ (the visibility
+ status of referenced OCGs is reversed).
+
+ \noindent\style+/tikz/show ocg+\argument{=\{\emph{<OCGs list>}\}}
+
+ This style transforms the current path or the current node in a link acting as
+ if it was produced by the macro \code+\showocg+ (the referenced OCGs
+ are made visible).
-This style transforms the path or the current node in a link acting as
-if it was produced by the macro \code+\showocg+ (the referenced OCGs are
-made visible).
+ \noindent\style+/tikz/hide ocg+\argument{=\{\emph{<OCGs list>}\}}
-\noindent\style+/tikz/hide ocg+\argument{=\{\emph{<OCGs list>}\}}
+ This style transforms the current path or the current node in a link acting as
+ if it was produced by the macro \code+\hideocg+ (the referenced OCGs
+ are made invisible).
-This style transforms the path or the current node in a link acting as
-if it was produced by the macro \code+\hideocg+ (the referenced OCGs are
-made invisible).
+ \noindent\style+/tikz/actions ocg+\argument{=\{\emph{<OCGs
+ list>}\}\{\emph{<OCGs list>}\}\{\emph{<OCGs list>}\}}
-\noindent\style+/tikz/actions ocg+\argument{=\{\emph{<OCGs
- list>}\}\{\emph{<OCGs list>}\}\{\emph{<OCGs list>}\}}
+ This style transforms the current path or the current node in a link acting as
+ if it is produced by the macro \code+\actionsocg+ (the visibility
+ status of OCGs of the first list is reversed, the OCGs in the second
+ list are made visible and those of the third list are made invisible).
-This style transforms the path or the current node in a link acting as
-if it is produced by the macro \code+\actionsocg+ (the visibility status
-of OCGs of the first list is reversed, the OCGs in the second list are
-made visible and those of the third list are made invisible).
+ \noindent\style+/tikz/switch ocg with mark on+\argument{=\{\emph{<ocg
+ reference>}\}\{\emph{<OCGs list>}\}}
-\noindent\style+/tikz/switch ocg with mark on+\argument{=\{\emph{<ocg reference>}\}\{\emph{<OCGs list>}\}}
+ \noindent\style+/tikz/switch ocg with mark off+\argument{=\{\emph{<ocg
+ reference>>}\}\{\emph{<OCGs list>}\}}
-\noindent\style+/tikz/switch ocg with mark off+\argument{=\{\emph{<ocg reference>>}\}\{\emph{<OCGs list>}\}}
+ These styles transform the current path or the current node in a link acting
+ as if it is produced by the macro \code+\switchocg+ (the visibility
+ status of referenced OCGs in the list is reversed).
-These styles transform the path or the current node in a link acting as
-if it is produced by the macro \code+\switchocg+ (the visibility status
-of referenced OCGs in the list is reversed).
+ A mark (currently a simple cross) is drawn over the current path or
+ node in an OCG whose reference is \texttt{\emph{ocg reference}}. The
+ visibility status of this OCG will be reversed as those of the entire
+ list.
-A mark (currently a simple cross) is drawn over the current path or node
-in an OCG whose reference is \texttt{\emph{ocg reference}}. The
-visibility status of this OCG will be reversed as those of the entire
-list.
+ If the OCG whose reference is \texttt{\emph{ocg reference}} does not
+ exist, it is created with an empty name and its initial visibility
+ state is true with \code+on+ and false with \code+off+.
-If the OCG whose reference is \texttt{\emph{ocg reference}} does not
-exist, it is created with an empty name and its initial visibility state
-is true with \code+on+ and false with \code+off+.
\end{list}
\begin{note}
- Whatever the shape of the current path or node is, it is its
- \emph{bounding box} that is used to make the link (the link is always
- \emph{rectangular} and \emph{horizontal}).
+ Due to limitation of PDF, whatever the shape of the current path or
+ node is, it is its \emph{bounding box} that is used to make the link:
+ the link is always \emph{rectangular} and \emph{horizontal}!
\end{note}
+\subsubsection*{Example with \TikZ{}}
+
+\begin{filecontents*}{ocgx-example-3}
+\begin{tikpicture}
+ \begin{scope}[ocg={name=TikZ example,ref=tikzex,status=visible}
+ \fill[orange] (0,0) circle (1);
+ \end{scope}
+ \node[draw,switch ocg=tikzref] at (2,0) {Switch};
+\end{tikpicture}
+\end{filecontents*}
+\TeXexample{ocgx-example-3}{}
+
+
+
\section{Examples}
The document \code+demo-ocgx.tex+ provides several examples of usage of
@@ -305,12 +397,16 @@ package \code+ocgx+ with \TikZ{} (and \code+beamer+).
\item The packages \code+ocg+ and \code+ocgx+ are not compatible with Plain-\TeX{}.
\end{enumerate}
-\section{Development}
+\section{Development and history}
This package is still experimental. It is released on CTAN. You can
-recover the latest version on \url{https://github.com/polgab/ocgx}. Any
+donwload the latest version from \url{https://github.com/polgab/ocgx}. Any
help to participate in its development is welcome: contact the
maintainer (\url{paul.gaborit@gmail.com}).
+\paragraph{version 0.3} (2012-09-30) Complete documentation for part
+\emph{Usage with TikZ} and correct TDS archive.
+
+\paragraph{version 0.2} (2012-09-27) First release on CTAN.
\end{document}
diff --git a/Master/texmf-dist/tex/latex/ocgx/ocgx.sty b/Master/texmf-dist/tex/latex/ocgx/ocgx.sty
index 5df7a1bb52c..b76291db21f 100644
--- a/Master/texmf-dist/tex/latex/ocgx/ocgx.sty
+++ b/Master/texmf-dist/tex/latex/ocgx/ocgx.sty
@@ -6,7 +6,7 @@
% 2. under the GNU Public License.
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
-\def\ocgxversion{0.2}
+\def\ocgxversion{0.3}
\ProvidesPackage{ocgx}[2012/09/27 v\ocgxversion{} manage OCG in PDF document]
\RequirePackage{ocg}