summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/ocgtools/examples/ocgtools-test.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/ocgtools/examples/ocgtools-test.tex')
-rw-r--r--Master/texmf-dist/doc/latex/ocgtools/examples/ocgtools-test.tex254
1 files changed, 254 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/ocgtools/examples/ocgtools-test.tex b/Master/texmf-dist/doc/latex/ocgtools/examples/ocgtools-test.tex
new file mode 100644
index 00000000000..6089b771aca
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/ocgtools/examples/ocgtools-test.tex
@@ -0,0 +1,254 @@
+\usepackage[metapost]{mfpic}
+\opengraphsfile{mfpic-picture}
+\usepackage{amsmath}
+\usepackage{helvet}
+\let\rmdefault\sfdefault
+
+\usepackage{wrapfig}
+
+% new page which works in beamer class only
+\def\beamernewpage{\ifx \usetheme \undefined \relax \else \newpage\fi}
+
+% background for web.sty package
+\ifx \ifweb@navibar \undefined \relax \else
+\definecolor{lightgray}{rgb}{0.9,0.9,0.9}
+\newbox\backgroundbox
+\newbox\backgroundboxa
+\setbox\backgroundboxa=\hbox{\rotatebox{20}{{\color{lightgray}\Large ocgtools\color{black}}}}
+\newbox\backgroundboxb
+\setbox\backgroundboxb=\hbox to \paperwidth{\xleaders\copy\backgroundboxa\hfill}
+\newbox\backgroundboxc
+\setbox\backgroundboxc=\vbox to \paperheight{\xleaders\copy\backgroundboxb\vfill}
+\makeatletter
+ \def\ocgtools@shipoutstart@hook{\hbox to 0 pt{%
+ \kern -1in \vbox to 0 pt{\vss\copy\backgroundboxc}
+ \hss}}
+\makeatother
+\fi
+
+\begin{document}
+
+\fboxsep=4pt
+
+\title{Ocgtools demo}
+\author{Robert Ma\v{r}\'{i}k}
+
+\maketitle
+\def\maxwell{
+\nabla \cdot D&= \rho \\
+\nabla \cdot B&=0 \\
+\nabla \times E&=- \frac{\partial B}{\partial t}\\
+\nabla \times H&=J+ \frac{\partial D}{\partial t}}
+
+\tableofcontents
+\beamernewpage
+\makeatletter\ifx\PDFSCR@Info\undefined\relax\else\newpage\fi\makeatother
+
+\section{Introduction}
+
+\vbox to 0 pt{\noindent\hbox{\ocgpicture[width=3cm]{book.jpg}}
+ \vss}
+
+\hangindent=3.5cm \hangafter -5 \noindent This is test file for
+\texttt{ocgtools} package. You can (using \texttt{pdflatex}) insert
+hidden \TeX{} material into PDF files and open/close by clicking
+active links. The active links in this document are pictures (like the
+picture in this paragraph) or blue text. There are two kinds of
+behavior
+\begin{itemize}
+\item OCG spans over allmost whole PDF pages (with black or
+ transparent boundary) and can be hidden by clicikng anywhere in the
+ page -- \makeatletter
+ \ocgtext{Try it here!}{Click \ifocg@hide@button anywhere \else red cross \fi to close.} \makeatother
+
+\item OCG is small and can be hidden either with the same link which
+ opens this text or with red mark on the right top corner --
+ \ocgminitext[4cm]{Try it here!}{Click the same link or the red mark
+ to close.}
+\end{itemize}
+
+\beamernewpage Note that the pictures may look darker in Adobe Reader
+on Linux if you use package option \texttt{transparent} (means
+transparent boundary of the OCG's, used for example in demos for
+Beamer class and \verb|pdfscreen.sty| package). For comparison you can
+look at the original picture \href{http://math.mendelu.cz/en/analyza?lang=en}{here}) or at the
+demos which use \verb|web.sty| package. \ocgtext[5cm]{PDF viewer}{More
+ preciselly, Adobe Reader. \par \bigskip It is well known program.
+ You can install it on both Linux and Windows.} uses another
+rendering when trasparency is called and this seems to be system
+dependent. So be carefull when combining
+\ocgminitext[3cm]{\texttt{transparent}}{\rightskip 0 pt plus 1 fill
+ This comment is in \texttt{vbox} with specified width and may
+ contain new paragraphs. It is rather long and placed on the top of
+ the page. Hence \textit{it is shifted a bit to fit the area on the
+ screen}. However, if the papersize is small (like for Beamer test
+ files), the bottom part remains invisible for reader.
+
+\smallskip 2-nd paragraph.
+
+\smallskip 3-rd paragraph. This is the last paragraph.} option and
+bitmap pictures.
+
+\definecolor{green}{rgb}{0.5,1,0.5}
+\begin{minipage}[c]{0.4\linewidth}
+ \ocgtext[4cm]{\begin{align}\label{eq:maxwell}\maxwell
+ \end{align}
+ }{\colorbox{green}{\kern-2\fboxsep\hbox to \hsize{\hss Maxwell equations\hss}}$$\begin{aligned} \maxwell
+ \end{aligned}$$}
+\end{minipage}\hskip 0 pt plus 1 filll
+\begin{minipage}[c]{0.2\linewidth}
+\ocgpicture[width=\linewidth]{tall.jpg}
+\end{minipage}\hskip 0 pt plus 1 filll
+\begin{minipage}{0.3\linewidth}
+ Here we test \ocgminitextlt{ocg's}{{\color{red}O}ptional {\color{red}C}ontents {\color{red}G}roup} which are inside group (Maxwell's equation in minipage) and which are
+ taller than wide (little golf player).
+\end{minipage}
+
+\newpage
+\section{Options of the package}
+
+\begin{wrapfigure}[5]{r}{4cm}
+ \ocgpicture[width=4cm]{wide.jpg}
+\end{wrapfigure}
+This is some \ocgtext{random text}{anmf asdfh akdfjha adfjh akjdfh }
+to see that \ocgminitextlb{\texttt{wrapfig}}{Wrapfig is a package for
+ \LaTeX.} works and wide pictures are scaled properly. Several
+options are available for the package \verb|ocgtools|:
+\ocgminitext[6cm]{transparent}{\texttt{beamer} and \texttt{pdfscreen}
+ demo files are compiled with \texttt{transparent} option -- the
+ black boundary of big layers is opaque.},
+\ocgminitext[6cm]{insertvisible}{The file \texttt{*-web-nopanel.tex}
+ is compiled with \texttt{insertvisible} option. The layers are
+ inserted as visible layers and are turned to invisible when the PDF
+ file is opened.},
+ \ocgminitext[8cm]{nobutton}{Normally the pages
+ with active layers have a transparent button which can be used to
+ hide this layer. The user simply clicks anywhere and the layers
+ become hidden. In some viewers (like Foxit Reader) the button is not
+ 100\% transparent. This option allows not to include the big button
+ to hide layers. The layers can be closed by clicking the red cross
+ below. Demo files based on \texttt{pdfscreen} are compiled with this option.
+ Use this option to make the document accessible to Foxit Reader users.},
+\ocgminitext{noocg}{All OCG's are ignored},
+\ocgminitext[6cm]{noprogressmsg}{No messagae about processing OCG's at
+ the first page when document is opened.},
+\ocgminitext[8cm]{minimouseover}{\texttt{web} and \texttt{beamer} demo
+ files are compiled with \texttt{minimouseover} option. You can open
+ the minilayer by mouseover action in the area which is in the form
+ of invisible square 8pt$\times$8pt placed at the bottom right corner
+ of the referrence text.},
+\ocgminitext[8cm]{mouseover}{The same as
+ \texttt{minimouseover}, but works also for big layers. No demo file is
+ compiled with this option.},
+\ocgminitext[8cm]{nopageclose}{By default, layers and buttons for hiding them are
+ turned into hidden when entering a page. This option turns this behavior off.
+ Demo files based on \texttt{pdfscreen} are compiled with this option.}
+(each option has an associated
+minilayer with an explanation). Examples distributed with the package
+are in the form of demo files based on three packages (\verb|beamer|,
+\verb|web|, \verb|pdfscreen|). Each example has three variants with no
+panel, with panel on the right and on the left and each example is
+compiled with different options. The current document is compiled with
+the following options: {\bfseries \makeatletter
+ \if@ocgtools@transparent transparent, \fi \if@ocgtools@insertvisible
+ insertvisible, \fi \ifocg@hide@button \relax \else nobutton, \fi
+ \ifocgtools@noocg noocg, \fi \ifx \ocgtools@progressmsg\relax
+ noprogressmsg, \fi \if@ocgtools@mouseover mouseover,\fi
+ \if@ocgtools@minimouseover minimouseover,\fi \if@ocgtools@pageclose\else nopageclose,\fi \makeatother }
+
+
+\newpage
+\section{A taste of mathematics}
+
+\def\a{\begin{mfpic}[80][40]{-0.1}{2}{-0.1}{2.8}
+ \gfill[green]\btwnfcn{0,1.5,0.1}{1+(x-1.2)**2}{0}
+ \axes
+ \xmarks{1.5}
+ \tlabelsep{4pt}
+ \tlabel[tc](0,0){$a$}
+ \tlabel[tc](1.5,0){$b$}
+ \pen{1pt}
+ \function{0,1.5,0.1}{1+(x-1.2)**2}
+ \end{mfpic}}
+
+ \begin{figure}
+ \centering
+ \ocgtext{\a}{\a}
+ \caption{Floating figure}
+ \label{fig:figure}
+ \end{figure}
+
+ Mfpic pictures can be scaled easily (see the floating figure).
+
+ \beamernewpage We can add explanation to some computations easily
+ (Note the text \verb|Why?| inserted automatically by redefining
+ macro \verb|\ocgtextend|).
+
+{\def\ocgtextend{\raise0.75\baselineskip\hbox to 0 pt{\hss\tiny\color{red}Why?}\hss}
+ \global\def\dx{\,\mathrm{d}x}
+\begin{eqnarray}\label{eq:label}
+\int\ln x\dx&\ocgminitext[4cm]={Integration by parts $$\int\ln x\dx=\int1\cdot\ln x \dx$$}&x\ln x-\int x\frac 1x\dx\\
+&\ocgminitext={Formula $\int 1\dx=x$}&x\ln x - x +C
+\end{eqnarray}
+
+}
+
+\newpage
+\section{Few more tests}
+Package \verb|ocgtools.sty| redefines output routine via
+\verb|atbegshi.sty| package. From this reason it may be incompatible
+with some other packages dealing with output routine. However, the
+package \verb|eso-pic.sty| works fine.
+
+Test for placing OCG's:
+
+\hbox to \hsize{\hss\begin{minipage}{0.2\linewidth}
+ \ocgminitextlb{lb}{This is optional OCG.}
+
+ \ocgminitextrb{rb}{This is optional OCG.}
+
+ \ocgminitextlt{lt}{This is optional OCG.}
+
+ \ocgminitextrt{rt}{This is optional OCG.}
+\end{minipage}
+\hss\hss\hss
+\begin{minipage}{0.2\linewidth}
+ \ocgminitextlb{lb}{This is optional OCG.}
+
+ \ocgminitextrb{rb}{This is optional OCG.}
+
+ \ocgminitextlt{lt}{This is optional OCG.}
+
+ \ocgminitextrt{rt}{This is optional OCG.}
+\end{minipage}
+\hss
+}
+
+\ifx \usetheme \undefined
+We inserted equation \eqref{eq:label} and Figure \ref{fig:figure} in
+this document.
+
+The reference to Maxwell equations \eqref{eq:maxwell} works only if
+compiled on Linux via \texttt{ocgtools-preview.sh} (called from
+\texttt{ocgtools-test.sh} automatically with correct parameter). \fi
+
+\label{page}
+\newpage
+
+\ocgminitextlb{New}{New} \ocgminitextrb{page}{page}.
+
+Second line
+
+\bigskip
+
+\ocgminitext{New}{New} \ocgminitext{page}{page}.
+
+Second line
+\newpage
+
+Plain page.
+\newpage
+
+\ocgminitextlb{Last}{Last} \ocgminitextrb{page}{page}.
+
+Second line on last page.