%
%  Draftcopy_HAT:
%  	prints "draft" across the top of pages, rather than at the bottom.
%
%    -> Use [bottom,none] options to obtain a band across the top of the 
%       page but no large diagonal watermark
%
%


%%
%% This is file `draftcopy.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% draftcopy.doc  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from draftcopy.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file draftcopy.doc.
%% 
%% 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.)
\iffalse
%% Package draftcopy to use with LaTeX2e
%% This package is used to print on some pages the word `DRAFT'
%% (or the language dependend analogon) ``behind'' the intended stuff.
%%
%% Copyright (C) 1995 Dr. Juergen Vollmer
%%                    Viktoriastrasse 15, D-76133 Karlsruhe, Germany
%%                    Juergen.Vollmer@acm.org
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt; either
%% version 1 of the License, or any later version.
%%
%% If you find this software useful, please send me a postcard:
\fi







\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{draftcopy_HAT}
%  A modification of "draftcopy.sty [2002/02/25 v2.16]" that prints
%  the "bottom" banner at the top of the page.

\newif\ifdraftcopy@conditional
\newif\ifdraftcopy@draft
\newif\ifdraftcopy@final
\DeclareOption{conditional}{
  \draftcopy@conditionaltrue
}
\DeclareOption{draft}{
  \draftcopy@drafttrue
}
\DeclareOption{final}{
  \draftcopy@finaltrue
}

\def\draftcopy@Timestamp{}
\def\draftcopy@version{}
\newcount\draftcopy@hour \newcount\draftcopy@minute
\draftcopy@hour=\time
\divide \draftcopy@hour by 60
\draftcopy@minute=\time
\count@=\draftcopy@hour
\multiply \count@ by -60
\advance \draftcopy@minute by \count@
\newcommand{\draftcopy@daytime}{%
   \ifnum\draftcopy@hour=0 00\else\ifnum\draftcopy@hour<10 0\fi%
   \number\draftcopy@hour\fi:%
  \ifnum\draftcopy@minute<10 0\fi\number\draftcopy@minute%
}

\DeclareOption{timestamp}{
   \def\draftcopy@Timestamp{%
   \draftcopy@Show
   \draftcopy@PageX \draftcopy@PageY -40 add moveto
   /Times-Roman findfont 50 \draftcopy@ScaleFactor mul scalefont setfont
   (\draftcopy@version \today -- \draftcopy@daytime)
   }
}

  % VTEX-support: Thanks to "MicroPress Inc." <support@micropress-inc.com>
\let\immediate@special=\special
\DeclareOption{vtex}{
  \def\immediate@special{\immediate\special}
  \immediate@special{!bophook bop-hook}
  \def\draftcopy@BOPhook{/bop-hook}
  \def\draftcopy@UserDictCmd{pS: userdict }
  % MV & AK <mv@micropress-inc.com>
}
\DeclareOption{dvips}{
  \def\draftcopy@BOPhook{/bop-hook}
  \def\draftcopy@UserDictCmd{! userdict }
}
\DeclareOption{dvipsone}{
  % thanks to V. P. Stokes <virgil.stokes@neuro.ki.se>
  % thanks to Y&Y Help Line <support@YandY.com>
  % thanks to "H. Salehfar" <hsalehfa@sage.und.nodak.edu>
 \def\draftcopy@BOPhook{/bphook}
 \def\draftcopy@UserDictCmd{! dvidict}
}
\DeclareOption{textures}{
  % thanks to Jerome LAURENS \texttt{laurens@u-bourgogne.fr>
  \def\draftcopy@BOPhook{/bop-hook}
  \def\draftcopy@UserDictCmd{prepostscript userdict}
}

\DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}}

\DeclareOption{xdvi}{\ExecuteOptions{dvips}}
\DeclareOption{dvi2ps}{\ExecuteOptions{dvips}}
\DeclareOption{dvialw}{\ExecuteOptions{dvips}}
\DeclareOption{dvilaser}{\ExecuteOptions{dvips}}
\DeclareOption{dvitops}{\ExecuteOptions{dvips}}
\DeclareOption{emtex}{\ExecuteOptions{dvips}}
\DeclareOption{dviwin}{\ExecuteOptions{dvips}}
\DeclareOption{oztex}{\ExecuteOptions{dvips}}
\DeclareOption{psprint}{\ExecuteOptions{dvips}}
\DeclareOption{pubps}{\ExecuteOptions{dvips}}
\DeclareOption{pctexps}{\ExecuteOptions{dvips}}
\DeclareOption{pctexwin}{\ExecuteOptions{dvips}}
\DeclareOption{pctexhp}{\ExecuteOptions{dvips}}
\DeclareOption{ln}{\ExecuteOptions{dvips}}


