%%
%% This is file `watermark.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% watermark.dtx 
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from watermark.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file watermark.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% File: watermark.dtx Copyright (C) 2002--2004 by Alexander I. Rozhenko
%%
\AtBeginDocument{
  \let\WMK@begindvi\@begindvi
  \def\@begindvi{%
    \WMK@begindvi
    \WMK@insert
    \global\let\WMK@begindvi\@begindvi
    \gdef\@begindvi{\WMK@begindvi\WMK@insert}%
  }%
}
\def\WMK@insert{%
  \let\WMK@head\@thehead
  \def\@thehead{\WMK@hook\WMK@head}%
}
\def\WMK@hook{%
  \begin{picture}(0,0)\relax
    \ifx\WMK@this\relax
      \if@twoside
        \ifodd\c@page\WMK@odd\else\WMK@even\fi
      \else
        \WMK@odd
      \fi
    \else
      \WMK@this \global\let\WMK@this\relax
    \fi
  \end{picture}%
  \ifx\WMK@thishead\relax \else
    \let\WMK@head\WMK@thishead
    \global\let\WMK@thishead\relax
  \fi
  \ifx\WMK@head\@empty \hfil
  \else
    \def\@tempa{\@oddhead}%
    \ifx\WMK@head\@tempa
      \ifx\@oddhead\@empty \hfil \fi
    \fi
  \fi
}
\let\WMK@thishead\relax
\let\WMK@this\relax
\let\WMK@odd\@empty
\let\WMK@even\@empty
\newcommand{\watermark}[1]{\leftwatermark{#1}\rightwatermark{#1}}
\newcommand{\leftwatermark}[1]{\gdef\WMK@even{#1}}
\newcommand{\rightwatermark}[1]{\gdef\WMK@odd{#1}}
\newcommand{\thiswatermark}[1]{\gdef\WMK@this{#1}}
\newcommand{\thispageheading}[1]{%
  \def\@tempa{#1}%
  \ifx\@tempa\@empty
    \global\let\WMK@thishead\@empty
  \else
    \gdef\WMK@thishead{\parbox[t]\textwidth{#1}}%
  \fi
}
\endinput
%%
%% End of file `watermark.sty'.
