%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Examples of usage:
% \begin{cadslide*}{MyHeading}
%    This produces a landscape (default) slide with title MyHeading
%    (also to be added to contents page)
% \continueslide
%    This gives a break in the slide and will also add `MyHeading
%    (Continued)' to the header of the continuation slide
% \end{cadslide*}
%
% \begin{cadslide}{MyHeading2}
%    This produces a landscape slide with title MyHeading2
%    but doesnt add the title to the contents page
% \end{cadslide}
%
% \begin{cadslideportrait*}{PortraitHeading}
%   This makes a portrait slide with title PortraitHeading
%   added to contents page.
%
%   Note that the headers and footers are also rotated, because of
%   the setting of `\\rotateheaderstrue'
%
% \end{cadslideportrait*}
%
% \begin{cadslideportrait}{PortraitHeading}
%   and this makes a portrait slide with title PortraitHeading
%   but title not added to contents page
% \end{cadslideportrait}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Make the page/slide styles:

%%% first, some commands for storing the running titles, and counting slides:
\newcommand{\heading}[1]{\begin{center}\large\bf #1\end{center}}

\newcommand{\incpage}{\setcounter{page}{\theslide+1}}

\newcommand{\slheader}{}

\newcommand{\storedheader}{}

%%% 1. Define a landscape slide with running title:
%%%  (the title  will be placed in the header of continuation slides)
%%%  add slide title to contents:
\newenvironment{cadslide*}[1]%
{\begin{slide}\heading{#1}%
 \renewcommand{\slheader}{}%
 \renewcommand{\storedheader}{#1}%
 \slideheading[#1]{}%
}%
{\end{slide}}

%%% 2. landscape again, but dont put slide title in contents:
\newenvironment{cadslide}[1]%
{\begin{slide}\heading{#1}%
 \renewcommand{\slheader}{}%
 \renewcommand{\storedheader}{#1}%
}%
{\end{slide}}

%%% 3. Now for rotated (ie portrait slides):
%%% WITHOUT slide header added to contents:
\newenvironment{cadslideportrait}[1]%
{\begin{slide*}\heading{#1}%
 \renewcommand{\slheader}{}%
 \renewcommand{\storedheader}{#1}%
}%
{\end{slide*}}

%%% 4. portrait, WITH slide header added to contents:
\newenvironment{cadslideportrait*}[1]%
{\begin{slide*}\heading{#1}%
 \renewcommand{\slheader}{}%
 \renewcommand{\storedheader}{#1}%
 \slideheading[#1]{}%
}%
{\end{slide*}}

%%% 5. finally, this rotates headers/footers instead of leaving them
%%% in landscape orientation 
\rotateheaderstrue

%%% This does the running title on continuation slides:
\newcommand{\continueslide}%
      {\newslide\renewcommand{\slheader}{\storedheader%
          \ (Continued)}}

%%% This declares the new slide styles:
\addtoslidelist{cadslide}
\addtoslidelist{cadslide*}
\addtoslidelist{cadslideportrait}
\addtoslidelist{cadslideportrait*}

%%% The Basic page style has the continuation title as header, and a
%%%   3-part footer (University, <some info (eg conference title)>, page number)
\newpagestyle{basic}%
  {\hfil {\sf \slheader} \hfil}%
%  {{\tiny\sf University of Manchester}%
%     \hfil {\tiny \theslide}}
  {\rlap{\Rfleft}%
   \hss{\Rfcent}%
   \hss\llap{\Rfright}}

%%% Declare the `basic' page style to be used:
\pagestyle{basic}

%%% choose a `fancy' oval slide border (see `seminar' documentation
%%% for options)
\slideframe{Oval}

%%% set the default font:
\renewcommand{\familydefault}{\sfdefault}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%% Do the same thing, but now use coloured borders/headings

\usepackage{color}    % use the `color' package (see Lamports LaTeX2e
                      % user guide)

%%% 1. Landscape slide with color heading:
%%% usage: \begin{colcadslide{green}{Heading}
%%%          This produces a slide with a green heading
%%%        \end{colcadslide}
\newenvironment{colcadslide}[2]%
{\begin{slide}\heading{\textcolor{#2}{#1}}%
 \renewcommand{\slheader}{}%
 \renewcommand{\storedheader}{\textcolor{#2}{#1}}%
 \normalcolor
}%
{\end{slide}}

%%% 2. continuation color slide
\newcommand{\continuecolslide}%
      {\newslide\renewcommand{\slheader}{\storedheader%
          \ \textcolor{black}{(Continued)}} \normalcolor}

%%% 3. add `colcadslide' to the recognised slide style list:
\addtoslidelist{colcadslide}

%%% 4. define a colorful slide style:
%%% this has a border, with slide header, and blue university footer:
\newpagestyle{colbasic}%
  {\hfil {\sf \slheader} \hfil}%
  {{\tiny\sf \textcolor{red}{University of Manchester}}%
     \hfil {\tiny \textcolor{black}{\theslide}}}

%%% use the following for a `colbasic' page style:
%\pagestyle{colbasic}

%%% use the following for a blue slide border:
%\slideframe[\color{blue}]{Oval}

%%% redefine the table of contents to give 2 column bulleted lists 
%%%   without any `page' number:
%%%  (used by \slidecontents)
\makeatletter
\def\slide@contents{%
  \def\l@slide##1##2##3{%
    \item ##2}%
  \let\l@subslide\@gobbletwo%
  \begin{multicols}{2}
  \begin{slitemize}{$\bullet$}
  \@startlos
  \end{slitemize}
  \end{multicols}}
\makeatother


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Now for some other LaTeX things, nothing to do with slides:
\parskip 0.1em
\parindent 0pt

\setcounter{secnumdepth}{4}

\setlength{\itemsep}{0.1em}
\setlength{\topsep}{0.1em}
\setlength{\parsep}{0.1em}

%%% change spacing on lists:
%%%   (argument gives marker)
\newenvironment{slitemize}[1]%
    {\begin{list}{#1}{\setlength{\itemsep}{0.1em}%
      \setlength{\topsep}{0.1em}%
      \setlength{\parsep}{0.1em}}}%
{\end{list}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
