From 49b2ae38209e586fb12ce3664f92b24ce29d7162 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 10 Dec 2012 21:24:54 +0000 Subject: ocgx (10dec12) git-svn-id: svn://tug.org/texlive/trunk@28492 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/ocgx/demo-ocgx.pdf | Bin 690072 -> 693034 bytes .../texmf-dist/doc/latex/ocgx/ocgx-manual-en.pdf | Bin 335235 -> 334928 bytes Master/texmf-dist/source/latex/ocgx/demo-ocgx.tex | 86 ++++++++++++++++++++- .../source/latex/ocgx/ocgx-manual-en.tex | 41 +++++----- Master/texmf-dist/tex/latex/ocgx/ocgx.sty | 50 ++++++------ 5 files changed, 128 insertions(+), 49 deletions(-) diff --git a/Master/texmf-dist/doc/latex/ocgx/demo-ocgx.pdf b/Master/texmf-dist/doc/latex/ocgx/demo-ocgx.pdf index 46ce78751a5..d435dbebb52 100644 Binary files a/Master/texmf-dist/doc/latex/ocgx/demo-ocgx.pdf and b/Master/texmf-dist/doc/latex/ocgx/demo-ocgx.pdf 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 ba35b3073c2..9721097d060 100644 Binary files a/Master/texmf-dist/doc/latex/ocgx/ocgx-manual-en.pdf and b/Master/texmf-dist/doc/latex/ocgx/ocgx-manual-en.pdf differ diff --git a/Master/texmf-dist/source/latex/ocgx/demo-ocgx.tex b/Master/texmf-dist/source/latex/ocgx/demo-ocgx.tex index 58a57f7a3e9..87fcf465516 100644 --- a/Master/texmf-dist/source/latex/ocgx/demo-ocgx.tex +++ b/Master/texmf-dist/source/latex/ocgx/demo-ocgx.tex @@ -298,7 +298,7 @@ } \begin{frame} - \frametitle{Microtype demo} + \frametitle{Microtype demo (first version without hierarchy)} \def\sampletext{% Margin kerning is the adjustments of the characters at the @@ -332,6 +332,16 @@ {\centering \begin{tikzpicture} + \begin{scope}[ocg={name=With Protrusion,ref=protrusion}] + \end{scope} + \begin{scope}[ocg={name=Without Protrusion,ref=no-protrusion,status=invisible}] + \end{scope} + \begin{scope}[ocg={name=With Expansion,ref=expansion}] + \end{scope} + \begin{scope}[ocg={name=With Protrusion,ref=protrusion}] + \end{scope} + \begin{scope}[ocg={name=Without Expansion,ref=no-expansion,status=invisible}] + \end{scope} \begin{scope}[ocg={name=With Protrusion,ref=protrusion}] \microtypesetup{protrusion=true}% \begin{scope}[ocg={name=With Expansion,ref=expansion}] @@ -368,8 +378,82 @@ \node[checkbox,switch ocg with mark on={expansion}{no-expansion}]{}; \end{tikzpicture} with expansion +\end{frame} + +\begin{frame} + \frametitle{Microtype demo (second version with hierarchy)} + + \def\sampletext{% + Margin kerning is the adjustments of the characters at the + margins of a typeset text. A simplified employment of margin + kerning is hanging punctuation. Margin kerning is needed for + optical alignment of the margins of a typeset text, because + mechanical justification of the margins makes them look rather + ragged. Some characters can make a line appear shorter to the + human eye than others. Shifting such characters by an + appropriate amount into the margins would greatly improve the + appearance of a typeset text.% + } + + \tikzset{ + checkbox/.style={ + draw,circle,line width=.5pt,% + minimum size=.5em,top color=white,bottom color=cyan, + fill opacity=1, + inner sep=0, + drop shadow={fill=black,shadow xshift=.5mm,shadow yshift=-.5mm}, + }, + sampletext/.style={ + text width=8cm,align=justify, + font=\small, + fill=yellow!20, + inner xsep=1.5cm, + inner ysep=1cm, + draw=gray, + }, + } + + {\centering + \begin{tikzpicture} + \begin{scope}[ocg={name=With Protrusion,ref=pro}] + \microtypesetup{protrusion=true}% + \begin{scope}[ocg={name=With Expansion,status=visible,ref=pro-exp}] + \microtypesetup{expansion=true}% + \node[sampletext]{\sampletext\par};% + \end{scope} + + \begin{scope}[ocg={name=Without Expansion,status=invisible,ref=pro-no-exp}] + \microtypesetup{expansion=false}% + \node[sampletext]{\sampletext\par};% + \end{scope} + \end{scope} + + \begin{scope}[ocg={name=Without Protrusion,status=invisible,ref=no-pro}] + \microtypesetup{protrusion=false}% + \begin{scope}[ocg={name=With Expansion,status=visible,ref=no-pro-exp}] + \microtypesetup{expansion=true}% + \node[sampletext]{\sampletext\par};% + \end{scope} + + \begin{scope}[ocg={name=Without Expansion,status=invisible,ref=no-pro-no-exp}] + \microtypesetup{expansion=false}% + \node[sampletext]{\sampletext\par};% + \end{scope} + \end{scope} + \end{tikzpicture}\par + } + + Microtype : + \begin{tikzpicture} + \node[checkbox,switch ocg with mark on={pro}{no-pro}]{}; + \end{tikzpicture} with protrusion + \begin{tikzpicture} + \node[checkbox,switch ocg with mark on={pro-exp}{pro-no-exp no-pro-exp no-pro-no-exp}]{}; + \end{tikzpicture} with expansion + \end{frame} \end{document} + %%% Local Variables: %%% mode: latex %%% TeX-master: t diff --git a/Master/texmf-dist/source/latex/ocgx/ocgx-manual-en.tex b/Master/texmf-dist/source/latex/ocgx/ocgx-manual-en.tex index 71cf1365454..c790c312b3f 100644 --- a/Master/texmf-dist/source/latex/ocgx/ocgx-manual-en.tex +++ b/Master/texmf-dist/source/latex/ocgx/ocgx-manual-en.tex @@ -119,9 +119,8 @@ \section*{Abstract} -The \code+ocgx+ package extends and documents the \code+ocg+ package -(which comes with Asymptote) which allows you to create OCGs -(\emph{Optional Content Group}) in PDF documents. +The \code+ocgx+ package extends the \code+ocg-p+ package which allows +you to create OCGs (\emph{Optional Content Group}) in PDF documents. Every OCG includes \TeX{} material into a layer of the PDF file. Each of these layers can be displayed or not. Links can enable or disable the @@ -159,14 +158,6 @@ OCG by clicking the link ``\emph{Button.}''. \subsection{Create OCGs} -\begin{note} - The \code+ocg+ package written by Michael \textsc{Ritzert} comes - without documentation. In my knowledge, the only documentation for - this package is offered (by Kjell Magne Fauske) on the weblog of - TeXample.net: - \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). @@ -178,13 +169,13 @@ The following code creates an OCG named \emph{OCG name} with \end{ocgXample} \DescribeEnv{ocg}% -The \code+ocg+ environment (provided by the package \code+ocg+) creates -OCGs. It requires three arguments. The first argument is the name of the -OCG as it appears in the PDF viewer. The second argument is the internal -name used to reference this OCG. The third argument is a flag that -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 \code+ocg+ environment (provided by the package \code+ocg-p+) +creates OCGs. It requires three arguments. The first argument is the +name of the OCG as it appears in the layer toolbar of the PDF +viewer. The second argument is the internal name used to reference this +OCG. The third argument sets the initial visibility of the OCG when the +document is opened (1 for visible, 0 for invisible). The content of the +environment (any \TeX material) is added into the OCG. \begin{note} The same reference can be used with several \code+ocg+ environments (not @@ -193,8 +184,7 @@ into the OCG. \end{note} \begin{note} - A reference of an OCG consists of letters (A-Z, a-z), numbers (0-9) - and possibly the \code+@+ character. + A reference of an OCG consists of letters (A-Z, a-z), numbers (0-9). \end{note} \begin{note} @@ -406,10 +396,11 @@ package \code+ocgx+ with \TikZ{} (and \code+beamer+). \item Links are always horizontal rectangles! \item An \code+ocg+ environment spanning across multiple pages are not detected and don't work correctly. -\item The list of OCGs created by \code+ocg+ is seen by viewers as a - long flat list (no hierarchy allowed by PDF specifications). -\item The packages \code+ocg+ and \code+ocgx+ are not compatible with +\item The packages \code+ocg-p+ and \code+ocgx+ are not compatible with Plain-\TeX{}. +\item While \code+ocg-p+ is usable with \code+pdflatex+ and + \code+xelatex+, \code+ocgx+ works only with \code+pdflatex+ (and + \code+lualatex+). \end{enumerate} \section{Development and history} @@ -418,6 +409,10 @@ 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.5} (2012-12-07) Now, the \code+ocgx+ package uses +the new \code+ocg-p+ package instead of the \code+ocg+ package : the +layers can be nested in the layer toolbar of the PDF viewer. + \paragraph{version 0.4} (2012-11-14) Added dependancy to \texttt{calc} TikZ library. Fixed bug: bad lists in \code+\actionsocg+. diff --git a/Master/texmf-dist/tex/latex/ocgx/ocgx.sty b/Master/texmf-dist/tex/latex/ocgx/ocgx.sty index f2a7fb135f8..6ac757d5e5c 100644 --- a/Master/texmf-dist/tex/latex/ocgx/ocgx.sty +++ b/Master/texmf-dist/tex/latex/ocgx/ocgx.sty @@ -6,35 +6,35 @@ % 2. under the GNU Public License. \NeedsTeXFormat{LaTeX2e}[1994/06/01] -\def\ocgxversion{0.4} +\def\ocgxversion{0.5} \ProvidesPackage{ocgx}[2012/11/14 v\ocgxversion{} manage OCG in PDF document] -\RequirePackage{ocg} +\RequirePackage{ocg-p} %%%% small patch to ocg.sty %%%% % called from the aux file -\def\@ocg@makeknown#1#2#3{% #1: OCG name, #2: OC id, #3: on/off - \@ifundefined{OCG#2}{% - %\message{OCG#2}% - \expandafter\gdef\csname OCG#2\endcsname{#1}% - \immediate\pdfobj{<< /Type /OCG /Name (#1) >>}% new ocg - \xdef\@ocg@curocg{\the\pdflastobj\space 0 R}% reference to id - % *** PATCH *** - \expandafter\xdef\csname OCGpdfobj#2\endcsname{\@ocg@curocg} - % *** END OF PATCH *** - \xdef\@ocg@ocgs{\@ocg@ocgs\space\@ocg@curocg}% list of all OCGs in "first defined" order - \ifnum#3=1 %on - \xdef\@ocg@ocgson{\@ocg@ocgson\space\@ocg@curocg}% list of all default-on OCGs - \else% - \xdef\@ocg@ocgsoff{\@ocg@ocgsoff\space\@ocg@curocg}% list of all default-off OCGs - \fi% - \xdef\@ocg@layersnames{% - \@ocg@layersnames\space/OC#2\space\@ocg@curocg% name-to-id mapping - }% - }{% - %\message{OCG#2 reopened}% - % layer reopened - }% -} +% \def\@ocg@makeknown#1#2#3{% #1: OCG name, #2: OC id, #3: on/off +% \@ifundefined{OCG#2}{% +% %\message{OCG#2}% +% \expandafter\gdef\csname OCG#2\endcsname{#1}% +% \immediate\pdfobj{<< /Type /OCG /Name (#1) >>}% new ocg +% \xdef\@ocg@curocg{\the\pdflastobj\space 0 R}% reference to id +% % *** PATCH *** +% \expandafter\xdef\csname OCGpdfobj#2\endcsname{\@ocg@curocg} +% % *** END OF PATCH *** +% \xdef\@ocg@ocgs{\@ocg@ocgs\space\@ocg@curocg}% list of all OCGs in "first defined" order +% \ifnum#3=1 %on +% \xdef\@ocg@ocgson{\@ocg@ocgson\space\@ocg@curocg}% list of all default-on OCGs +% \else% +% \xdef\@ocg@ocgsoff{\@ocg@ocgsoff\space\@ocg@curocg}% list of all default-off OCGs +% \fi% +% \xdef\@ocg@layersnames{% +% \@ocg@layersnames\space/OC#2\space\@ocg@curocg% name-to-id mapping +% }% +% }{% +% %\message{OCG#2 reopened}% +% % layer reopened +% }% +% } %%%% END OF PATCH %%%% \csname ocgx@end:ENDOFOCGS\endcsname -- cgit v1.2.3