%%%%%%%%%%%%%%%%% Covington's Macros %%%%%%%%%%%%%%%%%%%%

\typeout{COVINGTN.STY = Covington's linguistic macros, 1991 Sept 10}

\renewcommand{\textfloatsep}{0.7in}

\raggedbottom

%
% Environment for hanging-indented list
%    (suitable for LSA-style reference list).
%    Does NOT require \item before entries.
%
\newenvironment{reflist}{\begin{list}{}%
{\setlength{\labelwidth}{0pt}
 \setlength{\labelsep}{0pt}
 \setlength{\leftmargin}{3em}
 \setlength{\itemindent}{-3em}
 \setlength{\listparindent}{-3em}
 \setlength{\itemsep}{6pt}}\item}{\end{list}}


%
% Exercises, numbered by subsection.
% even if next section not divided into subsections.
%    \begin{exercise} or \bx   begins an Exercise
%    \begin{exercise}[Project] begins a Project
%
\newtheorem{exercise}{Exercise}[subsection]

% Exercise numbering resets to 0 not only at the start of
% a subsection, but also at the start of a section or chapter
% even if it is not divided into subsections.
\@addtoreset{exercise}{section}
\@addtoreset{exercise}{chapter}

% Abbreviated commands...
\newcommand{\bx}{\begin{exercise}}
\newcommand{\ex}{\end{exercise}}

%
% Displayed natural-language sentence
%
\newcommand{\sentence}[1]
     {\begin{flushleft}{\it #1}\end{flushleft}}

%
% Alternatives within a sentence or ps-rule           / and \
%    Example: this \either{and}{or} that   is   this  \ or  /  that
%
\newcommand{\either}[2]
{
     $
     \left\{
     \begin{array}{l}
     \makebox{#1} \\
     \makebox{#2} \\
     \end{array}
     \right\}
     $
}


%
% Phrase-Structure Rules
%    Example: \psr{S}{NP~VP} is S -> NP VP.
%
\newcommand{\psr}[2]
     {\mbox{\it #1 $\rightarrow$ #2}}

%
% Feature Structures
%    Example: \fs{case:nom \\ person:P}
%    Better:  \fs{\it case:nom \\ \it person:P}  for true italics
%
%    Modified 1990 Dec 5 so that features are left aligned.
%
\newcommand{\fs}[1]
  {
    \mbox{\small%
          $
          \left[
          \!\!
          \it
          \begin{tabular}{l}
          #1
          \end{tabular}
          \!\!
          \right]
          $}
   }

%
% Labeled Feature Structures
% (like a Feature Structure but with a category label above it)
%     Example: \lfs{NP}{case:nom \\ person:P}
%     Better:  \lfs{NP}{\it case:nom \\ \it person:P}
%
%     Modified 1990 Dec 5 so that features are left aligned.
%
\newcommand{\lfs}[2]
   {
     \mbox{$
           \!\!
           \begin{tabular}{c}
           \it #1
           \\
           \mbox{\small%
                 $
                 \left[
                 \!\!
                 \it
                 \begin{tabular}{l}
                 #2
                 \end{tabular}
                 \!\!
                 \right]
                 $}
           \end{tabular}
           \!\!
           $}
   }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Discourse Representation Theory %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
% DRS in box notation
%
% Arguments:
%  1. List of discourse variables joined by ~
%  2. List of conditions joined by \\
% Example:   \drs{X}{donkey(X)\\green(X)}
% Example:   \drs{~}{purple(X,Y)}
% Example:   \drs{X}
%              {named(X,`Pedro') \\
%                \drs{Y}{donkey(Y)\\owns(X,Y)}~~
%                {\large $\Rightarrow$}~
%                \drs{~}{feeds(X,Y)}
%               }
%
\newcommand{\drs}[2]
{
    {
    \it
    \begin{tabular}{|l|}
    \hline
    ~ \vspace{-2ex} \\
    #1
    \\
    ~ \vspace{-2ex} \\
    \hline
    ~ \vspace{-2ex} \\
    #2
    \\
    ~ \\    % can't vspace here or the line will come out wrong
    \hline
    \end{tabular}
    }
}

%
% DRS connectives: \ifdrs, \negdrs
%
%  Example: \ifdrs{X~Y}{donkey(X)\\man(Y)}{~}{feeds(X,Y)}
%  Example: \negdrs{X}{green(X)\\donkey(X)}
%
\newcommand{\ifdrs}[4]
{
  \mbox{\drs{#1}{#2}~~{\large $\Rightarrow$}~\drs{#3}{#4}}
}
\newcommand{\negdrs}[2]
{
  \mbox{{\large $\neg$}\drs{#1}{#2}}
}

%
% \alifdrs  is like \ifdrs but aligned to match simple conditions
%           in the same drs.
\newcommand{\alifdrs}[4]
{
  \mbox{$\!\!\!$\drs{#1}{#2}~~{\large $\Rightarrow$}~\drs{#3}{#4}}
}



%
% Sentence with DRS displayed below it
%
%   Example: \sdrs{A dog barks.}{X}{dog(X)\\barks(X)}
%      (designed to be used within a displayed formula)
%
\newcommand{\sdrs}[3]
{\begin{tabular}{l}
\mbox{\it #1} \\
~ \\
\drs{#2}{#3}
\end{tabular}}


%%%%%%%%%%%%%%%%% End of Covington's Macros %%%%%%%%%%%%%%%%%
