%%
%%    File : csposter.cls    (LaTeX2e class file)
%%  Author : Martin Reddy (mxr@dcs.ed.ac.uk) 
%% Version : 1.1
%% Updates : 1.0 [14/2/97] - initial release.
%%           1.1 [14/3/97] - center caption, colour changes
%% 
%% This file contains a class definition, csposter, for the LaTeX2e
%% system which defines the layout of posters in the style of
%% University of Edinburgh.
%%
%% For information on this class, please refer to "texdoc csposter"
%%
%% The following LaTeX packages are required by this class:
%%    pstricks - to embed the background EU crests and border.
%%    epsfig   - to display all EPS figures
%%    multicol - to produce the 3 column text.
%%

\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesClass{csposter}[1997/02/14 v1.1 Computer Science Poster Class - MXR]

%%
%% --- Initial Code ---
%%

\newlength{\posterwidth}
\newlength{\posterheight}

\newcommand{\poster@columns}{}
\newcommand{\poster@depturl}{}
\newcommand{\poster@deptname}{}
\newcommand{\poster@centre}{}

\newdimen\poster@colwidth

%%
%%  --- Options ---
%%

\DeclareOption{a0}{
  \setlength{\posterheight}{840mm}
  \setlength{\posterwidth}{1188mm}
}

\DeclareOption{center}{\renewcommand{\poster@centre}{yes}}
\DeclareOption{centre}{\renewcommand{\poster@centre}{yes}}

\DeclareOption{twocolumn}{%
  \renewcommand{\poster@columns}{2}
  \poster@colwidth = 1560pt
}
\DeclareOption{threecolumn}{
  \renewcommand{\poster@columns}{3}
  \poster@colwidth = 1040pt
}
\DeclareOption{fourcolumn}{
  \renewcommand{\poster@columns}{4}
  \poster@colwidth = 780pt
}

