<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%%
%% This is the original source file advi.sty
%%
%% Package `advi' to use with LaTeX 2e
%% Copyright Roberto Di Cosmo, Jun Furuse, Didier Remy, and Pierre Weis
%% All rights reserved.

% Which name is ours
\def \ActiveDVI {Active-DVI}

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{advi}
         [2001/29/08 v0.40 Advi Package for advi Previewer]

%%

%% Identification
%% Preliminary declarations

\RequirePackage {keyval}

%% Options

\newif \ifadvi@ignore \advi@ignorefalse
\DeclareOption {ignore}{\advi@ignoretrue}

\ProcessOptions
% \@ifundefined {AdviOptions}{}{\ExecuteOptions {\AdviOptions}}

%% More declarations

% Auxilliary macros


\def \advi@empty{}
\def \advi@ifempty #1{\def \@test {#1}\ifx \@test \advi@empty 
  \expandafter \@firstoftwo \else \expandafter \@secondoftwo \fi}
\def \advi@error #1{\PackageError {Advi}{#1}{Type &lt;RETURN&gt; to proceed.}}
\def \advi@warning #1{\PackageWarning {Advi}{#1}}
\def \advi@undefinedenv {\advi@error {Environment \@currenvir\space undefined.
Maybe you mean \@currenvir ing}}
\def \advi@special@ {\advi@ifadvi{\special}{\advi@ignore}}
\def \advi@special #1{\advi@special@ {advi: #1}}
\def \advi@export #1#2{\@ifdefinable #1{\let #1#2}}
\def \advi@exportenv #1#2{%
  \@ifundefined {#1}{\expandafter \let \csname #1\expandafter \endcsname
                     \csname end#1\endcsname }\relax  
  \expandafter \@ifdefinable \csname #1\endcsname
  {\expandafter \let \csname #1\expandafter \endcsname \csname #2\endcsname
   \expandafter \let \csname end#1\expandafter \endcsname 
        \csname end#2\endcsname}}

\def \advi@ignore #1{}
\def \advi@id #1{#1}

\def \advi@ifadvi {\ifadvi@ignore
  \expandafter \@secondoftwo \else \expandafter \@firstoftwo \fi}
\advi@export \adviignore \advi@ignoretrue
\advi@export \ifadvi \advi@ifadvi

%%% Record and play

\newif \ifadvi@recording 
\def \advi@ifrecording {\ifadvi@recording
   \expandafter \@firstoftwo \else \expandafter \@secondoftwo \fi}
\def \advi@ifrecordenv {\ifx \@currenvir \advi@recordenv
   \expandafter \@firstoftwo \else \expandafter \@secondoftwo \fi}

\def \advi@start {start}
\def \advi@startplay {start play}
\define@key{advi@record}{play}[]{\let \advi@do \advi@startplay}
\def \advi@recordenv {advirecord}

\newenvironment{advi@recording}[2][]%
  {\begingroup
     \let \advi@do \advi@start \setkeys{advi@record}{#1}%
     \advi@special {proc=#2 record=\advi@do}%
   \endgroup}
  {\advi@special {proc record=end}}
\newcommand {\advi@record}[3][]{\advi@recording[#1]{#2}#3\endadvi@recording}

\newcommand {\advi@play}[2][]%
   {\begingroup
      \advi@ifempty{#1}{}{\color {#1}}{\advi@special {proc=#2 play}}%
    \endgroup}

\advi@exportenv {advirecording}{advi@recording} 
\advi@export \advirecord \advi@record
\let \endadvirecord \advi@undefinedenv
\advi@export \adviplay \advi@play


%%% Embedded applications

\def \advi@embed@name{anonymous}
\def \advi@embed@mode{ephemeral}
\def \advi@embed@width{0pt}
\def \advi@embed@height{0pt}
\define@key {advi@embed}{name}{\def \advi@embed@name {#1}}
\define@key {advi@embed}{width}%
   {\@tempdima#1\relax \edef \advi@embed@width {\the\@tempdima}}
\define@key {advi@embed}{height}%
   {\@tempdima#1\relax \edef \advi@embed@height {\the\@tempdima}}
\def \advi@definemode #1{%
  \define@key {advi@embed}{#1}[anonymous]{%
     \def \advi@embed@mode {#1}\def\advi@embed@name {##1}%
  }}
\advi@definemode{ephemeral}
\advi@definemode{persistent}
\advi@definemode{sticky}

\def \advi@embed@ #1#2#3#4#5{%
  \mbox{\advi@special
          {embed name="#1" mode=#2 width=#3 height=#4 command="#5"}%
          {\vbox to #4{\hbox to #3{}}}}}
\def \advi@length #1{\@tempdima #1\relax \the\@tempdima}
\newcommand{\advi@embed}[2][]{%
  \mbox {\setkeys {advi@embed}{#1}%
         \advi@embed@ {\advi@embed@name}{\advi@embed@mode}
             {\advi@embed@width}{\advi@embed@height}{#2}}}

\newcommand{\advi@killembed}[2][]{\advi@special {kill name="#2" signal="#1"}}

\advi@export \adviembed \advi@embed

\advi@export \advikillembed \advi@killembed 


%%% Background colors and images

\def \do #1{\expandafter \def \csname advi@geom@#1@\endcsname {#1}}
\do {center}
\do {left}
\do {right}
\do {bottom}
\do {top}
\do {topleft}
\do {topright}
\do {bottomleft}
\do {bottomright}
\let \do \relax
\def \advi@ifnine #1#2#3{\@ifundefined {advi@geom@#1@}{#3}{#2}}

\let \advi@global \relax
\def \advi@global@ {global}
\newif \ifadvi@bgactive

\def \advi@bg@do
 {\do\advi@bgcolor \do\advi@bgimage \do \advi@bgalpha \do\advi@bgblend}
\def \advi@auto@ { fit=auto}
\def \advi@bgreset 
 {\def \do ##1{\expandafter \advi@global
                  \expandafter \let \noexpand ##1\advi@empty}\advi@bg@do
  \advi@global \let \advi@bgfit \advi@auto@
  \advi@global \advi@bgactivefalse}
\advi@bgreset

\def \advi@none@ {none}
\def \advi@ifnone #1{\def \@test{#1}\ifx \@test \advi@none@
  \let \@test \advi@empty \fi \ifx \@test \advi@empty
  \expandafter \@firstoftwo \else \expandafter \@secondoftwo \fi}

\def \advi@setbg #1#2#3{\advi@ifnone {#1}
  {\advi@global \expandafter \let \noexpand #1\advi@empty}
  {\advi@global \expandafter \def \noexpand #1{ #2=#3}%
   \advi@global \advi@bgactivetrue}}
\define@key {advi@bg}{color}[]{\advi@setbg{\advi@bgcolor}{color}{#1}}
\define@key {advi@bg}{image}[]{\advi@setbg{\advi@bgimage}{image}{#1}}
\define@key {advi@bg}{alpha}[]{\advi@setbg{\advi@bgalpha}{alpha}{#1}}
\define@key {advi@bg}{blend}[]{\advi@setbg{\advi@bgblend}{blend}{#1}}
\define@key {advi@bg}{fit}[auto]{\def \advi@bgfit {#1}%
     \ifx \advi@bgfit \advi@auto@ \else
     \advi@ifnine {\advi@bgfit}
       {\advi@global \def \advi@bgfit{ fit=#1}}
       {\advi@error {Ill formed background fit=#1}}%
   \fi}
\def \advi@bgset #1{\advi@ifnone {#1}{\advi@bgreset}{\setkeys {advi@bg}{#1}}}

%\define@key {advi@bg}{inherit}[]{\advi@special{setbg inherit}}

\def \advi@bgemit 
  {\advi@special 
     {setbg \advi@bgcolor \advi@bgimage \advi@bgalpha \advi@bgblend
      \advi@bgfit
      }}
\newif \ifadvi@bglocal

\newcommand{\advi@bg}[2][]{%
  \begingroup 
  \def \@test {#1}\ifx \@test \advi@global@ \let \advi@global \global
  \advi@bgset {#2}\else
  \ifx \@test \advi@empty \else \advi@warning
     {Optional argument [#1] to \string \advibg ignored}\fi
  \global \advi@bglocaltrue
  \advi@bgset{#2}\advi@bgemit \fi
  \endgroup}
\def \advi@bgpage
   {\ifadvi@bgactive \ifadvi@bglocal\else \advi@bgemit \fi\fi
    \global \advi@bglocalfalse}

\advi@export \advibg \advi@bg

%%% Pausing and waiting

\def\advi@pause {\advi@special{pause}}
\def\advi@wait#1{\advi@special{wait sec=#1}}

%% export
\newcommand {\adviwait}[1][]%
   {\advi@ifempty {#1}{\advi@pause}{\advi@wait {#1}}}

%%% Transparency and alpha blending
%%% To be revisited. 

\def\advi@epstransparent
   {\advi@special{epstransparent push true}%
    \aftergroup \advi@resetepstransparent} 
\def\advi@epswhite
   {\advi@special{epstransparent push false}%
    \aftergroup \advi@resetepstransparent} 
\def\advi@setalpha#1%
   {\advi@special{alpha push #1}%
    \aftergroup \advi@resetalpha} 
\def\advi@setblend#1%
   {\advi@special{blend push #1}%
    \aftergroup\advi@resetblend}
\def\advi@resetepstransparent {\advi@special{epstransparent pop}}
\def\advi@resetalpha {\advi@special{alpha pop}}
\def\advi@resetblend {\advi@special{blend pop}}

\advi@export \epstransparent \advi@epstransparent
\advi@export \epswhite \advi@epswhite
\advi@export \setalpha \advi@setalpha
\advi@export \setblend \advi@setblend

%%% Animated transitions

\def \advi@transfrom{}
\def \advi@transsteps{}
\def \advi@settrans {\advi@global \def}
\define@key {advi@trans}{none} []{\advi@settrans \advi@transmode {none}}
\define@key {advi@trans}{slide}[]{\advi@settrans \advi@transmode {slide}}
\define@key {advi@trans}{block}[]{\advi@settrans \advi@transmode {block}}
\define@key {advi@trans}{wipe} []{\advi@settrans \advi@transmode {wipe}}
\define@key {advi@trans}{from} {\advi@settrans \advi@transfrom { from=#1}}
\define@key {advi@trans}{steps}{\advi@settrans \advi@transsteps { steps=#1}}

\def \advi@transemit
   {\advi@special{trans \advi@transmode \advi@transfrom \advi@transsteps}}
\newif \ifadvi@translocal 
\newcommand {\advi@transition}[2][]{%
  \begingroup
     \def \@test {#1}\ifx \@test \advi@global@ \let \advi@global \global
     \setkeys {advi@trans}{#2}\else
     \ifx \@test \advi@empty \else \advi@warning
        {Optional argument [#1] to \string \advitransition ignored}\fi
     \global \advi@translocaltrue
     \setkeys {advi@trans}{#2}\advi@transemit \fi
  \endgroup}

\def \advi@transpage
  {\@ifundefined {advi@transmode}{}
        {\ifadvi@translocal\else \advi@transemit \fi}%
   \global \advi@translocalfalse}

%% Hook \advi@setpagesetyle at \@begindvi that run at every page

\def \advi@setpagestyle {\advi@bgpage \advi@transpage}
\def \endpage@hook {}
\def \AtEndPage {\g@addto@macro \endpage@hook}
\AtEndPage {\advi@setpagestyle}

% We must patch \@begindvi to put out hook. 
% However, hyperref may patch it as well. So we should do it at begin
% document to have the control (no one after us). 
% Howver, one must be careful, because \@begindvi redefines itself at the
% first call to its prerecorded final value. 
% So our first patch will be overridden with the value that it was
% meant to have after the first page.
% Hence, we patch it a second time to put our hook to this final value. 

% we can use \g@addto@macro which redefines #1 to so that it procedes as 
% before and then execute #2 at the end. 

\def \advi@begindvi@patch
  {\g@addto@macro \@begindvi      
      {\endpage@hook \g@addto@macro \@begindvi {\endpage@hook}}}

\AtBeginDocument {\advi@begindvi@patch}

%  {\let \advi@begindvi@save \@begindvi   %% value at begindocument
%   \def \@begindvi                       %% our new value
%     {\advi@begindvi@save                %% may redefine \@begindvi
%      \global\let \advi@begindvi@save    %% so we this new value
%         \@begindvi                      
%      \gdef \@begindvi                   %% now and forever
%         {\advi@begindvi@save \endpage@hook}%
%      \endpage@hook                      %% our hook for the
%     }}



%% Transitions

\def\advi@transbox@save#1#2#3{\advi@special
  {transbox save width=#1 height=#2 depth=#3}}
\def\advi@transbox@go#1{\advi@special{transbox go #1}}

\def \advi@transslide {slide}
\def \advi@transbox #1{%
   \def \advi@afterbox 
      {\hbox {\advi@transbox@save{\the\wd0 }{\the\ht0 }{\the\dp0}%
              \unhbox0\setkeys {advi@trans}{#1}%
              \advi@transbox@go
                  {\advi@transmode \advi@transfrom \advi@transsteps}}}%
   \def \advi@@afterbox {\aftergroup \advi@afterbox} 
   \afterassignment \advi@@afterbox \setbox0 \hbox } 

\advi@export \advitransition \advi@transition
\advi@export \advitransbox \advi@transbox

%%% For PS Tricks

\def \advi@moveto {\advi@special {moveto}}
\def\advi@psput@special#1{%
\hbox{%
\pst@Verb{{ \pst@coor }  
dup exec 2 copy moveto advi@Dict begin printpos end
\tx@PutCoor 
\tx@PutBegin}
\hbox {\advi@moveto \box#1}%
\pst@Verb{\tx@PutEnd}}}

\def\advi@ncput@iii{%
\leavevmode
\hbox{%
\pst@Verb{%
\pst@nodedict
/t \psk@npos def
tx@NodeDict /LPutPos known { LPutPos } { CP /Y ED /X ED /NAngle 0
def } ifelse 
LPutCoor 
end
\tx@PutBegin
}%
\hbox {\box\pst@hbox}%
\pst@Verb{\tx@PutEnd}}}

\def \advi@pstricks@patch
  {\@ifundefined {psput@special}{}
    {\let \psput@special \advi@psput@special
     %\@ifundefined {ncput@iii}{}{\let \ncput@iii \advi@ncput@iii}%
     \pstheader {advi.pro}}}
\AtBeginDocument {\advi@pstricks@patch}


%%% Active DVI

\def \advi@over@ {over}
\def \advi@click@ {click}
\def \advi@null {\hbox {}}

\newenvironment {advi@anchoring}[2][over]{%
   \begingroup
   \def \@test {#1}\ifx \@test \advi@over@ 
       \advi@special@ {html:&lt;a advi="#2"&gt;}\else
   \ifx \@test \advi@click@ 
       \advi@special@ {html:&lt;a hdvi="#2"&gt;}\else
   \advi@error {Incorect anchor mode #1}\fi \fi\endgroup}
  {\advi@special@ {html:&lt;/a&gt;}}
\newcommand {\advi@anchor}[3][over]%
   {\advi@anchoring[#1]{#2}#3\endadvi@anchoring}

\def \advi@endanchor #1{#1\endadvi@anchor \endgroup}
\advi@exportenv {advianchoring}{advi@anchoring}
\advi@export \advianchor \advi@anchor
\let \endadvianchor \advi@undefinedenv

%%% Partial patch for overlays -- 0 will be shown &gt; 0 will not be shown

\def \advi@max {0}
\def \advi@overlay #1{%
  \advi@ifadvi 
    {%\advance \c@overlay by 1
     \ifnum \c@overlay&gt;\advi@max \global \xdef \advi@max {\the \c@overlay}\fi
     \advi@recording {overlay@#1}\aftergroup \endadvi@recording}
    {\latex@overlay {#1}}}

\def \advi@overlay@loop
 {\advi@ifadvi 
  {\begingroup
    \c@overlay=0
    \@whilenum\c@overlay&lt;\advi@max
    \do {\advance \c@overlay  by 1%
         \adviwait \adviplay{overlay@\the\c@overlay}}%
  \endgroup
  \gdef \advi@max {0}}
 {\latex@overlay@loop}}

\def \advi@end@slide 
  {\advi@ifadvi {\overlay@loop}{}\latex@end@slide}

\def \advi@overlay@patch {%
   \let \latex@overlay \@overlay
   \let \latex@end@slide \end@slide
   \let \latex@overlay@loop \overlay@loop
   \let \@overlay \advi@overlay
   \let \overlay@loop \advi@overlay@loop
   \let \end@slide \advi@end@slide
  }

\@ifundefined {overlay}{}
   {\AtBeginDocument {\advi@overlay@patch}}


\endinput
</pre></body></html>