\def\draftcopy@Show{show }
\DeclareOption{outline}{
  \def\draftcopy@Show{false charpath 2 setlinewidth stroke }
}


\DeclareOption{light}{
    \def\draftcopy@GrayValue{0.90}
}

\DeclareOption{dark}{
    \def\draftcopy@GrayValue{0.85}
}

\DeclareOption{none}{
  \def\draftcopy@LastPage{0}
}
\DeclareOption{first}{
  \def\draftcopy@LastPage{1}
}
\DeclareOption{firsttwo}{
  \def\draftcopy@LastPage{2}
}
\DeclareOption{all}{
  \def\draftcopy@LastPage{99999}
}

\newif\ifdraftcopy@bottom
\DeclareOption{bottom}{
  \draftcopy@bottomtrue
}

\newif\ifdraftcopy@bottomAfter
\DeclareOption{bottomafter}{
  \draftcopy@bottomAftertrue
}

\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
\def\draftcopy@Font{/Times-Roman}
\DeclareOption{american}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{austrian}{
  \def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155}
}
\DeclareOption{bahasa}{
  % thanks to Glenn G. Chappell <gchappell@semovm.semo.edu>
  \def\draftcopy@Name{DRAF}\def\draftcopy@Scale{217}
}
\DeclareOption{brazil}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{brazilian}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{breton}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{british}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{catalan}{
  % thanks to Dav <davpuig@mx3.redestb.es>
  % thanks to Xavier <xml@mat.upc.es>
  \def\draftcopy@Name{ESBORRANY}\def\draftcopy@Scale{110}
}
\DeclareOption{croatian}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{czech}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{danish}{
  % thanks to Ejnar Zacho Rath <ezr@md-oss.dk>,
  % thanks to Bjarne Vestergaard <bvbruder@dfi.aau.dk>
  % thanks to Joergen Larsen <JL@mmf.ruc.dk>
  \def\draftcopy@Name{UDKAST}\def\draftcopy@Scale{175}
}
\DeclareOption{dutch}{
  % thanks to Kees Leune <C.J.Leune@kub.nl>
  % \def\draftcopy@Name{CONCEPT}\def\draftcopy@Scale{150}
  % thanks to Anton Stoorvogel <wscoas@as.win.tue.nl> porposed
  \def\draftcopy@Name{ONTWERP}\def\draftcopy@Scale{150}
}
\DeclareOption{english}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{esperanto}{
  % thanks to Stephan B. Webanck <webanck@mpiz-koeln.mpg.de>
  \def\draftcopy@Name{MALNETO}\def\draftcopy@Scale{160}
}
\DeclareOption{estonian}{
  % thanks to DAVID FEEST <mirka!mausgoe.central.de!
  % gOe.maus.de!David_Feest@uranus.central.de>
  \def\draftcopy@Name{VISAND}\def\draftcopy@Scale{215}
}
\DeclareOption{finnish}{
  % thanks to Jaakko Ruohio <jjruohio@boojum.hut.fi>
  \def\draftcopy@Name{LUONNOS}\def\draftcopy@Scale{200}
  % thanks to Mika Grundstroem <mikagr@spittari.cs.tut.fi>
  \def\draftcopy@Name{VEDOS}\def\draftcopy@Scale{220}
}
\DeclareOption{francais}{
  % thanks to Christophe Couvreur <couvreur@Thor.fpms.ac.be>
  \def\draftcopy@Name{BROUILLON}\def\draftcopy@Scale{120}
}
\DeclareOption{french}{
  % thanks to Christophe Couvreur <couvreur@Thor.fpms.ac.be>
  \def\draftcopy@Name{BROUILLON}\def\draftcopy@Scale{120}
  % thanks to Marc Torzynski <marc@snoopy.u-strasbg.fr>
  %\def\draftcopy@Name{EPREUVE}\def\draftcopy@Scale{120}
}
\DeclareOption{galician}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{german}{
  \def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155}
}
\DeclareOption{germanb}{
  \def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155}
}
\DeclareOption{greek}{
  % thanks to  Apostolos Syropoulos <apostolo@ocean1.ee.duth.gr>
  \def\draftcopy@Name{PROSCEDIO}\def\draftcopy@Scale{85}
  \def\draftcopy@Font{/Symbol}
}
\DeclareOption{hungarian}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{icelandic}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
  % DRÖG
  % Erlendur S Thorsteinsson <esth@cmu.edu>
  % does anybody knows how to create PostScript for that letter Ö?
}
\DeclareOption{irish}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
  % DRÉACHT
  % Breanndán Ó Nualláin <bon@kotona.demon.nl>
  % does anybody knows how to create PostScript for that letter É?
}
\DeclareOption{italian}{
  % thanks to Fabio Massacci <Fabio.Massacci@cl.cam.ac.uk>
  % thanks to Paolo Dell'Aquila <dlle07k1@mo.nettuno.it>
  \def\draftcopy@Name{BOZZA}\def\draftcopy@Scale{215}
  % thanks to Giuseppe De Arcangelis <gdearc@serifos.caspur.it>
  % \def\draftcopy@Name{brutta copia}\def\draftcopy@Scale{80}
}
\DeclareOption{lowersorbian}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{magyar}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{norsk}{
  % thanks to: Dag Langmyhr <dag@ifi.uio.no>
  \def\draftcopy@Name{UTKAST}\def\draftcopy@Scale{178}
}
\DeclareOption{nynorsk}{
  % thanks to: Dag Langmyhr <dag@ifi.uio.no>
  \def\draftcopy@Name{FRAMLEGG}\def\draftcopy@Scale{129}
}
\DeclareOption{polish}{
  % thanks to Piotr Chrusciel <piotr@gargan.math.univ-tours.fr>
  \def\draftcopy@Name{BRUDNOPIS}\def\draftcopy@Scale{120}
}
\DeclareOption{portuges}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{portuguese}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{romanian}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{scottish}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{spanish}{
  % thanks to: Tomas Bautista <bautista@cma.ulpgc.es>
  \def\draftcopy@Name{BORRADOR}\def\draftcopy@Scale{120}
}
\DeclareOption{slovak}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{slovene}{
  % thanks to brodnik@pegam.mat.uni-lj.si <Andrej Brodnik>
  \def\draftcopy@Name{OSNUTEK}\def\draftcopy@Scale{120}
}
\DeclareOption{swedish}{
  % thanks to <matsd@physchem.kth.se>
  \def\draftcopy@Name{UTKAST}\def\draftcopy@Scale{185}
}
\DeclareOption{turkish}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}
\DeclareOption{uppersorbian}{
  \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
}

