%
%
%  This defines the standard background with two logos and a 
% colored border.
%
\newcounter{colorflag}
\newcommand{\color}{\setcounter{colorflag}{1}}
\newcommand{\nocolor}{\setcounter{colorflag}{0}}
\color
\def\RGB#1#2#3{\ifnum\thecolorflag=1\special{ps: #1 #2 #3 setrgbcolor}\fi}
\def\RGBS #1 #2 #3 {\RGB{#1}{#2}{#3}}
\newcommand{\SetRGBColor}{\RGB}

\newcommand{\Red}{\RGBS 1 0 0 }
\newcommand{\Green}{\RGBS 0 1 0 }
\newcommand{\Blue}{\RGBS 0 0 1 }
\newcommand{\LightBlue}{\RGBS  0 1 1 }
\newcommand{\Purple}{\RGBS 1 0 1 }
\newcommand{\Black}{\RGBS 0 0 0 }
\newcommand{\LimeGreen}{\RGBS 0.1961 0.8039 0.1961 }
\newcommand{\Orange}{\RGBS 1 0.6471 0 }
\newcommand{\Violet}{\RGBS 0.9333 0.5098 0.9333 }
\newcommand{\Pink}{\RGBS 1 0.7529 0.7961 }
\newcommand{\Gold}{\RGBS 1 .8431 0  }
\newcommand{\Brown}{\RGBS 0.6471 0.1647 0.1647 }
\newcommand{\MidnightBlue}{\RGBS 0.0980 0.0980 0.4392 }
\newcommand{\SteelBlue}{\RGBS 0.2745 0.5098 0.7059 }
\newcommand{\Orchid}{\RGBS 0.8549 0.4392 0.8392 }
\newcommand{\Cyan}{\RGBS 0 1 1 }
\newcommand{\Yellow}{\RGBS 1 1 0 }
\newcommand{\Aquamarine}{\RGBS 0.4980 1.0000 0.8314 }
\newcommand{\DarkGreen}{\RGBS 0 .3922 0 }
\newcommand{\DimGrey}{\RGBS 0.4118 0.4118 0.4118 }
\newcommand{\Navy}{\RGBS  0 0 0.5020 } 
\newcommand{\Salmon}{\RGBS 0.9804 0.5020 0.4471 }

\def\Background{\special{"  userdict begin
   -6 -200 translate 90 rotate -345 -725 translate % -60 -350  translate  .478 .478 scale
   SlideBackground   0   5 612  779 rectfill % Yellow background
   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
  /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
    1.0000 0.0 0.0000 setrgbcolor
%    0 .3922 0 setrgbcolor
    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
    0 0 0 setrgbcolor
% Beginning of PETSc logo
    gsave
    1 0 0 setrgbcolor
%    0 .3922 0 setrgbcolor
    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
   SlideBackground   0   5 612  779 rectfill % Yellow background
   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}{\RGBS 1 1 1 }
%
%   Below defines the default background colors printed on every slide
%
\special{!userdict begin /SlideBackground{0 0  1 setrgbcolor} def 
                         /SlideBorder{0 0 0  setrgbcolor} def end}
%                         /SlideBorder{0 .1 .9 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}{\SetRGBBackground  1 1 1 }
\newcommand{\PlumBackground}{\SetRGBBackground .9663 .795 .9663 }
\newcommand{\RedBackground}{\SetRGBBackground 1 0 0 }
\newcommand{\GreenBackground}{\SetRGBBackground .75 1 .75 }
\newcommand{\BlueBackground}{\SetRGBBackground 0 0 1 }
\newcommand{\LightBlueBackground}{\SetRGBBackground  .7 1 1 }
\newcommand{\PurpleBackground}{\SetRGBBackground 1 0 1 }
\newcommand{\BlackBackground}{\SetRGBBackground 0 0 0 }
\newcommand{\LimeGreenBackground}{\SetRGBBackground 0.6961 0.99 0.69 }
\newcommand{\OrangeBackground}{\SetRGBBackground 1 0.6471 0 }
\newcommand{\VioletBackground}{\SetRGBBackground 0.9333 0.5098 0.9333 }
\newcommand{\PinkBackground}{\SetRGBBackground 1 0.7529 0.7961 }
\newcommand{\GoldBackground}{\SetRGBBackground 1 .9231 .3  }
\newcommand{\BrownBackground}{\SetRGBBackground 0.6471 0.1647 0.1647 }
\newcommand{\MidnightBlueBackground}{\SetRGBBackground 0.0980 0.0980 0.4392 }
\newcommand{\SteelBlueBackground}{\SetRGBBackground 0.2745 0.5098 0.7059 }
\newcommand{\OrchidBackground}{\SetRGBBackground 0.8549 0.4392 0.8392 }
\newcommand{\CyanBackground}{\SetRGBBackground 0 1 1 }
\newcommand{\YellowBackground}{\SetRGBBackground 1 1 .7 }
\newcommand{\AquamarineBackground}{\SetRGBBackground 0.4980 1.0000 0.8314 }
\newcommand{\DarkGreenBackground}{\SetRGBBackground 0 .3922 0 }
\newcommand{\DimGreyBackground}{\SetRGBBackground 0.4118 0.4118 0.4118 }
\newcommand{\NavyBackground}{\SetRGBBackground  0 0 0.5020 } 
\newcommand{\SalmonBackground}{\SetRGBBackground 0.9804 0.5020 0.4471 }

\newcommand{\WhiteBorder}{\SetRGBBorder 1 1 1 }
\newcommand{\RedBorder}{\SetRGBBorder 1 0 0 }
\newcommand{\GreenBorder}{\SetRGBBorder 0 1 0 }
\newcommand{\BlueBorder}{\SetRGBBorder 0 0 1 }
\newcommand{\LightBlueBorder}{\SetRGBBorder  0 1 1 }
\newcommand{\PurpleBorder}{\SetRGBBorder 1 0 1 }
\newcommand{\BlackBorder}{\SetRGBBorder 0 0 0 }
\newcommand{\LimeGreenBorder}{\SetRGBBorder 0.1961 0.8039 0.1961 }
\newcommand{\OrangeBorder}{\SetRGBBorder 1 0.6471 0 }
\newcommand{\VioletBorder}{\SetRGBBorder 0.9333 0.5098 0.9333 }
\newcommand{\PinkBorder}{\SetRGBBorder 1 0.7529 0.7961 }
\newcommand{\GoldBorder}{\SetRGBBorder 1 .8431 0  }
\newcommand{\BrownBorder}{\SetRGBBorder 0.6471 0.1647 0.1647 }
\newcommand{\MidnightBlueBorder}{\SetRGBBorder 0.0980 0.0980 0.4392 }
\newcommand{\SteelBlueBorder}{\SetRGBBorder 0.2745 0.5098 0.7059 }
\newcommand{\OrchidBorder}{\SetRGBBorder 0.8549 0.4392 0.8392 }
\newcommand{\CyanBorder}{\SetRGBBorder 0 1 1 }
\newcommand{\YellowBorder}{\SetRGBBorder 1 1 0 }
\newcommand{\AquamarineBorder}{\SetRGBBorder 0.4980 1.0000 0.8314 }
\newcommand{\DarkGreenBorder}{\SetRGBBorder 0 .3922 0 }
\newcommand{\DimGreyBorder}{\SetRGBBorder 0.4118 0.4118 0.4118 }
\newcommand{\NavyBorder}{\SetRGBBorder  0 0 0.5020 } 
\newcommand{\SalmonBorder}{\SetRGBBorder 0.9804 0.5020 0.4471 }

%
% 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}




