%%
%% This is file `tabletgrader.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tabletgrader.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% 
%% Copyright (C) 2014 by Steven M. McKay
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.2 of this license or (at your option) any later
%% version.  The latest version of this license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2003/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[2001/06/01]
\ProvidesPackage{examheader}[2014/05/05 .dtx examheader file]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Set the Options to pass through to automultiplechoice
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareOption*{%
\PassOptionsToPackage{\CurrentOption}{automultiplechoice}%
}
\ProcessOptions\relax
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Load Necessary Packages  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{automultiplechoice}
\RequirePackage{tikz} %needed for the \foreach command
\RequirePackage{ifthen} %needed for if then else and whiledo programming structures
\RequirePackage{comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  Counter Declarations    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{pointsmone}
\newcounter{MCnum}
\setcounter{MCnum}{1} %The default number of points for multiple choice questions is 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  Length Declarations     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength{\choicelength} % length of a) or b), etc.
\newlength{\collength} % length of individual column
\settowidth{\choicelength}{a)}
\newlength{\olditemsep}

\newlength{\smallspace}
\setlength{\smallspace}{1in}
\newlength{\midspace}
\setlength{\midspace}{2.5in}
\newlength{\longspace}
\setlength{\longspace}{4in}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Front Page Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\AMCbeginQuestion#1#2{\par\noindent{#1} #2\hspace{1em}}
\def\AMCotextReserved{\emph{Administrative Use Only}}
\AMCopenOpts{dots=false,framerulecol=white}
\makeatletter
\newcommand{\examnumber}{\the\AMCid@etud}
\makeatother
\newcommand{\threedigit}[1]{
  \ifnum#1<100 0\fi%
  \ifnum#1<10 0\fi%
  \number#1%
}
\newcommand{\Course}[2]{\def\coursenumber{#1}\def\coursename{#2}}
\newcommand{\Instructor}[1]{\def\instructor{#1}}
\newcommand{\TestName}[1]{\def\testname{#1}}
\newcommand{\Date}[1]{\def\testdate{#1}}
\newcommand{\Time}[1]{\def\testtime{#1}}
\newcommand{\Section}[1]{\def\section{#1}}
\newcommand{\Stamp}[1]{\def\stamp{#1}}
\newcommand{\Barcode}[1]{\def\barcode{#1}}

\def\section{0} % Give section an initialization of 0
\def\instructor{noname} %noname indicates the instructor's name has not been initialized
\def\shortname{EXAM} %standard end of first part name, unless redefined.
\def\barcode{none} %none indicates there is no barcode

\newcommand{\frontpage}{
\noindent {\LARGE\bfseries\stamp\hfill\ifthenelse{\equal{\barcode}{none}}{}{\includegraphics{\barcode}}\hfill\threedigit{\examnumber}}\\
\begin{minipage}[t]{.4\linewidth}

\vspace{.3in}

\noindent\textbf{\LARGE \coursenumber\ifthenelse{\section>0}{-\section}{}}\\[2mm]
\textbf{\LARGE \testname}\\%
\textbf{\testdate}\\[2mm]
\end{minipage}
\hfill\namefield{\begin{minipage}[t]{.4\linewidth}

\vspace{.3in}

Name:\hrulefill \\[2mm]
\ifthenelse{\section<1} % put a place for the section number if it is not defined
{
Section:\hrulefill \\[2mm]
}
{}
Instructor:\ifthenelse{\equal{\instructor}{noname}}{\hrulefill}{\ \instructor}\\[1mm]
\end{minipage}
}

\noindent{\large Encode your BYU ID in the grid below.}\\[2mm]
\AMCcode{BYUID}{9}\\[2mm]
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  Question environment    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\setmultiplechoice}[1]{\setcounter{MCnum}{#1}}
\newcommand{\mcscoring}{\scoring{b=\theMCnum}}
\newenvironment{mcquestion}[1] % wrapper for question with globally set points value - uses automultiplechoice question and choices
{
\begin{question}{#1}\scoring{b=\theMCnum}
}
{
\end{question}
}
\newenvironment{mcquestionmult}[1] % wrapper for question with globally set points value - uses automultiplechoice question and choices
{
\begin{questionmult}{#1}\scoring{b=\theMCnum}
}
{
\end{questionmult}
}
\newenvironment{freequestion}[2]% wrapper for question to be graded by instructor
{
\setcounter{pointsmone}{#2}
\addtocounter{pointsmone}{-1}
\begin{question}{#1}
\AMCOpen{}{\foreach \n in {1,...,\thepointsmone}{\wrongchoice{\n}\scoring{\n}}
\correctchoice{#2}\scoring{#2}}

\vspace{-.6in}

}
{
\end{question}
}

\AtEndDocument{
}
\endinput
%%
%% End of file `tabletgrader.sty'.
