%final.sty
%Nov. 21 1987
%Changes the way parameters are fed to macros
%This version is based on \hangindent
%Also corrected for CM fonts
%Uses rlap for subprobs, etc
%%
%% This file was originally developed by Marvin Kohn of the
%% Mathematics Department of Brooklyn College; I made various
%% changes in the file, mainly to allow it to typeset a
%% spreadout version of an exam, with work space for students.
%% Attila Mate, Wed May 24 22:05:14 EDT 2006.
\newif\iffootline
\footlinetrue
\newif\ifcompact
\compacttrue
\newif\ifheadbottomline
\headbottomlinetrue

\def\toplevelline#1{\vbox to 0pt{\vss{\hbox{\raise 0.5 truein
    \vbox{{#1}
     \par\vskip .5 truein
     }}}\vss}
\vskip -\baselineskip
}

\def\nameline{\toplevelline{%
    \smc Print Name:
    \vbox{\hrule width 3truein depth 4pt height -3pt}}}

%% \def\nameline{\vbox to 0pt{\vss{\hbox{\raise 0.5 truein\vbox{
%%     \smc Print Name:
%%     \vbox{\hrule width 3truein depth 4pt height -3pt}
%%      \par\vskip .5 truein
%%      }}}\vss}
%% \vskip -\baselineskip
%% }

\def\isanswer{\relax
   \ifcompact
       \relax
   \else
       \vskip .25 truein
       {\smc Answer: }
       \vbox{\hrule width 3truein depth 4pt height -3pt}
   \fi}

\def\isvfill{\relax
   \ifcompact
       \relax
   \else
       \vfill
   \fi}
\def\isvfillans{\isanswer\isvfill}
\def\iseject{\relax
   \ifcompact
       \relax
   \else
       \eject
   \fi}

%\magnification=\magstep1
\parindent=0pt
\raggedbottom
%\nopagenumbers
\font\sc=cmcsc10

\def\dfrac#1#2{\displaystyle {#1 \over #2}}
\def\frac#1#2{{#1\over#2}}

\def\mfrac#1#2{{{\dsize #1}\over {\dsize #2}}}


\def\dsize{\displaystyle}
\def\pts#1{\llap{{\it (#1 pts.)\quad}}}

%\footline={\rm{\hfil (continued)}}
\footline={\iffootline\rm{\hfil\folio\hfil
\hbox to 0pt{\hss(continued)}}
\else\hfil\folio\hfil\fi}

%\def\bye{\vfill\footline={\hfil}\eject\end}

