%%% Ling.sty 
%%%  Enumerated examples, based on Emma Pease's macros from lingmacro.sty
%%%  RPM  20-Jun-1995

%%% Changes:
%%%    10-Jul-1995 - Remove \vskip-\baselineskip from enum environment
%%%    14-Mar-1996 - Fix \tag to work right in subscripts
%%%    08-Aug-1996 - Make tags sans serif

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ling}[1996/08/08 Rob's linguistics macros]

%\RequirePackage{hpsg}
\RequirePackage{enum}
\RequirePackage{gloss}
\RequirePackage{relsize}

%%
%% Added macros
%%

\def\_{\lower .75ex\hbox{---}}
\def\f#1{{\small\sc #1}}

\def\stigma#1{\hskip0pt\llap{#1}}
\def\bad#1{\stigma{*}#1}
\def\fair#1{\stigma{?}#1}
\def\soso#1{\stigma{??}#1}

%\newenvironment{examples}{\vglue 9pt plus 3pt minus 5pt}%
%  {\vglue 9pt plus 3pt minus 5pt}

%\newenvironment{examples}{\begin{singlespace}}{\end{singlespace}\noindent}

%\def\tree#1#2#3{{\renewcommand{\arraystretch}{2}
%    \enumsentence{#1}{\modsmalltree{#2}{#3}}}}

%
% Examples with citations
%

% (from TeXbook, p. 106)


\def\shove#1{{\unskip\nobreak\hfil\penalty50\hskip2em\hbox{}\nobreak
  \hfil#1\parfillskip=0pt\finalhyphendemerits=0\par}}

% modsmalltree
% use 
% \modsmalltree{3}{&&a\\ &b&&c\\ d&&e&&f}
% and produces the same output
% \mc{n}{item} within either will produce item centered across n
% number of columns
% \modsmalltree[arraystretch]{num of cols}{argument}
%
\def\modsmalltree{\@ifnextchar[{\@modsmalltree}{\@modsmalltree[2]}}

\long\def\@modsmalltree[#1]#2#3{{\def\mc##1##2{%
\multicolumn{##1}{c}{\def\arraystretch{1}##2}}%
\def\arraystretch{#1}%
\def\ns{\def\arraystretch{1}}%
\setbox0=\hbox{\begin{tabular}[t]{@{}*{#2}{c}@{}}
#3
\end{tabular}}%
\dimen0=\ht0
\advance\dimen0 by -\arraystretch \ht\strutbox
\advance\dimen0 by \ht\strutbox
\ht0=\dimen0
\dimen0=\dp0
\advance\dimen0 by -\arraystretch \dp\strutbox
\advance\dimen0 by \dp\strutbox
\dp0=\dimen0
\leavevmode\box0}}

%\def\evnup{\@ifnextchar[{\@evnup}{\@evnup[0pt]}}
%\def\@evnup[#1]#2{\setbox1=\hbox{#2}%
%\dimen1=\ht1 \advance\dimen1 by -.5\baselineskip%
%\advance\dimen1 by -#1%
%\leavevmode\lower\dimen1\box1}

\newcommand{\evnup}[2][0pt]{\setbox1=\hbox{#2}%
\dimen1=\ht1 \advance\dimen1 by -.5\baselineskip%
\advance\dimen1 by -#1%
\leavevmode\lower\dimen1\box1}

% Tag macros

\def\@nameedef#1{\expandafter\edef\csname #1\endcsname}

\def\tl@{t@@}

%\def\@push#1#2{\ifx#1\empty{\xdef#1{#2}}{\xdef#1{#1,#2}}}
\def\@push#1#2{\xdef#1{#1,#2}}

\newcount\@tagcount\@tagcount=1
\def\@tag#1#2{\,\fbox{\smaller$#1\mathsf{\@nameuse{t@#2}}$}\,}
\def\tag#1{\@ifundefined{t@#1}{\relax
  \expandafter\xdef\csname t@#1\endcsname{\number\@tagcount}\relax
  \global\advance\@tagcount1\@push{\tl@}{t@#1}}{}\relax
  \ensuremath{\mathchoice{\@tag\displaystyle{#1}}{\@tag\textstyle{#1}}{\@tag\scriptstyle{#1}}{\@tag\scriptscriptstyle{#1}}}}

\def\resettags{\@for\@tempt:=\tl@\do
  {\global\expandafter\let\csname \@tempt\endcsname\relax}
  \gdef\tl@{t@@}\global\@tagcount=1}

%\newenvironment{examples}{\relax}{\relax}

\fboxsep=1.5pt
%{\catcode`\<=\active\catcode`\>=\active
%\gdef\makeangleactive{\catcode`\<=\active\catcode`\>=\active
%                     \def<{$\langle$}\def>{$\rangle$}}}

%\def\smaller{\ifx\@currsize\normalsize\small\else
%               \ifx\@currsize\small\footnotesize\else
%                 \ifx\@currsize\footnotesize\scriptsize\else
%                   \ifx\@currsize\scriptsize\tiny\fi
%                 \fi
%               \fi
%             \fi}