\DeclareOption{portrait}{
  % thanks to Ross MOORE \texttt{ross@maths.mq.edu.au>}
  \def\draftcopy@PageTranslate{200 70 translate 65 rotate}
  \def\draftcopy@BottomTranslate{22 760 translate}
  \def\draftcopy@ScaleFactor{1 }
}
\DeclareOption{landscape}{
  % thanks to Ross MOORE \texttt{ross@maths.mq.edu.au>}
  \def\draftcopy@PageTranslate{70 450 translate 25 neg rotate}
  \def\draftcopy@BottomTranslate{25 650 translate 90 neg rotate}
  \def\draftcopy@ScaleFactor{0.6 }
}

\ExecuteOptions{dark,all,english,portrait}
\input{draftcopy.cfg}
\ProcessOptions
\typeout{Prints \draftcopy@Name\space on pages;
does not show in your DVI viewer}

\newcommand{\draftcopyVersion}[1]{
  \def\draftcopy@version{#1}
}

\newcommand{\draftcopySetGrey}[1]{
  \def\draftcopy@GrayValue{#1}
}

\newcommand{\draftcopySetScale}[1]{
  \def\draftcopy@Scale{#1}
}

\newcommand{\draftcopySetScaleFactor}[1]{
  \def\draftcopy@ScaleFactor{#1 }
}

\def\draftcopy@FirstPage{0}
\newcommand{\draftcopyFirstPage}[1]{
  \def\draftcopy@FirstPage{#1}
}

\newcommand{\draftcopyLastPage}[1]{
  \def\draftcopy@LastPage{#1}
}

\newcommand{\draftcopyName}[2]{
  \def\draftcopy@Name{#1}
  \def\draftcopy@Scale{#2}
}

\let\@draftcopyTilde~

\newcommand{\draftcopyPageTransform}[1]{%
 \def\draftcopy@PageTranslate{#1}%
}

\newcommand{\draftcopyBottomTransform}[1]{%
 \def\draftcopy@BottomTranslate{#1}%
}

\def\draftcopy@PageX{0 }
\newcommand{\draftcopyPageX}[1]{%
 \def\draftcopy@PageX{#1 }%
}

\def\draftcopy@PageY{0 }
\newcommand{\draftcopyPageY}[1]{%
 \def\draftcopy@PageY{#1 }%
}

\def\draftcopy@BottomX{0 }
\newcommand{\draftcopyBottomX}[1]{%
 \def\draftcopy@BottomX{#1 }%
}

\def\draftcopy@BottomY{0 }
\newcommand{\draftcopyBottomY}[1]{%
 \def\draftcopy@BottomY{#1 }%
}

\newif\ifdraftcopy@showit
\ifdraftcopy@conditional
  \ifdraftcopy@draft
     \draftcopy@showittrue
  \else
      \draftcopy@showitfalse
  \fi
  \ifdraftcopy@final
    \draftcopy@showitfalse
  \fi
\else
  \draftcopy@showittrue
\fi

\ifdraftcopy@showit
{\obeyspaces
\ifdraftcopy@bottomAfter
  \AtBeginDocument{
    \let~\space
    \immediate@special{\draftcopy@UserDictCmd
      begin
      /draftcopy-CurrentPage 0 def
      /draftcopy-old-BOPhook { } def
      currentdict \draftcopy@BOPhook\space known{
            /draftcopy-old-BOPhook \draftcopy@BOPhook\space load def
      } if
      \draftcopy@BOPhook{
        draftcopy-old-BOPhook
        /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
        draftcopy-CurrentPage \draftcopy@FirstPage ge
        draftcopy-CurrentPage \draftcopy@LastPage le
        and
        { gsave \draftcopy@PageTranslate
          \draftcopy@Font findfont
          \draftcopy@Scale \draftcopy@ScaleFactor mul scalefont setfont
          \draftcopy@PageX \draftcopy@PageY moveto
          \draftcopy@GrayValue setgray
         (\draftcopy@Name) \draftcopy@Timestamp \draftcopy@Show
          grestore
        } if
        draftcopy-CurrentPage \draftcopy@LastPage gt
        { gsave \draftcopy@BottomTranslate
          \draftcopy@Font findfont
          25 scalefont setfont
          \draftcopy@BottomX \draftcopy@BottomY moveto
          \draftcopy@GrayValue setgray
           (\draftcopy@Name\space\space--\space\space)
           0 1 15 { pop dup show } for
          grestore
        } if
      } def
      end
      }
    \let~\@draftcopyTilde
   }
\else\ifdraftcopy@bottom
  \AtBeginDocument{
    \let~\space
    \immediate@special{\draftcopy@UserDictCmd
      begin
      /draftcopy-CurrentPage 0 def
      /draftcopy-old-BOPhook { } def
      currentdict \draftcopy@BOPhook\space known{
            /draftcopy-old-BOPhook \draftcopy@BOPhook\space load def
      } if
      \draftcopy@BOPhook{
        draftcopy-old-BOPhook
        /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
        draftcopy-CurrentPage \draftcopy@FirstPage ge
        draftcopy-CurrentPage \draftcopy@LastPage  le
        and
        { gsave \draftcopy@PageTranslate
          \draftcopy@Font findfont
          \draftcopy@Scale \draftcopy@ScaleFactor mul scalefont setfont
          \draftcopy@PageX \draftcopy@PageY moveto
          \draftcopy@GrayValue setgray
         (\draftcopy@Name) \draftcopy@Timestamp \draftcopy@Show
          grestore
        }if
         gsave \draftcopy@BottomTranslate
        \draftcopy@Font findfont
        25 scalefont setfont
        \draftcopy@BottomX \draftcopy@BottomY moveto
        \draftcopy@GrayValue setgray
        (\draftcopy@Name\space\space--\space\space)
        0 1 15 { pop dup show } for
        grestore
      } def
      end
      }
    \let~\@draftcopyTilde
   }
\else
  \AtBeginDocument{
    \let~\space
    \immediate@special{\draftcopy@UserDictCmd
      begin
      /draftcopy-CurrentPage 0 def
      /draftcopy-old-BOPhook { } def
      currentdict \draftcopy@BOPhook\space known{
            /draftcopy-old-BOPhook \draftcopy@BOPhook\space load def
      } if
      \draftcopy@BOPhook{
        draftcopy-old-BOPhook
        /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
        draftcopy-CurrentPage \draftcopy@FirstPage ge
        draftcopy-CurrentPage \draftcopy@LastPage  le
        and
        { gsave \draftcopy@PageTranslate
          \draftcopy@Font findfont
          \draftcopy@Scale \draftcopy@ScaleFactor mul scalefont setfont
          \draftcopy@PageX \draftcopy@PageY moveto
          \draftcopy@GrayValue setgray
         (\draftcopy@Name) \draftcopy@Timestamp \draftcopy@Show
          grestore
        } if
      } def
      end
      }
    \let~\@draftcopyTilde
  }
\fi\fi
}
\fi

\endinput
%%
%% End of file `draftcopy.sty'.
