% Homework Latex Class
% Written by Ian Langworth and Marc Dougherty
\typeout{Homework class, v1.0}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{homework}[2003/12/04]

% -----------------------
% Indenting magic.
\newcommand{\qindent}{\hspace{0em}} %noop.
\newcommand{\sqindent}{\hspace{0em}} %noop.
\newcommand{\ssqindent}{\hspace{0em}} %noop.

% this option is for the indents of sub sections.
\DeclareOption{indents}{
    \renewcommand{\sqindent}{\hspace{2em}} %little.
    \renewcommand{\ssqindent}{\hspace{4em}} %bigger.
}

%options that someone else can deal with...
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

% -----------------------
%now process them...
\ExecuteOptions{letterpaper, 12pt}
\ProcessOptions\relax
\LoadClass{article}

\usepackage{fullpage}

% -----------------------------------
% New Counters
% -----------------------------------
% counters for Questions, SubQuestions, SubSubQuestions
\newcounter{Q}
\setcounter{Q}{0}
\newcounter{SQ}
\newcounter{SSQ}

% -----------------------------------
% New Lengths
% -----------------------------------
% define how much we want to indent our subsections
\newlength{\myindent}
\setlength{\myindent}{3em}

% vertical space b/w questions.
\newlength{\qskip}
\setlength{\qskip}{3ex}

% -----------------------------------
% Cosmetic Options
% -----------------------------------
% feel free to redefine these, if you dont like the way these look.

% \headerfont : font that your header is printed in.
\newcommand{\headerfont}{\Large\bf}

% \qfont : the font that questions are printed in.
\newcommand{\qfont}{\large\bf}

% \qenum : the numbering scheme of the top-level question list.
% defaults to \arabic.
\newcommand{\qenum}[1]{\arabic{#1}}

% \sqenum : the numbering scheme for the list of sub-questions.
% defaults to \alph
\newcommand{\sqenum}{\alph}

% \ssqenum : the numbering scheme of the list of sub-sub-questions.
% defaults to \roman
\newcommand{\ssqenum}{\roman}

% -----------------------------------
% New commands.
% -----------------------------------

% \maketitle : standard function, redefined for our purpose.
\renewcommand{\maketitle}{
    \begin{flushleft}
    { \headerfont
    \@author \\
    \@title }
    \end{flushleft}
    %\medskip
}
    
% \question: begins a new question. 
%   prints the number of the question, and optional argument of question text.
%   it also resets the subquestion counter.
\newcommand{\question}[1]{
    \stepcounter{Q} 
    \setcounter{SQ}{0}
    \addvspace{\qskip}
    \noindent\qindent 
    {\qfont\qenum{Q} #1}
    \nopagebreak
    \par
}   

% \newquestion : used to start a new question, without printing a 
%   question number.
\newcommand{\newquestion} {
    \stepcounter{Q}
    \setcounter{SQ}{0}
}

% \subquestion : prints a subquestion header, optionally with text.
\newcommand{\subquestion}[1] {
    \stepcounter{SQ}
    \setcounter{SSQ}{0}
    \addvspace{\qskip}
    \noindent\sqindent
    {\qfont\qenum{Q}.\sqenum{SQ} #1}
    \nopagebreak
    \par
}

% \newsubquestion : starts a new subquestion, without printing a header for it.
\newcommand{\newsubquestion} {
    \stepcounter{SQ}
    \setcounter{SSQ}{0}
}

% \subsubquestion : prints a number of new sub-sub-question, with optional text.
\newcommand{\subsubquestion}[1] {
    \stepcounter{SSQ}
    \addvspace{\qskip}
    \noindent\ssqindent
    {\qfont\qenum{Q}.\sqenum{SQ}.\ssqenum{SSQ} #1}
    \nopagebreak
    \par
}

%no need for \newsubsubquestion unless we make \subsubsubquestion.
