\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{prova}
              [1994/02/15 v1.0 Formato para Folha de questões de provas]
\typeout{Adaptacao do estilo 'artigo' feita no DINF-ET-UFPR (A.L.N.D.)}

\RequirePackage{fancybox}

\normalsize \sf

\newcounter{questao}%
\newlength{\qstlabel}%
\newlength{\qsttext}%
\newlength{\exclabel}%
\newlength{\exctext}%
\newlength{\anslabel}%
\newlength{\anstext}%

%
% PHYSICAL PAGE OFFSETS AND DIMENSIONS
% by Armando Luiz N. Delgado - 1/7/92
% 
\newlength{\ppwidth}
\newlength{\ppheight}
\newlength{\leftoffset}
\newlength{\rightoffset}
\newlength{\topoffset}
\newlength{\bottomoffset}

\def\sepbottom{5mm}            % vertical distance between bottom of
                               % paper and bottom of the foot
\setlength{\ppwidth}{210mm}             % largura de papel A4
\setlength{\ppheight}{297mm}            % comprimento de papel A4
\setlength{\leftoffset}{25mm}           % margem esquerda (fisica)
\setlength{\rightoffset}{25mm}          % margem direita  (fisica)
\setlength{\topoffset}{25mm}            % margem superior (fisica)
\setlength{\bottomoffset}{20mm}         % margem inferior (fisica)

\marginparwidth 0 pt
\marginparsep 0 pt

%
% margens LaTeX em funcao das margens fisicas adotadas
%
\setlength{\topmargin}{\topoffset}
\addtolength{\topmargin}{-1in}
\addtolength{\topmargin}{-\headheight}
\addtolength{\topmargin}{-\headsep}
% \addtolength{\topmargin}{\topskip}

\setlength{\footskip}{\bottomoffset}
\addtolength{\footskip}{-\sepbottom}

\setlength{\oddsidemargin}{\leftoffset}
\addtolength{\oddsidemargin}{-1in}      % Left margin on odd-numbered pages.
\setlength{\evensidemargin}{\leftoffset}
\addtolength{\evensidemargin}{-1in}     % Left margin on even-numbered pages.
                                        % Note that \oddsidemargin =
                                        %            \evensidemargin
%
% largura do corpo do texto
%
\setlength{\textwidth}{\ppwidth}
\addtolength{\textwidth}{-\rightoffset}
\addtolength{\textwidth}{-\leftoffset}
\addtolength{\textwidth}{-\marginparwidth}
\addtolength{\textwidth}{-\marginparsep}


%
% altura do corpo do texto
%
\setlength{\textheight}{\ppheight}
\addtolength{\textheight}{-\bottomoffset}
\addtolength{\textheight}{-\topoffset}

%
% Macro para definir questao de prova
% 1o. argumento = valor da questao
% 2o. argumento = texto da questao
%

\settowidth{\qstlabel}{{\sf (99 pontos)}\ 99.\ }%
\setlength{\qsttext}{\textwidth}%
\addtolength{\qsttext}{-\qstlabel}%

\def\question#1#2{%
\refstepcounter{questao}%
\parbox[t]{\qstlabel}{{\sf (#1 pontos)}\hfill {\bf \thequestao.}}\ \parbox[t]{\qsttext}{#2}%
\vspace{5mm}
}

\settowidth{\exclabel}{{\bf 99.}\ }%
\setlength{\exctext}{\textwidth}%
\addtolength{\exctext}{-\exclabel}%

\def\exercise#1{%
\refstepcounter{questao}%
\parbox[t]{\exclabel}{{\bf \thequestao.}}\ \parbox[t]{\exctext}{#1}%
\vspace{5mm}
}

\settowidth{\anslabel}{{\em (10,00)}\ 99.\ }%
\setlength{\anstext}{\textwidth}%
\addtolength{\anstext}{-\anslabel}%

\def\answer#1{%
\parbox[t]{\anslabel}{~}\ \parbox[t]{\anstext}{\textit{\textsf{#1}}}%
\vspace{5mm}
}

\newenvironment{gradebox}%
{\begin{Sbox}\begin{minipage}}%
{\end{minipage}\end{Sbox}\fbox{\TheSbox}}

\def\grade{
  \begin{flushright}
    \begin{gradebox}{20mm}
      \centerline{{\small Nota}}
      \vspace{6mm}
    \end{gradebox}
  \end{flushright}
  \vspace{2mm}
  }

\def\identity{
  \begin{tabular}{|l|l|l|} \hline
    {\small Matrícula} & {\small Nome} & {\small Assinatura} \\
    ~\hspace{25mm} & ~\hspace{90mm} & ~\hspace{50mm} \\[1mm] \hline
%    ~ & ~ & ~ \\ \hline
  \end{tabular}
}

\def\groupidentity{
  \begin{tabular}{|l|} \hline
    {\small Grupo} \\
    ~\hspace{165mm} \\[1mm] \hline
  \end{tabular}
}
%
%
% Identificação
%
\def\@exame{exame}
%
\def\provaid#1{
  \ifx#1\@exame
     Exame Final
  \else
     #1\ordfem Prova de Avaliação
  \fi
}
%%
\def\gradeid#1{
  \ifx#1\@exame
     \grade
     \identity
  \fi
}

%%
\def\attid#1#2#3{
  \ifx#1\@exame
     \ifx#3\empty
       #2
     \else
       #3
     \fi
  \else
     #2
  \fi
}

% end of PROVA.STY
