% Exam Template Probability and Statistics courses
%
% Using Philip Hirschhorn's exam.cls: http://www-math.mit.edu/~psh/#ExamCls
%
% run pdflatex on a finished exam at least three times to do the grading table on front page.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% These lines can probably stay unchanged, although you can remove the last
% two packages if you're not making pictures with tikz.
\documentclass[11pt]{exam}
    % \printanswers   %    <=========  Comment this to print exam without answers
    \newcommand{\gradingnote}[1]{}
    %\newcommand{\gradingnote}[1]{\hfill {\color{red} \textit{Grading note: } #1}}
    
    \newboolean{addsolutionspace}
    \setboolean{addsolutionspace}{true}
\RequirePackage{amssymb, amsfonts, amsmath, latexsym, verbatim, xspace, setspace}
\RequirePackage{tikz, graphicx}
\usepackage{color}
\usepackage{multirow, hhline, array, arydshln, blkarray}
\usepackage{txfonts}
\usepackage{hhline, bigstrut}
%\usepackage{calculator, calculus}
\usepackage{soul}
\usetikzlibrary{patterns, plotmarks}
\usepackage{hyperref}
\usepackage{enumerate}
\usepackage{pgfplots, pgfplotstable}
% By default LaTeX uses large margins.  This doesn't work well on exams; problems
% end up in the "middle" of the page, reducing the amount of space for students
% to work on them.
\usepackage[margin=1in]{geometry}
\newboolean{hasattachment}\setboolean{hasattachment}{false}
\newboolean{openbook}\setboolean{openbook}{false}
\newboolean{opennotes}\setboolean{opennotes}{false}
\newboolean{calculator}\setboolean{calculator}{false}
%\newcommand\openbooktrue{\setboolean{openbook}{true}}
%patch the exam package and change the format of the grade table.
\usepackage{etoolbox}
\makeatletter
\patchcmd{\questions}
  {\def\@currentlabel{\thequestiontitle}}
  {\def\@currentlabel{\thequestion}}
  {}
  {}
\makeatother
% ======================================
		% Here's where you edit the Class, Exam, Date, etc.
		\newcommand{\term}{Fall Semester (AY 201?-201?)}
		\newcommand{\classcode}{ENGR ???}
		\newcommand{\classtitle}{Writing in Overleaf}
		\newcommand{\examiner}{Dr. A. Sleptchenko}
		\newcommand{\examnum}{Final Exam (weight 35\%)}
		\newcommand{\examdate}{??/??/201?}
		\newcommand{\timelimit}{120 Minutes}
		\newcommand{\weight}{35}
		\newcommand{\class}{\classcode -- \classtitle}
		\newcommand{\classShort}{\classcode}
		
		%% == comment the following lines if needed
		\hasattachmenttrue  
		% \openbooktrue
		% \opennotestrue
		\calculatortrue
		
		%% == define instructions
		\newcommand{\instructions}{
			\begin{itemize} \setlength{\itemindent}{-1em}
				\item Use the provided \textbf{exam bucklets} and indicate your name and \textbf{ID on each page}.
			
				\item Use a \textbf{black or blue pen} (no other colors). If you think you answer is wrong just mark it that it is wrong, and write the new one.
			
				\item Provide \textbf{as many details as possible}, unclear answer might lead to a lower mark.
	
				\item 	\textbf{Organize your work}, in a reasonably neat and coherent way, in the space provided. 
				Work scattered all over the page without a clear ordering might receive very little credit.
	
			\end{itemize}
			
		}
% ======================================
% For an exam, single spacing is most appropriate
\singlespacing
% \onehalfspacing
% \doublespacing
% For an exam, we generally want to turn off paragraph indentation
\parindent 0ex
\everymath{\displaystyle}
\begin{document}
\include{KU_FINexam_header}
	
%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  questions
%
%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{questions}
%\qformat{Question \thequestion: \thequestiontitle\dotfill\thepoints}
\qformat{{\bf Problem \thequestion}: (\thequestiontitle) \ \  [\totalpoints \ points] \hfill}
%\qformat{{\bf Problem \thequestion}: \ \  [\thepoints] \hfill}
	\titledquestion{Question One}
        \begin{parts}
            \part[5] Sub-question 1
        		\begin{checkboxes}
        			\choice Choice 1
        			\choice Choice 2
        			\CorrectChoice Choice 3
        			\CorrectChoice Choice 4
        		\end{checkboxes}
                
            \part[10] Sub-question 2
        	\begin{solution}
        		Open end question
        	\end{solution}
        	\ifprintanswers  \else \ifaddsolutionspace \fillwithdottedlines{\stretch{1}} \fi \fi
            
        \end{parts}
	\addemptypage	
	
	\titledquestion{Question Two}
        \begin{parts}
            \part[5] Sub-question 1
        		\begin{oneparcheckboxes}
        			\choice Choice 1
        			\CorrectChoice Choice 2
        		\end{oneparcheckboxes}
                
            \part[12] Sub-question 2
        	\begin{solution}
        		Open end question
        	\end{solution}
        	\ifprintanswers  \else \ifaddsolutionspace \fillwithgrid{2in} \fi \fi
        \end{parts}
	\addemptypage	
\end{questions}
% \ifprintanswers
%   % do nothing 
% \else %add empty page
% %add formula sheets
% \newpage
% \input{formulaSheet.tex}
% 	\addemptypage			
% \fi
\end{document}