%%
%%  Class:  fgvienna
%%
%%  Author: Gerhard Jaeger
%%          Institut fuer Linguistik
%%          Universitaet Potsdam
%%  Email:  jaeger@ling.uni-potsdam.de
%%
%%  Based on a style file by Geert-Jan Kruijff for FG99
%%
%%  FGVIENNA modifies the standard book class for LaTeX2e, by redefining commands
%%  available provided by the book class, and by providing some extra commands.
%%  FGPROC defines the format for Formal Grammar Proceedings
%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{fgvienna}[1998/11/24 FG Proceedings style]
\typeout{}
\typeout{FGVIENNA book style, Gerhard Jaeger, May 2003}
\typeout{=================================================}



%% --------------------------------------------------------------
%% Options and catches for the FGVIENNA class 


\DeclareOption{10pt}{
                \PackageWarning{FGVIENNA}{No `10pt' available - Pointsize will be automatically set to 11pt.}} 
\DeclareOption{12pt}{
                \PackageWarning{FGVIENNA}{No `12pt' available - Pointsize will be automatically set to 11pt.}} 
\DeclareOption{letter}{
                \PackageWarning{FGVIENNA}{No `letter' available - Pagesize will be automatically set to A4.}}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions\relax
\LoadClass[a4paper,11pt]{book}
\usepackage{times}
\usepackage[sectionbib]{natbib}
\bibliographystyle{fgvienna}

%%%%%%% =========================================================                
%%%%%%%                  CLASS DEFINITION
%%%%%%% =========================================================

%% --------------------------------------------------------------
%% New commands for the FGVIENNA class:
%%

\newcommand{\theFGyear}{2003}
\newcommand{\FGyear}[1]{\renewcommand{\theFGyear}{#1}}

\newcommand{\chaptauth}{}
\newcommand{\chapterauthor}[1]{\textsc{#1}\vspace{30pt}\renewcommand{\chaptauth}{#1}}
\newcommand{\chapttitle}{}

\newenvironment{chapterabstract}
        {\vspace{-10pt}\scriptsize
         \begin{list}{}{%
         \setlength{\rightmargin}{\leftmargin}}     
                \item[]\textsc{Abstract. }}     
        {\end{list}\normalsize\vspace{5pt}}
\newcommand{\chaptersubtitle}[1]{\vspace{-35pt}\begin{flushleft}\large\textbf{#1}\end{flushleft}}

%% --------------------------------------------------------------
%% Redefined \maketitle: Makes cover page FG Proceedings 
%%

\renewcommand{\maketitle}{
 \begin{titlepage}
  \vspace{1cm}
  \begin{center} 
     \vbox{
     \large{\textbf{}}\\[1cm]
     \Huge{\textsl{\textbf{Proceedings}}}\\[1cm] 
     \large{\textbf{of}}\\[1cm]
     \Huge{\textsl{\textbf{Formal Grammar \theFGyear{}}}}\\[1cm] 
     \large{\textsl{\textbf{Gerhard J\"ager, Paola Monachesi, Gerald
     Penn and Shuly Wintner (editors)}}}
     }
  \end{center}
  
  \vfill
 
  \end{titlepage}
}


%% ----------------------------------------------------------------
%% Redefined \chapter: Makes chapter page in FG Proceedings style,
%% with offprint info at the bottom. 


\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                    \pagestyle{headings}
                    \thispagestyle{fg}%
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}



\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter}#1}%
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \renewcommand{\chapttitle}{#1}
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\def\@makechapterhead#1{%
  \vspace*{20\p@}% GJ: less space off the top (used to be 50)
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \Large\bfseries \@chapapp\space 
        \thechapter \vspace{-12pt} \par
%        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \leavevmode \hrulefill \linebreak \null \vspace{-25pt} \par% add a horizontal rule between the chapter number and the title
 
%    {\flushright \LARGE \bfseries #1\par\nobreak} 
    {\flushleft \LARGE \bfseries #1\par\nobreak}     % Left mode

    \vskip 40\p@
  }}
\def\@schapter#1{\if@twocolumn
                   \@topnewpage[\@makeschapterhead{#1}]%
                 \else
                   \@makeschapterhead{#1}%
                   \@afterheading
                 \fi}
\def\@makeschapterhead#1{%
  \vspace*{20\p@}%
  {%\parindent \z@ \raggedright 
   \parindent \z@ %\raggedleft % Left or right ....
    \normalfont
    \interlinepenalty\@M
    \leavevmode \hrulefill \linebreak \null \vspace{-25pt} \par% add a horizontal rule between the chapter number and the title
    \vspace{12pt} \Large \bfseries  #1 \par\nobreak
    \vskip 40\p@
  }}


%
% FGProceedings offprint note to beginning of a chapter
%

\def\ps@fg{\advance\footskip by30pt%
    \let\@oddhead\@empty\let\@evenhead\@empty
    \def\@evenfoot{\vbox{
        \begin{center}\thepage\end{center}\vspace{5pt}
        \textit{\scriptsize{Proceedings of Formal Grammar \theFGyear{}}} \\
        \scriptsize{G.\ J\"ager, P.\ Monachesi, G.\ Penn \& S.\ Wintner (editors)}.\\ 
        \scriptsize{Chapter \thechapter{}, Copyright} \copyright \scriptsize{\theFGyear, \chaptauth.\hfil}
        }}%
    \def\@oddfoot{\@evenfoot}%
    }

%%
%% Renewed pageheader style
%%
%% 


\renewcommand{\ps@headings}{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\small\hfil{\textsl\chapttitle : \textsl\chaptauth}\hfil\thepage}%
    \def\@oddhead{\small\thepage$\setminus$\hfil\textsl{Formal Grammar \theFGyear}\hfil}%
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    }






%% --------------------------------------------------------------
%% Log of changes

