\documentclass[12pt]{article}

\usepackage{graphicx}
\usepackage {pstcol,color,pst-node}
\usepackage{advi}
\usepackage{advi-annot}
\usepackage{advi-graphicx}
\usepackage{demo}
\usepackage{superpose}

\begin{document}

\newpage

\subsection* {\ActiveDVI~has two components}

\begin{itemize}
\item {\tt mldvi}: {\bf a dvi} previewer (by Alexandre Miquel)
\begin {itemize}
\item[+] dvips
  \textcolor{c1}{c}%
  \textcolor{c2}{o}%
  \textcolor{c3}{l}%
  \textcolor{c4}{o}%
  \textcolor{c5}{u}%
  \textcolor{c6}{r}
  extension (by Alexandre Miquel)
\item[+] psfile specials with cache (by Jun Furuse)
\item[+] GPIC specials (by Xavier Leroy)
\item[+] Postscript specials (by Didier R{\'{e}}my)
\item[+] hyperrefs (by Didier R{\'{e}}my)
\item[+] active anchors (by Didier R{\'{e}}my)
\item[+] background images (by Roberto Di Cosmo)
\item[+] and a few other gadgets...
\end {itemize}
\end{itemize}

\begin{itemize}
\item 
A set of macros to animate your presentation 
(by Jun~Furuse and Didier~R{\'{e}}my).
 
\item 
A simple way to launch arbitrary demonstration and/or animation
programs from inside your slides
\hbox {(by Jun Furuse and Pierre Weis)}.

\item 
A package to annotate text (using active anchors)

\item
Support for \verb+\includegraphics+ with native image formats

\end{itemize}

\newpage

%Didier's flashy macro
\def \flash #1{\let \do\leflash \do #1\relax}
\def \leflash #1{\ifx #1\relax \def \do{}\else \def \do {#1\adviwait[0.05]\leflash}\fi \do}

\def\goon{\hbox{{\Large $\Rightarrow$}~Type~space~to~go~on}}

\subsection* {EPS (and other!) graphics including using Camlimages}
\begin{quote}
\verb+\includegraphics[width=0.1\textwidth]{caml.eps}+\\
\verb+\includegraphics[width=0.2\textwidth]{caml.eps}+\\
\verb+\includegraphics[width=0.1\textwidth]{world}+\\

This last command looks for a file named {\tt world} with extensions
out of the ones provided by the directive
\verb+\DeclareGraphicsExtensions+ in the \verb|advi-images| package
(in the present case, it finds \verb+world.jpg+, for which a
bounding box specification must be available in the file
\verb+world.bb+)\\

\includegraphics[width=0.1\textwidth]{../tex/caml.eps}
\includegraphics[width=0.2\textwidth,height=0.09\textwidth]{../tex/caml.eps}
\framebox{\includegraphics[width=0.1\textwidth]{world}}
\end{quote}

\subsection* {Other eye candies for presentation}

\medskip\noindent
\docdef \adviwait\docopt{seconds}
\begin{quote}
Wait for \docid{seconds} or without argument forever, that is, until the
user requests to continue (or to change page).
\end{quote}

\medskip\noindent
\docdef \advirecord \doctt{[play]}\docarg{tag}\docarg{latex code}
\begin{quote}
The computes \docid{latex code} and record its DVI ouput under tag
\docid{tag}. The DVI output is not displayed during recording, unless the
option \doctt{play} is set.

Embedded recordings are prohibited. 
\end{quote}

\medskip\noindent
\docdef \adviplay\docopt{color}\docarg{tag}
\begin{quote}
Replay the DVI previously recorded as \docid{tag}.
The optional argument changes the color to \docid{color} during replay. 
\end{quote}

\newpage 

\subsection* {Eye candies (examples)}

\begin{itemize}
   \item mark the text with a tag name:\\
     $\tt \backslash advirecord\{this\}
      \{\advirecord[play]{this}{Warning~to~the~casual~user}\}$

   \item then change the current text color and replay the tagged text:\\
  $\tt{\backslash}play\{this\}$.
\end{itemize}


\noindent
For instance, to display in red the text associated to the tag
{\tt this} above, you can either pass a color option to the play command:
\verb+\adviplay[red]{this}}+\\
\advirecord[play]{that}{\goon}\adviwait%
\textcolor {c1}{\adviplay {this}\adviplay {that}}\adviwait
{\adviplay{this}\adviplay {that}}\adviwait

\noindent
or place the command in the appropriate color environment:
to display the same text in green, type\\
\verb+\textcolor{green}{\adviplay{this}}+\\
\advirecord[play]{goon}{\goon}\adviwait
\textcolor{green}{\adviplay{this}\adviplay{goon}\adviwait}

\noindent
Using pauses and color settings, you can get
\advirecord[play]{this}{various}
\textcolor{red}{\adviplay{this}\adviplay{goon}}\adviwait
\advirecord[play]{this}{color (and fonts)}
\textcolor{c2}{\adviplay{this}\adviplay{goon}}\adviwait
\advirecord[play]{this}{effects}
\textcolor{c3}{\adviplay{this}\adviplay{goon}}\adviwait
\advirecord[play]{this}{in}
\textcolor{c4}{\adviplay{this}\adviplay{goon}}\adviwait
\advirecord[play]{this}{your}
\textcolor{c5}{\adviplay{this}\adviplay{goon}}\adviwait
\advirecord[play]{this}{texts}
\textcolor{c6}{\adviplay{this}\adviplay{goon}}\adviwait
\advirecord[play]{this}{!}\\
\textcolor{red}{\adviplay{this}\adviplay{goon}}\adviwait
Including some strange flashring effect!
\adviplay{goon}
\textcolor{c6}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c1}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c2}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c3}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c4}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c5}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c6}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c1}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c2}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c3}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c4}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c5}{\adviplay{this}}\adviwait[\smallpause]%
\textcolor{c6}{\adviplay{this}}\adviwait[\smallpause]%

