%  
%  class for SFB conference 
%  "Linguistic Evidence"
%  17.02.2004   Stephan Kepser
%

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{le}[2004/02/17]

\typeout{Document Class `Linguistic Evidence Proceedings' <17 February 2004>}


\DeclareOption*{\OptionNotUsed{\CurrentOption}}
\ProcessOptions
\LoadClass[11pt,twoside]{article}

\RequirePackage{pslatex}
\RequirePackage{a4}
\RequirePackage{natbib}
\bibpunct{(}{)}{;}{o}{}{,}
\RequirePackage{url}
\RequirePackage{fancyheadings}




% Listenumgebung fuer Literaturangaben
\newenvironment{vlist}{\begin{list}{}{
\topsep 0pt \leftmargin 1em \itemindent -1em \itemsep 4pt \parsep 0pt
\labelsep 0pt \labelwidth 0pt}}{\end{list}}

% text area
\textheight180mm 
\textwidth118mm
\setlength{\headsep}{5mm}



\setcounter{section}{0}
\setcounter{subsection}{0}
\setcounter{page}{1}

% head and foot
\pagestyle{fancy}
\headrulewidth0pt
\lhead[\fancyplain{}{\thepage\hspace*{3mm}\small\itshape\rauth}]{\fancyplain{}{}}
\rhead[\fancyplain{}{}]{\fancyplain{}{{\small\itshape\rtitle}\hspace*{3mm}\thepage}}
\cfoot[\fancyplain{}{}]{\fancyplain{}{}}

\newcommand{\rauth}{}
\newcommand{\runningauthor}[1]{\renewcommand{\rauth}{#1}}
\newcommand{\rtitle}{}
\newcommand{\runningtitle}[1]{\renewcommand{\rtitle}{#1}}

% new sizes for (sub)sections

\renewcommand\normalsize{%
   \@setfontsize\normalsize\@xipt{13}%
   \abovedisplayskip 11\p@ \@plus3\p@ \@minus6\p@
   \abovedisplayshortskip \z@ \@plus3\p@
   \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
   \belowdisplayskip \abovedisplayskip
   \let\@listi\@listI}

\setlength\parindent{5mm}

\renewcommand\section{\@startsection{section}{1}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries}}



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

\setlength{\bibhang}{0pt}
\setlength{\bibindent}{0pt}


\newcommand{\biblio}[3]{%
  \vspace{0pt plus 7pt}\par
  \noindent
  \small
  \hangindent=2cm \hangafter=2
  {#1}\newline
  %\hspace*{-\leftmargini}
  \makebox[2cm][l]{\hspace{1em}#2}\ignorespaces
  \parbox[t]{97mm}{#3}}

\newcommand{\biblioff}[2]{%
  \vspace*{-1.5ex}\par
  %\vspace{0pt plus 7pt}\par
  \noindent
  \hangindent=2cm \hangafter=1
  %\hspace*{-.8ex}
  \makebox[2cm][l]{\hspace{1em}#1}\ignorespaces
  \parbox[t]{97mm}{#2}}





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

%%%%%%%%%% endnotes
%
%   John Lavagnino (lav@brandeis.bitnet), 9/23/88
%   (plus modifications)
%  To turn all the footnotes in your documents into endnotes, say
%%%%%%%
     \let\footnote=\endnote
%%%%%%%%
%  in your preamble, and then add something like
%
%     \newpage
%     \begingroup
%     \parindent 0pt
%     \parskip 2ex
%     \def\enotesize{\normalsize}
%     \theendnotes
%     \endgroup
%
% as the last thing in your document.
%
%       ****************************************
%       *        ENDNOTE COMMANDS              *
%       ****************************************
%
%
%   \endnote{NOTE}       : User command to insert a endnote.
%
%   \endnote[NUM]{NOTE}  : User command to insert a endnote numbered
%                           NUM, where NUM is a number -- 1, 2,
%                           etc.  For example, if endnotes are numbered
%                           *, **, etc. within pages, then  \endnote[2]{...}
%                           produces endnote '**'.  This command does  not
%                           step the endnote counter.
%
%   \endnotemark[NUM]    : Command to produce just the endnote mark in
%                           the text, but no endnote.  With no argument,
%                           it steps the endnote counter before  generating
%                           the mark.
%
%   \endnotetext[NUM]{TEXT} : Command to produce the endnote but no
%                              mark.  \endnote is equivalent to
%                              \endnotemark \endnotetext .
%
%   \addtoendnotes{TEXT} : Command to add text or commands to current
%                              endnotes file: for inserting headings,
%                              pagebreaks, and the like into endnotes
%                              sections.  TEXT a moving argument:
%                              \protect required for fragile commands.
%
%       ****************************************
%       *        ENDNOTE USER COMMANDS         *
%       ****************************************
%
%   Endnotes use the following parameters, similar to those relating
%   to footnotes:
%
%   \enotesize   : Size-changing command for endnotes.
%
%   \theendnote : In usual LaTeX style, produces the endnote number.
%
%   \@theenmark : Holds the current endnote's mark--e.g., \dag or '1' or 'a'.
%
%   \@makeenmark : A macro to generate the endnote marker from  \@theenmark
%                  The default definition is \hbox{$^\@theenmark$}.
%
%   \@makeentext{NOTE} :
%        Must produce the actual endnote, using \@theenmark as the mark
%        of the endnote and NOTE as the text.  It is called when effectively
%        inside a \parbox, with \hsize = \columnwidth.  For example, it might
%        be as simple as
%               $^{\@theenmark}$ NOTE
%
%
%
%       ****************************************
%       *           ENDNOTE MACROS             *
%       ****************************************
%

\@definecounter{endnote}
\def\theendnote{\arabic{endnote}}

% Default definition
\def\@makeenmark{\hbox{$^{\@theenmark}$}}

\newdimen\endnotesep

\def\endnote{\@ifnextchar[{\@xendnote}{\stepcounter
   {endnote}\xdef\@theenmark{\theendnote}\@endnotemark\@endnotetext}}

\def\@xendnote[#1]{\begingroup \c@endnote=#1\relax
   \xdef\@theenmark{\theendnote}\endgroup
   \@endnotemark\@endnotetext}

%  Here begins endnote code that's really different from the footnote
% code of LaTeX.

\let\@doanenote=0
\let\@endanenote=0

\newwrite\@enotes
\newif\if@enotesopen \global\@enotesopenfalse

\def\@openenotes{\immediate\openout\@enotes=\jobname.ent\relax
      \global\@enotesopentrue}

\long\def\@endnotetext#1{%
     \if@enotesopen \else \@openenotes \fi
     \immediate\write\@enotes{\@doanenote{\@theenmark}}%
     \begingroup
        \def\next{#1}%
        \newlinechar='40
        \immediate\write\@enotes{\meaning\next}%
     \endgroup
     \immediate\write\@enotes{\@endanenote}}

% \addtoendnotes works the way the other endnote macros probably should
% have, requiring the use of \protect for fragile commands.

\long\def\addtoendnotes#1{%
     \if@enotesopen \else \@openenotes \fi
     \begingroup
        \newlinechar='40
        \let\protect\string
        \immediate\write\@enotes{#1}%
     \endgroup}

%  End of unique endnote code

\def\endnotemark{\@ifnextchar[{\@xendnotemark
    }{\stepcounter{endnote}\xdef\@theenmark{\theendnote}\@endnotemark}}

\def\@xendnotemark[#1]{\begingroup \c@endnote #1\relax
   \xdef\@theenmark{\theendnote}\endgroup \@endnotemark}

\def\@endnotemark{\leavevmode\ifhmode
  \edef\@x@sf{\the\spacefactor}\fi \@makeenmark
   \ifhmode\spacefactor\@x@sf\fi\relax}

\def\endnotetext{\@ifnextchar
    [{\@xendnotenext}{\xdef\@theenmark{\theendnote}\@endnotetext}}

\def\@xendnotenext[#1]{\begingroup \c@endnote=#1\relax
   \xdef\@theenmark{\theendnote}\endgroup \@endnotetext}


%  \theendnotes actually prints out the endnotes.

%  The user may want separate endnotes for each chapter, or a big
% block of them at the end of the whole document.  As it stands,
% either will work; you just say \theendnotes wherever you want the
% endnotes so far to be inserted.  However, you must add
% \setcounter{endnote}{0} after that if you want subsequent endnotes
% to start numbering at 1 again.

%  \enoteformat is provided so user can specify some special formatting
% for the endnotes.  It needs to set up the paragraph parameters, start
% the paragraph, and print the label.  The \leavemode stuff is to make
% and undo a dummy paragraph, to get around the games \section*
% plays with paragraph indenting.

\def\notesname{Notes}% <------ JK
\def\enoteheading{\section*{\notesname
%%%%%%%%%  \@mkboth{\uppercase{\notesname}}{\uppercase{\notesname}}%
     }\@afterindenttrue%
%%%%%%%%%  \leavevmode\par\vskip-\baselineskip%
     \par}

%%%%%%%%\def\enoteformat{\rightskip\z@ \leftskip\z@ \parindent=1.8em
%%%%%%%%     \leavevmode\llap{\hbox{$^{\@theenmark}$}}}

\def\enotesize{\small}

\def\theendnotes{\immediate\closeout\@enotes \global\@enotesopenfalse
  \begingroup
    \makeatletter
% the following is to save catcode of ``>'' and restore it in \@endanenote
\edef\@tempa{`\string >}%
\ifnum\catcode\@tempa=11\let\@ResetGT\relax% accepts also that > were active
  \else\edef\@ResetGT{\noexpand\catcode\@tempa=\the\catcode\@tempa}%
\fi%
    \catcode`>=12%
%   \edef\GOfrench{`\string @}% temp def futher correctly defined
    \def\@doanenote##1##2>{\def\@theenmark{##1}\par\begingroup
        \@ResetGT%\catcode`>=13
        \edef\@currentlabel{\csname p@endnote\endcsname\@theenmark} %DW
        \enoteformat}
    \def\@endanenote{\par\endgroup}%
    \def\ETC.{\errmessage{Some long endnotes will be truncated; %
                            use BIGLATEX to avoid this}%
          \def\ETC.{\relax}}
    \enoteheading
    \enotesize
    \vspace*{-2ex}
    \input{\jobname.ent}%
  \endgroup}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%% Mods (hpk) for deGruyter:
\def\enoteformat{\rightskip\z@ \leftskip\z@ \par\parindent 15pt
  \hangindent15pt\hangafter1
  \leavevmode\llap{\hbox to 15pt{\enotesize\@theenmark}}}
\def\enotesize{\small}

\let\footnote=\endnote
\def\thanks#1{\addtoendnotes{\noindent #1\par\smallskip}}

