%%
%% This file defines the documentclass for abstracts submitted to the ECQT 2014 conference
%% August 20-22, 2014, Ghent, Belgium
%%
%% Based on the informs2013-package
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ecqt-abstract}[2014/01/28 v0.1: ECQT 2014 Conference Abstract class (author-version)]

\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=ecqt,prefix=ecqt@}
\DeclareVoidOption{keep}{\def\ecqt@excess{keep}}
\DeclareVoidOption{lax}{\def\ecqt@excess{lax}}
\DeclareVoidOption{strict}{\def\ecqt@excess{strict}}
\DeclareStringOption[strict]{excess}
\ExecuteOptions{excess=strict}
\ProcessKeyvalOptions*

\LoadClass[a4paper,11pt]{article}

\RequirePackage[
	textheight = 125mm,
	top = 20mm,
	textwidth = 170mm
]{geometry}

\parindent 0 mm
%\parskip 0.25 em
\parskip 0 em

\def\TitleFont{\fontsize{11.74988pt}{1em}\bfseries\sffamily\selectfont\MakeUppercase}%

\let\originalauthor\author
\renewcommand{\author}[2]{\g@addto@macro\@author{\textbf{#1}, #2 \newline}}

\let\part\undefined
\let\chapter\undefined
\let\section\undefined
\let\subsection\undefined
\let\subsubsection\undefined
\let\paragraph\undefined
\let\subparagraph\undefined
\renewenvironment{abstract}{
	\PackageError{ecqt}{The abstract-environment must not be used}
}{}

\RequirePackage{ifthen}
\RequirePackage{atbegshi}
\AtBeginShipout{
	\ifthenelse{\thepage > 1}
	{
		\ifthenelse{\equal{\ecqt@excess}{strict}}
		{
			\AtBeginShipoutDiscard
			\PackageError{ecqt}{The abstract is too long}
		}{}
		\ifthenelse{\equal{\ecqt@excess}{lax}}
		{
			\AtBeginShipoutDiscard
			\PackageWarning{ecqt}{The abstract is too long, excess content is discarded}
		}{}
		\ifthenelse{\equal{\ecqt@excess}{keep}}
		{
			\PackageWarning{ecqt}{The abstract is too long}
		}{}
	}{}
}

\renewcommand\maketitle{\par
  \begingroup
    \@maketitle
    \thispagestyle{empty}\@thanks
  \endgroup
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
  \parskip 0.25 em
}
\def\@maketitle{%
  \null
    \let \footnote \thanks
    {\TitleFont \@title \vskip 0.25em}%
    {\@author \vskip -2mm}%
}