\newpage

\subsection* {Embedded applications are easy to launch}

Any Unix command that obeys to the X geometry specifications may be
used to draw material in the {\ActiveDVI} window.
This is convenient to add a demo into your presentation.

\bigskip

\noindent
You launch a command using

\verb+\adviembed[width=w,height=h]{command -geometry !g -use !p}+

\noindent
where \verb"!g" specifies the required geometry, \verb"!p" the
{\ActiveDVI} window identifier, and \verb"w", \verb"h" the width \&
height of the rectangle where the application will draw its material.
Values of \verb"!p" and \verb"!g" are automatically computed by
{\ActiveDVI} and passed as arguments to the specified \verb"command".
 Examples:

\begin{itemize}
\item The \verb"display" command (from ImageMagick) can show any image into your
presentation using:\\
\verb|\adviembed[width=3cm,height=3.3cm]|\\
\verb|          {display -geometry !g! -window !p logo.gif}|\\
\adviembed[width=3cm, height=3.3260869cm]{display -geometry !g! -window !p advilogo.gif}

\item Similarly, \verb|animate| can display animations:\\
        \verb|\adviembed[width=2cm,height=2cm]|\\
        \verb|          {animate -geometry !g! -window !p anim.gif}|\\
        \adviembed[width=2cm,height=2cm]{animate -geometry !g! -window !p mmm.anim.gif}
\end{itemize}

% \newpage
% 
% \begin{center}
% {\large\bf I have four words for you!}\\[3mm]
% 
% \adviembed[width=10.62cm,height=7.92cm]{xanim +W!p +Sx!w +Sy!h +Zpe -Zr dancemonkeyboy.avi}
% \end{center}

\newpage

\subsection* {Embedded applications (cont.)}

\begin{itemize}
  \item Any application which has enbedding options like\\
   \verb+\adviembed[width=w,height=h]{prog -geometry !g -use !p}+\\
   For instance (using wish)\\
   \verb|\adviembed[persistent,width=5cm,height=1cm]|\\
   \verb|          {wish ./watch -geometry !g -use !p}|\\
   \adviembed[persistent,width=5cm,height=0.71cm]{wish ./watch -geometry !g -use !p}
