% LaTeX Macros for COM 3351 problem sets
\course{COM 3351}
\instructor{Dr.~Wand}
\def\titlefont{\large}
\def\section#1{\begin{center}\bf #1\end{center}}

\parindent 0pt

\input tt  
\def\ttpage{\newpage\ttnoi}
\def\tpage#1{\newpage\begin{center}\bf #1\end{center}}

\def\eqalign#1{{\def\cr{\\}\begin{array}{r@{{}}l}#1\end{array}}}

% tilde, backslash
\def\til{{\tt\char'176}}  % \tt tilde
\def\bs{\tt\char'134} % \tt backslashes

%\def\libdir{\til wand/pub/plangs}
\def\libdir{/course/com3351/pub}

% for BNF grammars
\def\nt#1{\hbox{$\langle\hbox{\rm #1}\rangle$}}
\def\term#1{\,\hbox{\tt #1}\,}
\def\lparen{\term{(}}
\def\rparen{\term{)}}

% '~' is used as a tie in text and to separate parts of terms in math mode
\def~{\relax\ifmmode \mskip\thinmuskip \else \penalty10000 \ \fi}

% for semantics
\def\mdef#1#2{\def#1{\relax\ifmmode #2 \else $#2$\fi}}
\def\semfcn#1#2{\mathop{#1}\nolimits\lbrack\!\lbrack{#2}\rbrack\!\rbrack}

% for comments (Note \par)
\def\cmt#1\par{$\lbrack\!\lbrack$ #1 $\rbrack\!\rbrack$\par}

\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\day, \number\year}


\def\exam#1 dated #2 \par{%
\line{COM 3351\hfill #2}
\line{Dr.~Wand\hfill}
\bigskip
\centerline{\bf #1}
\bigskip
\line{Name: \hbox to 3truein{\hrulefill}\quad ID: \hbox to
1.5truein{\hrulefill}\hfill} 
\bigskip
\itemcount=0
}

\def\eqalign#1{{\def\cr{\\}\begin{array}{r@{{}}l}#1\end{array}}}


% gramalign automatically inserts the ::='s.  A third field is available for
% comments, etc.
%
\def\gramalign#1{\begin{array}{l@{{}::={}}ll}#1\end{array}}


% \altalign is like \gramalign, but the ::= have to be inserted, so
% that \alt may be used instead.
%
\def\altalign#1{\begin{array}{l@{{}}lll}#1\end{array}}


\mdef\alt{~~\vert~~}
\def\forcemath#1{\ifmmode #1 \else $#1$\fi}

% Kleene star, plus
\def\st#1{\forcemath{\{#1\}^*}}
\def\pl#1{\forcemath{\{#1\}^+}}

