%
%
%  This defines the standard background with two logos and a 
% colored border.
%
%   Black and white version
%
\newcommand{\Red}{}
\newcommand{\Green}{}
\newcommand{\Blue}{}
\newcommand{\LightBlue}{}
\newcommand{\Purple}{}
\newcommand{\Black}{}
\newcommand{\LimeGreen}{}
\newcommand{\Orange}{}
\newcommand{\Violet}{}
\newcommand{\Pink}{}
\newcommand{\Gold}{}
\newcommand{\Brown}{}
\newcommand{\MidnightBlue}{}
\newcommand{\SteelBlue}{}
\newcommand{\Orchid}{}
\newcommand{\Cyan}{}
\newcommand{\Yellow}{}
\newcommand{\Aquamarine}{}
\newcommand{\DarkGreen}{}
\newcommand{\DimGrey}{}
\newcommand{\Navy}{} 
\newcommand{\Salmon}{}

\def\Background{\special{"  userdict begin
   -6 -200 translate 90 rotate -345 -725 translate % -60 -350  translate  .478 .478 scale
   SlideBorder       0   0   moveto 0    792 lineto % Border bottom
                     0   0   moveto 612  0   lineto % Border  right
                     612 0   moveto 612  792 lineto % Border  top
                     0   792 moveto 612  792 lineto	 % Border  left
  /circtextdict 16 dict def
  circtextdict begin
    % return half the angle spanned by a string
    /findhalfangle { % string => angle
        stringwidth pop 2 div
        2 xradius mul pi mul div 360 mul
    } def
    % draw one character and then rotate to next position (text reads cw)
    /cwplacechar { % char => -
        /char exch def
        /halfangle char findhalfangle def
        gsave
            halfangle neg rotate
            radius 0 translate
            -90 rotate
            char stringwidth pop 2 div neg 0 moveto
            char show
        grestore
        halfangle 2 mul neg rotate
    } def
    % draw one character and then rotate to next position (text reads ccw)
    /ccwplacechar { % char => -
        /char exch def
        /halfangle char findhalfangle def
        gsave
            halfangle rotate
            radius ptsize fudge sub add 0 translate
            90 rotate
            char stringwidth pop 2 div neg 0 moveto
            char show
        grestore
        halfangle 2 mul rotate
    } def
    /pi 3.1415923 def
  end
  % draw a string on a circular path in the clockwise direction
  /cwcircletext { % string fontsize centerangle radius => -
    circtextdict begin
        /radius exch def
        /centerangle exch def
        /ptsize exch def
        /str exch def
        /xradius radius ptsize 4 div add def
        gsave
            centerangle str findhalfangle add rotate
            str {
                /charcode exch def
                ( ) dup 0 charcode put cwplacechar
            } forall
        grestore
    end
  } def
  % draw a string on a circular path in the counter-clockwise direction
  /ccwcircletext { % string fontsize fudge centerangle radius => -
    circtextdict begin
        /radius exch def
        /centerangle exch def
        /fudge exch def    % fudge factor; set to zero and then adjust
        /ptsize exch def
        /str exch def
        /xradius radius ptsize 4 div add def
        gsave
            centerangle str findhalfangle sub rotate
            str {
                /charcode exch def
                ( ) dup 0 charcode put ccwplacechar
            } forall
        grestore
    end
  } def
  % draw the interior of the ANL logo (arrow + circle)
  /drawcenter { % side width outsider insider circrad circdy => -
    gsave 
    30 dict begin
        /circdy exch def        % vertical offset for circle
        /circrad exch def       % radius of circle
        /insider exch def       % radius of turn for inside line (in arrow)
        /outsider exch def      % radius of turn for outside line (in arrow)
        /width exch def         % distance between inside and outside lines
        /side exch def          % length of one (out)side of the arrow
        /root3 3 sqrt def
        /y0 root3 6 div side mul neg def
        /y1 y0 width add def
        /y2 y1 2 mul neg def
        /y3 y2 width 3 mul 4 div add def
        /y4 y0 2 mul neg def
        /dx0 root3 4 div width mul def
        /dx1 side 2 div width root3 mul sub def
        /dx2 dx1 width root3 div add def
        /dx3 side width root3 mul sub 2 div def
        /dx4 side 2 div def
        % inside line
        width 2 div neg y1 moveto
        dx1 neg y1 0 y2 insider arcto pop pop pop pop
        0 y2 dx1 y1 insider arcto pop pop pop pop
        dx1 y1 width 2 div y1 insider arcto pop pop pop pop
        width 2 div y1 lineto
        % outside line
        width 2 div y0 lineto
        dx4 y0 0 y4 outsider arcto pop pop pop pop
        0 y4 dx3 neg y1 outsider arcto pop pop pop pop
        dx4 neg y0 dx2 y0 outsider arcto pop pop pop pop
        width 2 div neg y0 lineto
        closepath
        stroke
        % circle
        0 circdy circrad 0 360 arc closepath stroke
    end
    grestore
  } def
%  Beginning of ANL logo
    gsave
    0 0 translate  .6 .6 scale  -90 rotate
    /Helvetica-Bold findfont 10 scalefont setfont
    -130 110 translate
    (ARGONNE    NATIONAL    LABORATORY) 10 90 55 cwcircletext
    (UNIVERSITY    OF    CHICAGO) 10 3 -90 55 ccwcircletext
    (                                               )
    /Symbol findfont 10 scalefont setfont
    10 3 -90 55 ccwcircletext
    104 18 10 1 10 -2 drawcenter grestore
% Beginning of PETSc logo
    gsave
    0 0 translate  .6 .6 scale  -90 rotate
    /Helvetica-Bold findfont 10 scalefont setfont
    -1208 110 translate
    (PORTABLE EXTENSIBLE TOOLKIT for SCIENTIFIC COMPUTATION) 10 90 55 cwcircletext
    (http://www.mcs.anl.gov/petsc/petsc.html) 10 90 41 cwcircletext
     1 1.6 scale /Helvetica-Bold findfont 18 scalefont setfont
    -26 -5 moveto (PETSc) show
   grestore
 end  } }


\def\PlainBackground{\special{"  userdict begin
   -6 -200 translate 90 rotate -60 -350  translate .478 .478 scale
   SlideBorder       0   5  20  779 rectfill % Border bottom
                     0   5  612 20  rectfill % Border  right
                     592 5  612 779 rectfill % Border  top
                     0   772 612 792 rectfill % Border  left
}}

\def\stripe{\ifvmode\else\par\vskip-\baselineskip\vskip12pt\fi
\hbox to \hsize{\leaders\hrule height 4.5pt\hfil}\vskip-\baselineskip
            \vskip 3.5pt 
            \hbox to \hsize{\leaders\hrule height 1.5pt\hfil}
            \vskip -10pt}
%
%  Basic slide without a heading
%
\def\vt{\protect\begin{slide}{}{\Background \White}}
\def\vtp{\protect\begin{slide}{}{\PlainBackground}}
\def\ve{\vfil\protect\end{slide}}
%
%  Basic slide with a heading
%
\def\vtt#1{\begin{slide}{}{\medskip\Background \centerline{\large \bf \Red #1}} \White  \stripe\vfil\parskip8pt\medskip\medskip \bf}
\def\vttp#1{\begin{slide}{}{\medskip\PlainBackground\centerline{\large \bf #1}}\stripe\vfil\parskip8pt\medskip\medskip}


\setlength{\topmargin}{-1.150in}
\setlength{\textheight}{7.5in}
\setlength{\textwidth}{9.47in}
\setlength{\oddsidemargin}{-0.42in}
\setlength{\evensidemargin}{-0.12in}

% \slideframe{none}
%
%  Other colors not listed in color.sty
%
\newcommand{\White}{}
%
%   Below defines the default background colors printed on every slide
%
\special{!userdict begin /SlideBackground{0 0  0 setrgbcolor} def 
                         /SlideBorder{0 0 0  setrgbcolor} def end }

\def\SetRGBBackgrounds#1#2#3{\special{ps:userdict begin
                          /SlideBackground{#1 #2 #3 setrgbcolor} def end }}
\def\SetRGBBorders#1#2#3{\special{ps:userdict begin  
                          /SlideBorder{#1 #2 #3 setrgbcolor} def end }}
\def\SetRGBBackground #1 #2 #3 {\SetRGBBackgrounds{#1}{#2}{#3}}
\def\SetRGBBorder #1 #2 #3 {\SetRGBBorders{#1}{#2}{#3}}

\newcommand{\WhiteBackground}{}
\newcommand{\PlumBackground}{}
\newcommand{\RedBackground}{}
\newcommand{\GreenBackground}{}
\newcommand{\BlueBackground}{}
\newcommand{\LightBlueBackground}{}
\newcommand{\PurpleBackground}{}
\newcommand{\BlackBackground}{}
\newcommand{\LimeGreenBackground}{}
\newcommand{\OrangeBackground}{}
\newcommand{\VioletBackground}{}
\newcommand{\PinkBackground}{}
\newcommand{\GoldBackground}{}
\newcommand{\BrownBackground}{}
\newcommand{\MidnightBlueBackground}{}
\newcommand{\SteelBlueBackground}{}
\newcommand{\OrchidBackground}{}
\newcommand{\CyanBackground}{}
\newcommand{\YellowBackground}{}
\newcommand{\AquamarineBackground}{}
\newcommand{\DarkGreenBackground}{}
\newcommand{\DimGreyBackground}{}
\newcommand{\NavyBackground}{} 
\newcommand{\SalmonBackground}{}

\newcommand{\WhiteBorder}{}
\newcommand{\RedBorder}{}
\newcommand{\GreenBorder}{}
\newcommand{\BlueBorder}{}
\newcommand{\LightBlueBorder}{}
\newcommand{\PurpleBorder}{}
\newcommand{\BlackBorder}{}
\newcommand{\LimeGreenBorder}{}
\newcommand{\OrangeBorder}{}
\newcommand{\VioletBorder}{}
\newcommand{\PinkBorder}{}
\newcommand{\GoldBorder}{}
\newcommand{\BrownBorder}{}
\newcommand{\MidnightBlueBorder}{}
\newcommand{\SteelBlueBorder}{}
\newcommand{\OrchidBorder}{}
\newcommand{\CyanBorder}{}
\newcommand{\YellowBorder}{}
\newcommand{\AquamarineBorder}{}
\newcommand{\DarkGreenBorder}{}
\newcommand{\DimGreyBorder}{}
\newcommand{\NavyBorder}{ } 
\newcommand{\SalmonBorder}{}

%
% changes the definition of the \special{" environment slightly
% so that origin is always at upper left corner of page.
%
\special{! TeXDict begin  /@beginspecial{SDict
    begin /SpecialSave save N gsave normalscale 
    @SpecialDefaults count /ocount X /dcount countdictstack N}N end}