\def\info{\getinfo}
\gdef\getinfo#1#2
{\gdef\coursename{#1}\gdef\term{#2}%
{\sc
\centerline{Department of Mathematics}
\centerline{Brooklyn College}
\medskip
\centerline{Final Examination---\term}
\centerline{\coursename}
\ifheadbottomline
\centerline{\vbox{\hrule width2.5in height1pt}}
\fi
\medskip
}}

\def\moreinfo{\getmoreinfo}
\gdef\getmoreinfo#1#2#3
{\gdef\coursename{#1}\gdef\term{#2}\gdef\instructor{#3}%
{\sc
\centerline{Department of Mathematics}
\centerline{Brooklyn College}
\medskip
\centerline{Final Examination---\term}
\centerline{\coursename}}
\centerline{\rm Instructor: \instructor}
\centerline{\vbox{\hrule width2.5in height1pt}}
\medskip
}

\def\instr#1#2\par{\goodbreak\noindent\uppercase{#1}\quad{\it#2}
\par\nobreak\medskip}


\def\prob#1 #2\par{\parindent=0pt\hangindent=25truept%
\hskip 25truept\llap{#1.\quad}#2\medskip\nobreak}


\def\subprob#1 #2\par{\parindent=0pt\hangindent=52truept%
\hskip25truept\rlap{(#1)}\hskip27truept#2\medskip\nobreak}


\def\subitem#1 #2\par{\parindent=0pt\hangindent=52truept%
\hskip25truept\rlap{(#1)}\hskip27truept#2\smallskip\nobreak}

\def\moreprob#1\par{\parindent=25true pt\hang#1
\medskip\nobreak}

\def\moresub#1\par{\parindent=52true pt\hang#1
\medskip\nobreak}

\def\firstpartnohang#1 #2 #3\par{
\llap{#1.\quad}\rlap{(#2)}\hskip27truept%
#3\medskip\nobreak}

\def\firstpart#1 #2 #3\par{\parindent=0pt\hangindent=52truept%
\hskip25truept\llap{#1.\quad}\rlap{(#2)}\hskip27truept%
#3\medskip\nobreak}

\def\nextpart#1 #2\par{\parindent=0pt\hangindent=52truept%
\hskip25truept\rlap{(#1)}\hskip27truept#2\medskip\nobreak}

\def\nextpartnoparen#1 #2\par{\parindent=0pt\hangindent=52truept%
\hskip25truept\rlap{#1}\hskip27truept#2\medskip\nobreak}

\def\endprob{\par\vskip16true pt plus 8 pt minus 6 pt\filbreak}

\def\subsub#1 #2\par{\hbox{\hbox to 96true pt{\hfil (#1)\quad}%
  \vtop{\hsize=373true pt\hang\strut#2\strut}}
  \smallskip\nobreak}


\def\twoaccross#1 #2\par#3 #4\par{\hbox{%
\hskip25truept\rlap{(#1)}\hskip27truept%
\hbox to 180true pt{\strut#2\strut\hfil\qquad}%
\rlap{(#3)}\hskip27truept%
\hbox to 198true pt{\strut#4\strut\hfil}}
\medskip\nobreak}

\def\oneaccross#1 #2\par{\hbox{%
\hskip25truept\rlap{(#1)}\hskip27truept%
\hbox to 419true pt{\strut#2\strut\hfil}}
\medskip\nobreak}

\def\threeaccross#1 #2\par#3 #4\par#5 #6\par{\hbox{%
\hskip25truept\rlap{(#1)}\hskip27truept%
\hbox to 115true pt{\strut#2\strut\hfil\qquad}%
\hbox to 35 true pt{\hfil (#3)\quad}%
\hbox to 115true pt{\strut#4\strut\hfil}
\hbox to 35true pt{\hfil (#5)\quad}%
\hbox to 115 true pt{\strut#6\strut\hfil}}
\medskip\nobreak}

%CONTROL SEQUENCES to write COMPUTER PROGRAMS:
\def\l#1 #2\cr{
 \hbox{ \hbox to 100true pt {\hfil\tt #1\quad} \vtop{\parindent=0in
                      \hsize=369 true pt{\tt\uppercase{\hang#2}}}}\par}

\def\more #1\cr{%
\hbox{\hskip150true pt\vtop{\hsize=310true pt\hang{\tt\uppercase{#1}}}}\par}
\def\endprog{\medskip\endprob}

% CONTROL SEQUENCES to write SYSTEMS OF SIMULTANEOUS EQUATIONS.
% First write $$\matrix{
%   If the system has three (iii) unknowns,
%     then for each row write \iiirow{}{}{}...={}
%   Or if the system has two (ii) unknowns, use \iirow
%   Or if it has four (iv) unknowns, use \ivrow, etc
%   Or if it has five (v) unknowns, use \vrow, etc
% Finally, write }$$  (to end the matrix macro)

\def\iiirow#1#2#3#4{%
\if 0#1 & \else \hfill#1x_1&\fi%
\if 0#2 & \else \hfill#2x_2&\fi%
\if 0#3 & \else \hfill#3x_3&\fi%
&=&\hfill#4\cr}

\def\iirow#1#2#3{%
\if0#1 & \else\hfill#1x_1&\fi%
\if0#2 & \else\hfill#2x_2&\fi%
&=&\hfill#3\cr}

\def\ivrow#1#2#3#4#5{%
\if#10 & \else \hfill#1x_1&\fi%
\if#20 & \else\hfill #2x_2&\fi%
\if#30 & \else \hfill#3x_3&\fi%
\if#40 & \else\hfill #4x_4&\fi%
=&\hfill#5\cr }

\def\vrow#1#2#3#4#5#6{%
\if#10 & \else\hfill #1x_1&\fi%
\if#20 & \else\hfill #2x_2&\fi%
\if#30 & \else \hfill#3x_3&\fi%
\if#40 & \else\hfill #4x_4&\fi%
\if#50 & \else\hfill #4x_5&\fi%
=&\hfill#6\cr}

