%
% Flag controlled slide style to replace the various phslides, aoslides
% and various hacked colour version of the original EPCC slide package
% that was originally hacked by wjh !!!
%
% This is a LeTeX2e version with controls of graphics and colours
% of titles and rules. 
%
% The package should be used as a \usepackage{} option with 2e only,
% and expects the paper (or slide) size to be correctly set.
%
%		Typical Latex start is thus:
%
%	\documentclass[a4paper]{slides}
%	\usepackage{phslides}
%	
%
% Header/Footer Controls.
%       \talkseries{text} [Default ``Department of Phys....''] Header text. 
%	\talktitle{text}  [Default blank]               Left Footer text
%	\talkdate{text}   [Default \today]              Right Footertext
%	\setslidenumber{number}				sets slidenumber
%	\resetslidenumber		set next slide number to 1
%
% Graphics Controls. [normal user]
%	\crestgraphics	[Default]  EU Crest in top/left and bottom/right.
%	\blankgraphics             Square and circle only (for proofs)
%	\aographics                EU Crest top/left AO logo bottom/right.
%	\departmentgraphics	   EU Crest top/left Department bottom/right.
%	\scifungraphics		   EU Crest top/left SCI-FUN logo bottom/right
%
% Graphics Controls. [advanced user]
%	\topleftgraphic{mono-ps-file}{colour-ps-file}{x-size}{y-size}
%	\bottomrightgraphic{mono-ps-file}{colour-ps-file}{x-size}{y-size}
%		
%		Specify eps files to use in topleft and bottom right
%		corners when used in monochrome [default] or
%		fullcolour mode. 
%		x-size is used to scale the graphic wrt to its bounding box
%		y-size is used to set the header heights.
%		If your graphics is SQUARE (or round) set 
%		x-size = y-size, if not set ratio is aspect of graphics.
%		NOTE: Only x-size controls the SIZE of the graphic, 
%		and you can use y-size to control its position.
%		(Sometimes a little ``trail-and-error'' is needed here)
%
%
% Margin controls: [default is fine for A4 portrait ]
%	\slideleftrightmargin{length}	[0pt] 	adds {length} to L + R margins
%	\slidetopmargin{length}		[0pt]	adds {length} to top margin
%	\slidebottommargin{length}	[0pt]	adds {length} to bottom margin
%
%	In landscape mode slides look ``better'' with left and right
%	margins set to about 10->12 mm otherwise text is too wide
%	for most OHPs
%
%	NOTE: The left/right margins control the text width AND the
%	position of graphics with the centre of the graphics aligned
%	with the text margins. The top/bottom margins control ONLY
%	the position of the graphics and header/footer rules. The text
%	in vertically centred in the page (normal LaTeX slide mode)
%
% Colour controls.
% 	\colourslides  			Switches on dvips colours 
%					and colour graphics eps files.
%	\colour{colour}		[darkblue]Changes general text colour. 
%	\headtextcolour{colour} [darkred] Changes header text colour
%	\foottextcolour{colour} [darkred] Changes footer text colour
%	\headrulecolour{colour} [blue] 	Changes header rule colour
%	\footrulecolour{colour} [blue]	Changes footer rule colour
%	\QMSPrinter			Shorten page to fit on CS23
%					QMS printer that cant print A4
%
\usepackage{epsfig,ifthen}
\usepackage[dvips]{color}
\typeout{Phslides macro files version 2.0}
%
%  Will Hossack, The University of Edinburgh
%
% 	Version 2.0			17/5/98
%
%   		Colour control section. User commands set flags
%		and commands.
%
\newboolean{ColourSlides}\setboolean{ColourSlides}{false}
\newcommand{\colourslides}{\setboolean{ColourSlides}{true}\color{darkblue}}
%
\newcommand{\colour}[1]{\ifthenelse{\boolean{ColourSlides}}{\color{#1}}{}}
%
\newcommand{\@HeaderTextColour}{darkred}
\newcommand{\headtextcolour}[1]{\renewcommand{\@HeaderTextColour}{#1}}
\newcommand{\@FooterTextColour}{darkred}
\newcommand{\foottextcolour}[1]{\renewcommand{\@FooterTextColour}{#1}}
\newcommand{\@HeaderRuleColour}{blue}
\newcommand{\headrulecolour}[1]{\renewcommand{\@HeaderRuleColour}{#1}}
\newcommand{\@FooterRuleColour}{blue}
\newcommand{\footrulecolour}[1]{\renewcommand{\@FooterRuleColour}{#1}}
\newboolean{QMSPrinterHack}
\setboolean{QMSPrinterHack}{false}
\newcommand{\QMSprinter}{\setboolean{QMSPrinterHack}{true}%
	\@CalculateSlideSize}
%
%                  Running Headers and Footers control.
%
\newcommand{\@TalkSeries}{Department of Physics and Astronomy}
\newcommand{\talkseries}[1]{\renewcommand{\@TalkSeries}{#1}}
\newcommand{\@TalkTitle}{}
\newcommand{\talktitle}[1]{\renewcommand{\@TalkTitle}{#1}}
\newcommand{\@TalkDate}{\today}
\newcommand{\talkdate}[1]{\renewcommand{\@TalkDate}{#1}}
%
\newcommand{\setslidenumber}[1]{\setcounter{slide}{#1}%
	\addtocounter{slide}{-1}}
\newcommand{\resetslidenumber}{\setcounter{slide}{0}}
%
%	
%		Define the main internal commands and lengths used
% 		to control the headers and footers.	
%
\newcommand{\@TopLeftGraphicFile}{}
\newcommand{\@TopLeftColourGraphicFile}{}
\newcommand{\@BottomRightGraphicFile}{}
\newcommand{\@BottomRightColourGraphicFile}{}
\newlength{\@HeaderGraphicWidth}
\newlength{\@HeaderGraphicHeight}
\newlength{\@FooterGraphicWidth}
\newlength{\@FooterGraphicHeight}
\newlength{\@HeaderRuleLength}
\newlength{\@FooterRuleLength}
\newlength{\@FooterGraphicShift}
%
%				Extra Margin Control variables
%
\newlength{\@SlideLRMarginLength}
\setlength{\@SlideLRMarginLength}{0pt}
\newlength{\@SlideTopMarginLength}
\setlength{\@SlideTopMarginLength}{0pt}
\newlength{\@SlideBottomMarginLength}
\setlength{\@SlideBottomMarginLength}{0pt}
%
%				User Commands to control these sizes
%
\newcommand{\slideleftrightmargin}[1]{
	\setlength{\@SlideLRMarginLength}{#1}
	\@CalculateSlideSize}
\newcommand{\slidetopmargin}[1]{
	\setlength{\@SlideTopMarginLength}{#1}
	\@CalculateSlideSize}
\newcommand{\slidebottommargin}[1]{
	\setlength{\@SlideBottomMarginLength}{#1}
	\@CalculateSlideSize}
%
%     		Page Sizes.... pick them up from standard LaTeX sizes
%		so sty will work for all paper sizes in both portait 
%		and landscape mode.
%
\newcommand{\@CalculateSlideSize}{
	\setlength{\oddsidemargin}{\@SlideLRMarginLength}
	\setlength{\evensidemargin}{\@SlideLRMarginLength}
	\setlength{\textwidth}{\paperwidth}
	\addtolength{\textwidth}{-2truein}
	\addtolength{\textwidth}{-\oddsidemargin}
	\addtolength{\textwidth}{-\evensidemargin}
%
	\setlength{\topmargin}{-15truemm}
	\addtolength{\topmargin}{\@SlideTopMarginLength}
	\setlength{\headheight}{15truept}
	\setlength{\headsep}{0.5\@HeaderGraphicHeight}
	\addtolength{\headsep}{\headheight}
	\setlength{\footskip}{0.5\@FooterGraphicHeight}
	\setlength{\textheight}{\paperheight}
	\addtolength{\textheight}{-1truein}
	\addtolength{\textheight}{-\topmargin}
	\addtolength{\textheight}{-\headheight}
	\addtolength{\textheight}{-\headsep}
	\addtolength{\textheight}{-2\footskip}
	\addtolength{\textheight}{-10truemm}
	\addtolength{\textheight}{-\@SlideBottomMarginLength}
	\ifthenelse{\boolean{QMSPrinterHack}}
		{\addtolength{\textheight}{-24truemm}}%
		{}
	}
%
%		User Commands to set graphics files
%
\newcommand{\toprightgraphic}[4]{%		Set top left garphic
	\renewcommand{\@TopLeftGraphicFile}{#1}
	\renewcommand{\@TopLeftColourGraphicFile}{#2}
	\setlength{\@HeaderGraphicWidth}{#3}
	\setlength{\@HeaderGraphicHeight}{#4}
	\@CalculateSlideSize}
%
\newcommand{\bottomleftgraphic}[4]{%		Set top left garphic
	\renewcommand{\@BottomRightGraphicFile}{#1}
	\renewcommand{\@BottomRightColourGraphicFile}{#2}
	\setlength{\@FooterGraphicWidth}{#3}
	\setlength{\@FooterGraphicHeight}{#4}
	\@CalculateSlideSize}
%
%
%               Command to set the Graphics in suitable boxes allowing
%		for colour options. 
%
\newcommand{\@TopLeftGraphic}{\makebox[0.5\@HeaderGraphicWidth][l]{%
	\raisebox{-0.5\@HeaderGraphicHeight}{%
	\setlength{\epsfxsize}{\@HeaderGraphicWidth}%
	\ifthenelse{\boolean{ColourSlides}}% 		Use colour graphic ?
		{\epsfbox{\@TopLeftColourGraphicFile}}%
		{\epsfbox{\@TopLeftGraphicFile}}}}}
%
\newcommand{\@BottomRightGraphic}{\makebox[0.5\@FooterGraphicWidth][r]{%
	\setlength{\@FooterGraphicShift}{-0.5\@FooterGraphicHeight}%
	\addtolength{\@FooterGraphicShift}{6truemm}%
	\raisebox{\@FooterGraphicShift}{%
	\setlength{\epsfxsize}{\@FooterGraphicWidth}%
	\ifthenelse{\boolean{ColourSlides}}%		Use colour graphic ?
		{\epsfbox{\@BottomRightColourGraphicFile}}%
		{\epsfbox{\@BottomRightGraphicFile}}}}}
%
%                 Macro to produce the rules (Needed to tidyup the code below)
%
\newcommand{\@Rules}[3]%
	{\makebox[0pt][l]{\rule[#1]{#3}{2truept}}%
	\makebox[0pt][l]{\rule[#2]{#3}{2truept}}}
%
%               Command to format the header.... Need for colour flag
%		make it all a bit messy. 
%
\newcommand{\@SlideHeader}{%
	\setlength{\@HeaderRuleLength}{\textwidth}%
	\addtolength{\@HeaderRuleLength}{-0.5\@HeaderGraphicWidth}%
	\addtolength{\@HeaderRuleLength}{-5truemm}%
	\ifthenelse{\boolean{ColourSlides}}%
		{\textcolor{\@HeaderRuleColour}{\@Rules{-2truemm}{-4truemm}%
		{\@HeaderRuleLength}}%
		{\tiny\textcolor{\@HeaderTextColour}{\@TalkSeries}}}%
		{\@Rules{-2truemm}{-4truemm}{\@HeaderRuleLength}%
			\tiny\@TalkSeries}%
	\hfill\@TopLeftGraphic}
%
%		Command to format the Footer (again colour options
%		make this messy).
%
\newcommand{\@SlideFooter}{%
	\setlength{\@FooterRuleLength}{\textwidth}%
	\addtolength{\@FooterRuleLength}{-0.5\@FooterGraphicWidth}%
	\addtolength{\@FooterRuleLength}{-5truemm}%
	\@BottomRightGraphic\hspace*{5truemm}%
	\ifthenelse{\boolean{ColourSlides}}%
		{\textcolor{\@FooterRuleColour}{\@Rules{5truemm}{7truemm}%
		{\@FooterRuleLength}}%
		\tiny\textcolor{\@FooterTextColour}%
		{\@TalkTitle\hfil-\theslide-\hspace*{5truemm}\@TalkDate}}%
		{\@Rules{5truemm}{7truemm}{\@FooterRuleLength}%
		{\tiny\@TalkTitle\hfil-\theslide-\hspace*{5truemm}\@TalkDate}}%
	}
%		Command to format the overlay footer, same as slide
%		footer but with differnt counter.
\newcommand{\@OverlayFooter}{%
	\setlength{\@FooterRuleLength}{\textwidth}%
	\addtolength{\@FooterRuleLength}{-0.5\@FooterGraphicWidth}%
	\addtolength{\@FooterRuleLength}{-5truemm}%
	\@BottomRightGraphic\hspace*{5truemm}%
	\ifthenelse{\boolean{ColourSlides}}%
		{\textcolor{\@FooterRuleColour}{\@Rules{5truemm}{7truemm}%
		{\@FooterRuleLength}}%
		\tiny\textcolor{\@FooterTextColour}%
		{\@TalkTitle\hfil-\theslide-\hspace*{5truemm}\@TalkDate}}%
		{\@Rules{5truemm}{7truemm}{\@FooterRuleLength}%
		{\tiny\@TalkTitle\hfil-\theoverlay-%
		\hspace*{5truemm}\@TalkDate}}%
	}
%
%		Do the actual work.... \ps@xxxx and \@oddxxxx are the
%		internal routines called at start of slides.
%
%
\renewcommand{\ps@headings}{%
	\renewcommand{\ps@slide}{%
		\renewcommand{\@oddhead}{\@SlideHeader}%
		\renewcommand{\@oddfoot}{\@SlideFooter}%
	}%
	}
%
\renewcommand{\ps@overlay}{%
	%\renewcommand{\ps@slide}{%
		\renewcommand{\@oddhead}{\@SlideHeader}%
		\renewcommand{\@oddfoot}{\@OverlayFooter}%
	}%
%	}
%
%			User commands to set standard graphics.
%
\newcommand{\blankgraphics}{%
	\toprightgraphic{blank.eps}{blank.eps}{30mm}{30mm}
	\bottomleftgraphic{blank.eps}{blank.eps}{30mm}{30mm}}
%
\newcommand{\crestgraphics}{%
	\toprightgraphic{crest.epsi}{crest_colour.ps}{30mm}{30mm}
	\bottomleftgraphic{crest.epsi}{crest_colour.ps}{30mm}{30mm}}
%
\newcommand{\departmentgraphics}{%
	\toprightgraphic{crest.epsi}{crest_colour.ps}{30mm}{30mm}
	\bottomleftgraphic{pa.eps}{pa_colour.eps}{32mm}{30mm}}
%
\newcommand{\aographics}{%
	\toprightgraphic{crest.epsi}{crest_colour.ps}{30mm}{30mm}
	\bottomleftgraphic{logo.eps}{logo_colour.ps}{30mm}{30mm}}
%
\newcommand{\scifungraphics}{%
	\toprightgraphic{crest.epsi}{crest_colour.ps}{30mm}{30mm}
	\bottomleftgraphic{scifun-logo-mono.eps}{scifun-logo.eps}{25mm}{30mm}}
%
%                     Squashitems macro so make lists with
%                     sensible spearation
\newcommand{\squashitems}{%
	\renewcommand{\@listi}{\setlength{\parsep}{0.5\parskip}%
		\setlength{\topsep}{\parsep}%
		\setlength{\itemsep}{0pt}%
		\setlength{\partopsep}{0pt}}%
	\renewcommand{\@listii}{\setlength{\parsep}{0.5\parskip}%
		\setlength{\topsep}{\parsep}%
		\setlength{\itemsep}{0pt}%
		\setlength{\partopsep}{0pt}}%
		}
%
%		Define Default colours
%
\definecolor{darkred}{rgb}{0.65,0,0}
\definecolor{darkblue}{rgb}{0,0,.65}
\definecolor{darkgreen}{rgb}{0,0.5,0}
\definecolor{orange}{rgb}{1,.75,.25}
\definecolor{aqua}{rgb}{0,.25,.75}
\definecolor{grey}{rgb}{.5,.5,.5}
\definecolor{brown}{rgb}{.51,.35,.18}
%
%		Some simple slide title commands
%
\newcommand{\@slidetitlestyle}{\large\bf}
\newcommand{\slidetitlestyle}[1]{\renewcommand{\@slidetitlestyle}{#1}}
\newcommand{\@slidetitlecolour}{darkgreen}
\newcommand{\slidetitlecolour}[1]{\renewcommand{\@slidetitlecolour}{#1}}
\newcommand{\slidetitle}[1]{%
	\begin{center}%
	\ifthenelse{\boolean{ColourSlides}}{%
	\textcolor{\@slidetitlecolour}{\@slidetitlestyle #1}}
	{\@slidetitlestyle #1}
	\end{center}
}
%               Some simple colour controls that default to black
%               if colourslides not set
\newcommand{\Red}[1]{\ifthenelse{\boolean{ColourSlides}}{\textcolor{red}{#1}}%
		{{#1}}}
\newcommand{\Green}[1]{\ifthenelse{\boolean{ColourSlides}}%
	{\textcolor{darkgreen}{#1}}{{#1}}}
\newcommand{\Blue}[1]{\ifthenelse{\boolean{ColourSlides}}%
	{\textcolor{blue}{#1}}{{#1}}}
\newcommand{\Cyan}[1]{\ifthenelse{\boolean{ColourSlides}}%
	{\textcolor{cyan}{#1}}{{#1}}}
\newcommand{\Magenta}[1]{\ifthenelse{\boolean{ColourSlides}}%
	{\textcolor{magenta}{#1}}{{#1}}}
\newcommand{\Yellow}[1]{\ifthenelse{\boolean{ColourSlides}}%
	{\textcolor{yellow}{#1}}{{#1}}}
\newcommand{\Orange}[1]{\ifthenelse{\boolean{ColourSlides}}%
	{\textcolor{orange}{#1}}{{#1}}}
\newcommand{\Aqua}[1]{\ifthenelse{\boolean{ColourSlides}}%
	{\textcolor{aqua}{#1}}{{#1}}}
%
%		Add some simple EPS graphics macros
%
\newcommand{\PSlocation}[1]{\renewcommand{\PSFiles}{#1}}
\newcommand{\PSFiles}{}
%
\newcommand{\Piccx}[2]{\begin{center}\leavevmode\epsfxsize #2%
        \epsfbox{\PSFiles#1}\end{center}}
%
\newcommand{\Piccy}[2]{\begin{center}\leavevmode\epsfysize #2%
        \epsfbox{\PSFiles#1}\end{center}}
%
%		Set the Defaults....
%
\crestgraphics			
\ps@headings
\squashitems