\adviwait
  \item Possibly interactive ! (using CamlTk)\\
   \verb|\adviembed[persistent,width=6.5cm,height=9.5cm]|\\
   \verb|          {./taquin -geometry !g -use !p dojoji.gif}|\\
  \adviembed[persistent=taquin,width=8.5cm,height=10cm]{./taquin.sh -geometry !g -use !p dojoji.gif}

\end{itemize}

\newpage

\subsection* {Embedded applications (cont.)}

If we cannot specify the parent window of X applications,
they will be handled by the window manager.
Depending the WM, 
their placements may not obey your geometry specifications.
(Think about disabling ``remember window positions'' option of your WM.)

\begin{itemize}
 \item Xeyes using the macro command \verb|embed|:\\
   \verb|\adviembed[width=2cm,height=2cm]{xeyes -bw 0 -shape -geometry !g}|\\
   \adviembed[width=2cm,height=2cm]{xeyes -bw 0 -shape -geometry !g}

 \item An Xterm running an interesting application:\\
   \verb|\adviembed[width=10cm,height=5cm]{xterm -geometry 50x7+!x+!y -e ocaml}|\\
   \adviembed[width=10cm,height=4cm]{xterm -geometry 50x7+!x+!y -e ocaml}
\end{itemize}

The \verb|embed| macro can launch any executable system command during
the presentation. 
\begin{itemize}
 \item You can add music to your presentation, if you have a music
  player available:\\
  \verb|\adviembed[width=1mm,height=1mm]{mpg123 -q music.mp3}|
\end{itemize}

\advirecord{play}
 {\adviembed[name=mpg123,width=1mm,height=1mm]{mpg123 -q music.mp3}}
\advirecord {stop}
 {\advikillembed {mpg123}}
\advianchor[click]{play}{Play}
\advianchor[click]{stop}{Stop}

\newpage

\subsection* {Limitations of Postscript specials}

{\ActiveDVI} recognizes and renders Postscript Specials by calling and telling
\verb"ghostview" to display Postscript on the \verb"advi" window. 
Hence, images drawn using PS tricks will be displayed by \verb"advi". 

However, PS tricks make the assumptions that everything is displayed by
Postscript, which is still \verb"advi" displaying most of the material
itself. 

\subsubsection* {Most PS-tricks do work}
\begin {itemize}

\item[+]
Simple drawings work

\item[+] 
{\tt\string\SpecialCoor} works, {\em i.e.} commands of the form
{\tt \string \rput \{A\}\{bla bla\}} works where {\tt A} is a node

\item[+]
Connections between nodes {\tt \string \ncarc}, {\tt \string \ncarc},
also works.
\end {itemize}

\subsubsection* {Unfortunately, some PS-tricks do not work, yet}
\begin{itemize}
\item[-]
Labels over arrows \verb"\Aput", \verb"Bput", etc.
(they change the Postscript coordinates...)

\item[-]
{\tt pspicture}
(idem, but drawings that are not embedded in pspictures works)

\item[-]
Advi only recognizes binary overlays (display if 0, hide otherwise). 
This is sufficient for the proper documentclass
(see \hyperlink {overlays}{below}).

\end {itemize}



\subsection*{Known bug with PS tricks}

With some versions of \verb"gv" and/or \verb"X11", the PS tricks are not
correctly synchronized. Some drawings may hide text, or conversely.


% Examples: 

% \Rnode {A}{A} \qquad \Rnode {B}{B}
% \ncline{->}{A}{B} \Aput{L}

\newpage

\subsection* {Overlays}
\hypertarget {overlays}{}

Overlays of the \verb"seminar" mode uses PS tricks, but in a manner that
requires characters to be also printed as Postscript. The \verb"advi" package 
redefines \verb"\overlay" so that it draws only the first overlay (and
ignore others).

Hence, \verb"advi" cannot be used to preview slides using \verb"seminar"
overlays. However, a better package for overlays (build on top of seminar)
is \verb"prosper", which only uses the ability to show or hide some
material, which works well with \verb"advi".

Some reimplementation of \verb"\overlay" for \verb"advi" to work with 
seminar overlays might still be possible...  

\subsection* {Ignore mode}

The package \verb"advi" can be loaded with the \verb"batch" option:

\smallskip
{\verb"\usepackage[ignore]{advi}"}
\smallskip