\DeclareOption{cs}{
  \renewcommand{\poster@deptname}{Department of Computer Science}
  \renewcommand{\poster@depturl}{http://www.dcs.ed.ac.uk/}
}

\DeclareOption{lfcs}{
  \renewcommand{\poster@deptname}%
    {Laboratory for Foundations of Computer Science}
  \renewcommand{\poster@depturl}{http://www.dcs.ed.ac.uk/lfcs}
}

\ExecuteOptions{a0,cs,threecolumn}

\ProcessOptions

%%
%% --- Class Loading (built ontop of article.cls) ---
%%

\LoadClass{article}

%%
%% --- Main Code ---
%%

\usepackage{pstricks}
\usepackage{epsfig}
\usepackage{multicol}

%% Set up the default colours for the poster.
%% These can be modified directly by the user

\let\ItemizeColour\magenta
\let\SectionColour\blue
\let\TitleColour\black
\let\SubtitleColour\black
\let\AuthorColour\black
\let\AbstractColour\black
\let\CaptionColour\red

%% provide a number of lengths to let the user
%% customise the spacing of the poster

\newlength{\SpaceAfterTitle}
\newlength{\SpaceAfterSubtitle}
\newlength{\SpaceAfterAuthor}
\newlength{\SpaceAfterAbstract}
\newlength{\SpaceBeforeText}
\newlength{\SpaceToColumnSep}
\newlength{\SpaceTemp}

\setlength{\SpaceToColumnSep}{5em}

\newenvironment{posterindent}
   {\list{}{\setlength\leftmargin\SpaceToColumnSep%
   \setlength\rightmargin\leftmargin}\item\relax}
   {\endlist}

%% keep a track of whether \makeposter has been called. If it has
%% then we need to do an \end{multicols}

\def\poster@true{1}
\def\poster@false{0}
\let\poster@displayed\poster@false

\AtEndDocument{%
  \if\poster@displayed\poster@true \end{posterindent} \end{multicols} \fi%
}

%% setup the multicols environment

\columnseprule=.5mm
\flushcolumns

%% Setup some really big fonts. This is a pain to do, so I'm just
%% going to use the style files from the FoilTeX system which already
%% do this.

\input{fltfonts.def}
\input{foil30.clo}
\renewcommand\familydefault{\rmdefault}

% Modify the FoilTeX defs a bit so we can have *really* big font 
% sizes for the main title and sub title.

\DeclareFontShape{OT1}{fcmr}{bx}{n}{%
  <12><14.4><17.28><20.74><24.88><29.86><35.83><43.00><51.60><72>cmbx10}{}

\DeclareFontShape{OT1}{fcmr}{bx}{sl}{%
  <12><14.4><17.28><20.74><24.88><29.86><35.83><43.00><51.60><64>cmbxsl10}{}

\newcommand{\poster@maintitlefont}{%
  \fontencoding{OT1}\fontfamily{fcmr}\fontseries{bx}%
  \fontshape{n}\fontsize{72}{84}\selectfont%
}

\newcommand{\poster@subtitlefont}{%
  \fontencoding{OT1}\fontfamily{fcmr}\fontseries{bx}%
  \fontshape{sl}\fontsize{64}{72}\selectfont%
}

%% define the page size and various margins/offsets

\setlength{\topmargin}{0in}
\setlength{\oddsidemargin}{0.5in}
\setlength{\evensidemargin}{0.5in}

\setlength{\footskip}{0.5in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\voffset}{0in}
\setlength{\hoffset}{0in}

\setlength{\textwidth}{0.93\posterwidth}
\setlength{\textheight}{0.91\posterheight}

%% Define lengths for the poster border, shield position, etc.

\newlength{\borderheight}
\setlength{\borderheight}{\posterheight}
\addtolength{\borderheight}{-2.166in}

\newlength{\borderwidth}
\setlength{\borderwidth}{\posterwidth}
\addtolength{\borderwidth}{-2.5in}

\newlength{\shieldoffset}
\setlength{\shieldoffset}{\posterwidth}
\addtolength{\shieldoffset}{-5.5in}

%% Add a \special for dvips to generate correct PS
%%   a4 210mm 297mm, a3 297mm 420mm, a2 420mm 594mm
%%   a1 594mm 840mm, a0 840mm 1188mm  (33.07in x 46.77in)

\special{papersize=1188mm,840mm}

%% Specify the embedded PS layout to do at the start of the document
%% This includes the greyed-logo and colour shield in the top corners
%% and the blue frame around the poster.

\AtBeginDocument{%
  \rput(\shieldoffset,-2.74in){
    \epsfig{file=EUShield.ps,width=7in}
  }%
  \rput(4.475in,-5.678in){
    \epsfig{file=greylogo.ps,width=10in}
  }%
  \psframe[linewidth=1mm,linecolor=blue,framearc=0.004,fillstyle=none]%
  (-0.5in,-\borderheight)(\borderwidth,0.166in)%
  % Now we will add some empty boxes in order to put TeX stuff beyond
  % all the pstricks stuff, otherwise it gets ignored by dvips -E
  \hskip -1in\hbox{\white\vrule height0.7in depth0pt width1pt}%
  \setlength\SpaceTemp{\posterwidth}%
  \addtolength\SpaceTemp{-1in}%
  \hskip \SpaceTemp%
  \hbox{\white\vrule height0.7in depth0pt width1pt}%
}

%% Macros to input the poster titles, author, etc.

\newcommand{\poster@title}{}
\newcommand{\poster@subtitle}{}
\newcommand{\poster@author}{}
\newcommand{\poster@abstract}{}
\newcommand{\poster@enquiries}{}
\newcommand{\poster@empty}{}

\newcommand{\subtitle}[1]{\renewcommand{\poster@subtitle}{#1}}
\newcommand{\enquiries}[1]{\renewcommand{\poster@enquiries}{#1}}
\renewcommand{\title}[1]{\renewcommand{\poster@title}{#1}}
\renewcommand{\author}[1]{\renewcommand{\poster@author}{#1}}
\renewcommand{\abstract}[1]{\renewcommand{\poster@abstract}{#1}}

%% Define the \makeposter command which generates the poster header.
%% We also keep a track of whether this is called or not so that we
%% know if we are to do anything at the end of the document.

\newcommand{\makeposter}{%
  \if\poster@displayed\poster@false
    \let\poster@displayed\poster@true%
    \begin{minipage}[b]{\textwidth}%
      \begin{minipage}[t]{27pt} \vskip 5in\hfil \end{minipage}%
      \begin{minipage}[t]{0.85\textwidth}
        \ifx\poster@title\poster@empty \typeout{WARNING: No Title} \else
          \vskip -20pt{\TitleColour\poster@maintitlefont\poster@title}%
          \vskip \SpaceAfterTitle%
        \fi
        \ifx\poster@subtitle\poster@empty \else
          \vskip 20pt{\SubtitleColour\poster@subtitlefont\poster@subtitle}%
          \vskip \SpaceAfterSubtitle%
        \fi
        \ifx\poster@author\poster@empty \else
          \vskip 50pt{\AuthorColour\Huge\bfseries\em\poster@author}%
          \vskip \SpaceAfterAuthor%
        \fi
        \ifx\poster@abstract\poster@empty \else
          \vskip 50pt{\AbstractColour\large\bfseries\underbar{Abstract}:
          \poster@abstract}\vskip \SpaceAfterAbstract%
        \fi
        \advance\SpaceBeforeText 50pt
        \vskip \SpaceBeforeText\ \ %
      \end{minipage}\hfil%
    \end{minipage}
    \ifx\poster@centre\poster@empty \else \vfil \fi
    \advance\poster@colwidth -2\SpaceToColumnSep
    \begin{multicols}{\poster@columns}  % closed by AtEndDocument
    \begin{posterindent}                % closed by AtEndDocument
  \else
    \typeout{WARNING: you can only call maketitle once per document}
  \fi
}
\let\maketitle\makeposter

%% do the standard header/footer stuff

\newcommand{\ps@firstpage}{%
  \let\@evenhead=\@empty
  \let\@evenfoot=\@empty
  \let\@oddhead=\@empty
  \renewcommand{\@oddfoot}{%
    \small \vbox to \topskip {\vss
      \begin{center}
        \leavevmode 
        The University of Edinburgh, \poster@deptname.
        \ifx\poster@enquiries\poster@empty
          WWW page, \poster@depturl
        \else
          Enquiries to: \poster@enquiries
        \fi
      \end{center}%
    \vss}%
    % Now we will add an empty box in order to put TeX stuff beyond
    % all the pstricks stuff, otherwise it gets ignored by dvips -E
    \hskip -1pt\hbox{\white\vrule height0pt depth1.5in width1pt}%
  }%
}

\pagestyle{empty}
\thispagestyle{firstpage}

%% redefine sectioning, captioning, etc. to be in colour and unnumbered

\renewcommand{\section}[1]{%
  \vskip 3ex plus 0.5ex minus 3ex%
  {\SectionColour\Huge\bfseries #1}%
  \vskip 1ex plus 0.5ex minus 0.5ex\par
}
\renewcommand{\subsection}[1]{%
  \vskip 2.5ex plus 0.3ex minus 2ex%
  {\SectionColour\Large\bfseries #1}
  \vskip 1ex plus 0.5ex minus 0.5ex\par
}

\renewcommand{\caption}[1]{%
  \vbox{\begin{posterindent}\begin{center}%
  {\CaptionColour\em #1}\end{center}\end{posterindent}}
}

\renewcommand{\labelitemi}{\ItemizeColour$\bullet$}
\renewcommand{\labelitemii}{\ItemizeColour\bfseries --}
\renewcommand{\labelitemiii}{\ItemizeColour$\ast$}
\renewcommand{\labelitemiv}{\ItemizeColour$\cdot$}

%% provide a simple mechanism to incorporate EPS figures
%% \epsfigure[width-percentage]{filename}{caption}

\newdimen\poster@figwidth
\newcount\poster@figmult

\newcommand{\epsfigure}[3][75]{%
  \poster@figmult = \number#1
  \ifnum#1<5
     \typeout{WARNING: Figure width must be >= 5 percent. Resetting to 75.}
     \poster@figmult = 75
  \else \ifnum#1>100
     \typeout{WARNING: Figure width must be <= 100 percent. Resetting to 75.}
     \poster@figmult = 75
  \fi\fi
  \poster@figwidth = \poster@colwidth
  \divide\poster@figwidth by 100
  \multiply\poster@figwidth by \poster@figmult
  \begin{center}\vbox{%
     \vskip 25pt plus 5pt minus 5pt
     \epsfig{file=#2,width=\poster@figwidth}
     \vskip 25pt plus 5pt minus 5pt
     \caption{#3}}
  \end{center}%
}

%% Turn off page numbering and setup paragraph spacing etc. 

\parindent=0in
\parskip=30pt

%%
%% EOF: csposter.cls
%%
