% snhu.sty - Custom style file for all of SNHU

% Version variable
\def\snhuversion{v9.0}

% Required packages
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{hyperref}

\ProvidesPackage{snhu}[\snhuversion Custom package for all of SNHU]

% Custom answer highlighting
\newcommand{\ans}[1]{\colorbox{yellow}{#1}}
\newcommand{\mans}[1]{\colorbox{yellow}{$#1$}}


% ========================
% SNHU homework title page
% ========================
\newcommand{\reporttitle}[1]{\def\@reporttitle{#1}}
\newcommand{\class}[1]{\def\@class{#1}}
\newcommand{\studentname}[1]{\def\@studentname{#1}}
\newcommand{\submissiondate}[1]{\def\@submissiondate{#1}}
\newcommand{\universityname}[1]{\def\@universityname{#1}}

\renewcommand{\maketitle}{%
    \begin{titlepage}
        \centering
        \vspace*{2cm}
        
        % Title
        {\Huge \@reporttitle} \\[0.3cm]
        \hrulefill \\[0.5cm]  % Horizontal line under the title

        % Submission details (properly aligned)
        \begin{tabular}{p{0.45\textwidth} p{0.45\textwidth}}
            \raggedright \textbf{Submitted to:} \\ \@class & 
            \raggedleft \textbf{Submitted by:} \\ \@studentname 
        \end{tabular}

        \vspace{0.8cm}
%         {\large \@universityname} \\[0.5cm]
        {\large \@submissiondate}

        \vfill
        % Logo
        \includegraphics[width=5cm]{resources/SNHU-Logo.png} % Adjust width as needed
    \end{titlepage}
}

% Custom header/footer
\fancypagestyle{snhudefault}{
    \fancyhf{}
    \fancyhead[L]{\@reporttitle}
    \fancyhead[R]{\@studentname}
    \fancyfoot[C]{Page \thepage}
    \renewcommand{\headrulewidth}{0.4pt}
    \renewcommand{\footrulewidth}{0.4pt}
}

% Package options to load fancy headers by default
\AtBeginDocument{
    \pagestyle{snhudefault}
}

% =====================================
% Formatting for problems and exercises
% =====================================
\newcommand{\exer}[2][]{%
    \subsection*{\textbf{#1 #2}}%
    \addcontentsline{toc}{subsection}{#1 #2} % Optional: Add to TOC
    \setlength{\parindent}{0pt}%
    \setlength{\parskip}{1em}%
}

% Environment for exercises
\newenvironment{exercise}[1][]{
    \noindent
    \textbf{\LARGE #1}\\[1em]
    \noindent
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{1em}
}{
    \vspace{2em}
}

% Formatting for parts within exercises
\newcommand{\mpart}[1]{%
    \vspace{1em}
    \noindent\textbf{Part (#1)}%
}


% Default revision command
\providecommand{\revision}[1]{
  \clearpage
  \null
  \vfill
  \begin{center}
    \texttt{Revision: #1} \\
    \texttt{Compiled on \today}

    \texttt{If this document contains any listings, images or other embedded media, you should have received a copy of the source.zip}

    \bigskip

    \texttt{Libs:} \\
    - \texttt{\href{https://git.kitsunehosting.net/Kenwood/SNHU-LaTeX/src/branch/main/SNHU.sty}{SNHU\_Sty} \snhuversion}
  \end{center}
}
