% monk.sty - Custom style file for Professor Monk's coursework

% Version variable
\def\monkversion{v1.8}

\usepackage {snhu}
\ProvidesPackage{monk}[\monkversion Custom package for Professor Monk]

% Encoding
\usepackage[utf8]{inputenc}

% Math and titles
\usepackage{amsmath}
\usepackage{titlesec}
\usepackage{siunitx}

% Circuits and Electronics
\usepackage[american]{circuitikz}

% LaTeX
\usepackage{ifthen}

% This is for listings and such, he's had me use matlab/octave before so this is a custom define.
\usepackage{listings}
\lstset{
    language=Matlab,  % Matlab/Octave syntax highlighting
    basicstyle=\ttfamily,
    keywordstyle=\color{blue},
    commentstyle=\color{gray},
    stringstyle=\color{green},
    numbers=left,
    numberstyle=\tiny,
    stepnumber=1,
    breaklines=true,
    frame=single,
    captionpos=b
}

% This formatting is for spice netlists, its not critical but, its nice to have.
\lstdefinelanguage{Netlist}{
    morekeywords={V, I, R, C, L, .end, .control, .op, .dc, .ac, .print, print, .plot}, % Add more as needed
    keywordstyle=\color{orange}\bfseries,
    morecomment=[l]{*}, % Netlist comments start with * or ;
    morecomment=[l]{;},
    commentstyle=\color{red},
    morestring=[b]",
    stringstyle=\color{brown},
    numbers=left, % Line numbers on the left
    numberstyle=\tiny\color{black}, % Todo, make this the pagecolor inverse
    stepnumber=1, % Show line numbers for every line
    breaklines=true,
    showstringspaces=false,
    tabsize=2,
    basicstyle=\ttfamily\footnotesize, % Basic style for netlists
}
% To use, do this
% \lstinputlisting[language=Netlist]{spice/circuit_a.net}


% Title formatting for sections
\titleformat{\section}
  {\normalfont\normalsize\bfseries}{}{1em}{}

\titleformat{\subsection}
  {\normalfont\normalsize\bfseries}{}{1em}{}

\titleformat{\subsubsection}
  {\normalfont\normalsize\bfseries}{}{1em}{}

% This is neat, its a custom \req command for keeping track of monk's project requirement sheets
% Define a toggle for showing requirements
\newif\ifshowreqs
\showreqstrue % Default to true

% Command to toggle visibility
\newcommand{\showreqs}[1]{%
  \ifthenelse{\equal{#1}{true}}{\showreqstrue}{\showreqsfalse}%
}

% Define the \req command
\newcommand{\req}[1]{%
  \ifshowreqs%
    \textsuperscript{\textbf{\textit{\textcolor{red}{#1}}}}% Show requirement flag (styled)
  \fi%
}

% This is just to make it easier to configure/disable the draft mode with a toggle
\newcommand{\showdraft}{%
  \usepackage{draftwatermark}
  \SetWatermarkText{DRAFT}
  \SetWatermarkScale{5}
  \SetWatermarkColor[gray]{0.8}
}

% Custom version command to print revision and compile date in footer
\renewcommand{\revision}[2][false]{
  \clearpage
  \null
  \vfill
  \begin{center}
    \texttt{Revision: #2} \\
    \texttt{Compiled on \today}

    % Conditionally include Source.zip text if #1 is set to true
    \ifthenelse{\equal{#1}{true}}{
      \bigskip
      \texttt{You should have received a copy of the Source.zip along with this document.}
    }{}

    \bigskip

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