The effect is to switch off some \verb"advi" gadgets and to render some others 
in Postscript, if possible. 

\newpage

\subsection* {Hyper links to other files}

\begin {itemize}

\item (recursive) link to \hyperref{demo.dvi}{}{overlays}{\tt demo.dvi}
produced by

\qquad\verb"\hyperref{demo.dvi}{}{overlays}{\tt demo.dvi}"

A click opens file \verb"demo.dvi" with a new \verb"advi" and jumps to the
link \verb"overlays" in that file, as if the command

\qquad\verb"advi -html overlays demo.dvi"

had been typed in a shell.

\item the source file of this demo is \hyperref{demo.tex}{}{}{\tt
demo.tex}. A link to it is produced by

\qquad\verb"\hyperref{demo.tex}{}{}{\tt more demo.tex}"

A click on the link opens the file in a new window, as if 

\qquad\verb"less demo.tex"

had been typed in a shell.

\item Currently, the file name should end with either \verb".dvi",
\verb".txt", \verb".tex", \verb".htm", or \verb".html" extensions, but
in the future this should use Mine man Mailcap to find the type of the
file and the previewer for that file.

\item Issue a warning if the extension is not recognized or the file
is non-existent:
\hyperref{nonexistent.dvi}{}{}{\tt nonexistent.dvi}
or
\hyperref{../tex/advi.sty}{}{}{\tt ../tex/advi.sty}

\end {itemize}

\newpage

\subsection* {Combination of replays and PS tricks}

Replay can be used to hide or show text or to change the color of text. 
However, postscript colors are hard-wired by {\TeX}, {\em i.e.} they are not
interpreted in the current color context as font colors. 

Replay can still be used to simulate replay of Postscript colors: instead, 
two identical figures can be superposed. For instance, 
$$
\psset {linestyle=none,fillstyle=solid}
\rlap
{\advirecord{tagb}{\ovalnode [fillcolor=green]{A}{\textbf {Postscript}}}}%
\advirecord[play]{taga}{\ovalnode [fillcolor=yellow]{B}{\textbf {Postscript}}}
$$
will  be rendered by
\begin{verbatim}
  \psset {linestyle=none,fillstyle=solid}
  \def \PS {\textbf {Postscript}}
  \rlap {\advirecord{tagb}{\ovalnode [fillcolor=green]{A}{\PS}}}%
  \advirecord[play]{taga}{\ovalnode [fillcolor=yellow]{B}{\PS}}}
\end{verbatim}
\begin {enumerate}

\item
Type space to change the text color. 
\adviwait \textcolor{red}{\adviplay{taga}}
\begin{verbatim}
    \adviwait \textcolor{red}{\adviplay{taga}}
\end{verbatim}

\item
Type space to change the background.
\adviwait\textcolor{red}{\adviplay{tagb}}
\begin{verbatim}
    \adviwait\textcolor{red}{\adviplay{tagb}}
\end{verbatim}

\end {enumerate}

\newpage

\subsection*{Active anchors}

Active anchors are much alike html anchors, except that instead of
jumping to a reference anchors (usually at another page), definitely, they 
allow to play a previously recorded piece of dvi when the mouse is over the
anchor region. The page is saved and reset to its normal shape when the mouse
leaves the anchor region. 

For instance, scratch those stamps with the mouse to see how much you win.
$$
\ovalnode [linestyle=none,fillstyle=solid,fillcolor=yellow]{A}
  {\advirecord {A}{\textbf {10000}}}
\advianchor{A}{\adviplay[yellow]{A}}
\hspace {4em}
\def \i{\textcolor{green}{.}}
\ovalnode [linestyle=none,fillstyle=solid,fillcolor=green]{B}
  {\advirecord {B}{\i\textbf{Lost}!\i}}
\advianchor{B}{\adviplay[green]{B}}
$$
For instance, the left game was typeset as
{\small
\begin{verbatim}
\ovalnode [linestyle=none,fillstyle=solid,fillcolor=yellow]{A}
  {\advirecord {A}{\textbf {10000}}}
\advianchor{A}{\adviplay[yellow]{A}}
\end{verbatim}}%

\medskip
\noindent
The effect of active anchors can also be 
\advianchor{C}{delocalized}.

