% ! Features
% ! qs, subqs, ans environment
% ! \qt and \subqt commands, auto label question
% ! eg \cref{q:1} will print "question 1"

\RequirePackage{amsmath,amssymb,amsthm,mathtools, mdframed, hyperref, cleveref, xparse,enumitem}


\crefname{questionref}{question}{questions}
% \creflabelformat{questionref}{#1 #2#3}

\newenvironment{ans}{

\begin{mdframed}
    \begin{proof}}
        {
    \end{proof}
\end{mdframed}
}

% subquestion
\newenvironment{subqs}{
    \begin{enumerate}[label=\textbf{\alph*)}]
}{
    \end{enumerate}
}



\newcommand{\qt}[2][\value{enumi}+1]{
    % new page if not on question 1
    \ifnum\value{enumi}>0
        \newpage
    \fi
    \setcounter{enumi}{#1 - 1}
    % display question number, and automatically label it
    \item \label[questionref]{q:\arabic{enumi}} \textit{#2} 
}


\newcommand{\subqt}[2][1]{
    % new page if not on question 1
    % \ifnum\value{enumii}>0
    %     \newpage
    % \fi
    % \setcounter{enumii}{#1 - 1}
    % display question number, and automatically label it
    \item \label[questionref]{q:\arabic{enumi}.\alph{enumii}} \textit{#2}
}


% \newcommand{\subqt}{
%     \item \label[question]{q:\arabic{enumi}\alph{enumii}}
% }