\SpecialCoor
\advirecord {C}
  {\ncarc[linecolor=red,arcangleA=50,arcangleB=50,linewidth=3pt]
         {<->}{A}{B}%\Aput{Fire!}
}


\noindent
Another form of
\begin{superpose}
\advirecord[play]{a1}{\advianchor{a2}{simple}}\\
\advirecord{a2}{\adviplay[white]{a1}\colorbox{yellow}{ cool }}
\end{superpose}
simple annotations is the overriding of
\begin{superpose}
\advianchor{7}{words}\\
\advirecord{7}{\adviplay[white]{6}\colorbox{white}{{by text}}}\\
\end{superpose}
or by little 
\begin{superpose}
\advirecord[play]{1}{pieces \advianchor{2}{of} text}\\
\advirecord{2}{\colorbox{white}{\begin{tabular}{@{}l@{}}
inner tabular\\ should be between\\ parentheses\end{tabular}}}\\
\advirecord{3}{The \qquad End}
\end{superpose}

\newpage

\subsection*{\adviannot{Active Annotations}(2,1.5){Annotations \\are great!}}

\noindent
\adviannot[p=9em]{Active anchors}(1,1.5)
{\centering Active anchors are even greater!}
can also be used to annotate \adviannot[C,bg=green]{text}{text=t+e+x+t} as
here, \adviannot{for instance}[linecolor=red](-1.5,1){for example}. 

\medskip

\noindent
These annotations have been typeset respectively as:
\begin{small}
\begin{verbatim}
\adviannot{Active Annotations}(2,1.5){Annotations \\are great!}

\adviannot[p=9em]{Active anchors}(1,1.5)
   {\centering Active anchors are even greater!}

\adviannot[C,bg=green]{text}{text=+t+e+x+t}

\adviannot[C]{for instance}[linecolor=red](-1.5,1){for example?}
\end{verbatim}
\end{small}

\subsection*{Note}

The command 
\begin{quote}

\verb"\usepackage{advi}"

\verb"\usepackage{advi-annot}"

\end{quote}
must appear after other packages that uses PS tricks, since it redefines
some macros.  The package \verb"advi-annot" is necessary to get
the annotation macros.

\newpage

\subsection*{Superpose Package}

This very small package allows the superosing of boxes, making the
surrounding box so that it fits all included boxes. This is convenient
when displayin each included box at different pauses.

Movie...
\advirecord{0}{\colorbox{white}
{\begin{superpose}
\advirecord{1}{Begin}\\
\advirecord{2}{{\begin{tabular}{@{}l@{}}
inner tabular\\ should be between\\ parentheses\end{tabular}}}\\
\advirecord{3}{The End}
\end{superpose}}}
end
\adviplay{1}
\adviwait\adviplay{0}\adviplay{2}
\adviwait\adviplay{0}\adviplay{3}

\newpage

\subsection*{Pictures for \TeX}

{\ActiveDVI} can display pictures for \TeX, as generated by
the \verb"gpic" command into a list of \TeX~ \verb"\special" commands.

\bigskip

To obtain a figure, you first write commands for the language
{\em pic} into a file; from this pic file, you can generate a \TeX
file using a {\em pic compiler}, e.g. \verb"gpic"; then include this
compiled file into your presentation, and {\ActiveDVI} will nicely display it.

Let's consider the \verb"pic" source file \verb"trigo.pic" given
\hyperref{trigo_source.dvi}{}{}{here}; we obtain
\verb"trigo.tex" using the command 
\begin{verbatim}
gpic -t trigo.pic > trigo.tex
\end{verbatim}

Then we include \verb"trigo.tex" with the \TeX command
\verb|\input{trigo}| and get:

\def\showgraph{%
  \par\medskip\centerline{\raise 1em\box\graph}\bigskip\noindent\ignorespaces}

\input{trigo}

See the \verb"gpic" command manual for more information about
\verb"gpic" and the programming language \verb"pic".

\lastpage

~\vfill
\begin{center}
\includegraphics[width=0.5\textwidth]{../tex/advilogo.eps}\\
{\Large \bf That's all, folks!!}
\end{center}
\vfill

\end{document}
