%% modernclassnotes.cls %% Copyright 2026 Modern Class Notes Project %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3c or later is part of all distributions of LaTeX %% version 2008/05/01 or later. %% %% Dual-licensed under the MIT License for open-source flexibility. \NeedsTeXFormat{LaTeX2e} \ProvidesClass{modernclassnotes}[2026/07/26 v1.0.0 Modern Class Notes Document Class] % ------------------------------------------------------------------- % Package Options & Key-Value Handling % ------------------------------------------------------------------- \RequirePackage{kvoptions} \SetupKeyvalOptions{ family=mcn, prefix=mcn@ } \DeclareStringOption[notes]{mode} % notes, handout, worksheet \DeclareStringOption[ocean]{palette} % ocean, midnight, nord, emerald, burgundy, amethyst, mono \DeclareStringOption[11pt]{fontsize} % 10pt, 11pt, 12pt \DeclareStringOption[default]{font} % default, palatino, charter, sans \DeclareBoolOption[true]{showsolutions} % show/hide solutions in worksheets \DeclareBoolOption[true]{parskip} % toggle paragraph spacing \DeclareBoolOption[true]{numbering} % continuous vs chapter-based numbering \ProcessKeyvalOptions* % Pass font size to base class \LoadClass[\mcn@fontsize,a4paper]{article} % ------------------------------------------------------------------- % Core Dependencies % ------------------------------------------------------------------- \RequirePackage[utf8]{inputenc} \RequirePackage[T1]{fontenc} \RequirePackage{xcolor} \RequirePackage{geometry} \RequirePackage{amsmath,amssymb,amsthm} \RequirePackage{fancyhdr} \RequirePackage{etoolbox} \RequirePackage{listings} \RequirePackage{caption} \RequirePackage{booktabs} \RequirePackage{array} \RequirePackage{enumerate} \RequirePackage{iftex} \ifmcn@parskip \RequirePackage{parskip} \fi % Geometry configuration based on mode \ifstrequal{\mcn@mode}{handout}{% \geometry{a4paper, top=2.0cm, bottom=2.0cm, left=2.0cm, right=2.0cm, headheight=28pt, headsep=12pt}% }{% \ifstrequal{\mcn@mode}{worksheet}{% \geometry{a4paper, top=2.0cm, bottom=2.0cm, left=2.0cm, right=2.0cm, headheight=28pt, headsep=12pt}% }{% \geometry{a4paper, top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm, headheight=28pt, headsep=15pt}% }% } % ------------------------------------------------------------------- % Font Selection Presets % ------------------------------------------------------------------- \ifstrequal{\mcn@font}{palatino}{% \RequirePackage{mathpazo} }{% \ifstrequal{\mcn@font}{charter}{% \RequirePackage{charter} \RequirePackage[charter]{mathdesign} }{% \ifstrequal{\mcn@font}{sans}{% \RequirePackage{helvet} \renewcommand{\familydefault}{\sfdefault} }{% % Default Latin Modern / Computer Modern }% }% } % ------------------------------------------------------------------- % Color Palette Presets % ------------------------------------------------------------------- \ifstrequal{\mcn@palette}{midnight}{% \definecolor{mcnPrimary}{HTML}{1D2D44} \definecolor{mcnSecondary}{HTML}{3A86EF} \definecolor{mcnAccent}{HTML}{F72585} \definecolor{mcnBg}{HTML}{F8F9FA} \definecolor{mcnText}{HTML}{212529} \definecolor{mcnBoxBg}{HTML}{EDF2F7} \definecolor{mcnBorder}{HTML}{CBD5E0} }{% \ifstrequal{\mcn@palette}{nord}{% \definecolor{mcnPrimary}{HTML}{2E3440} \definecolor{mcnSecondary}{HTML}{88C0D0} \definecolor{mcnAccent}{HTML}{B48EAD} \definecolor{mcnBg}{HTML}{F8F9FB} \definecolor{mcnText}{HTML}{3B4252} \definecolor{mcnBoxBg}{HTML}{ECEFF4} \definecolor{mcnBorder}{HTML}{D8DEE9} }{% \ifstrequal{\mcn@palette}{emerald}{% \definecolor{mcnPrimary}{HTML}{1B4332} \definecolor{mcnSecondary}{HTML}{2D6A4F} \definecolor{mcnAccent}{HTML}{52B788} \definecolor{mcnBg}{HTML}{F4F9F5} \definecolor{mcnText}{HTML}{1A2E26} \definecolor{mcnBoxBg}{HTML}{E8F5E9} \definecolor{mcnBorder}{HTML}{C8E6C9} }{% \ifstrequal{\mcn@palette}{burgundy}{% \definecolor{mcnPrimary}{HTML}{5C061C} \definecolor{mcnSecondary}{HTML}{9D0208} \definecolor{mcnAccent}{HTML}{DC2F02} \definecolor{mcnBg}{HTML}{FAF4F5} \definecolor{mcnText}{HTML}{2B0D12} \definecolor{mcnBoxBg}{HTML}{F7EBEF} \definecolor{mcnBorder}{HTML}{E8C5CE} }{% \ifstrequal{\mcn@palette}{amethyst}{% \definecolor{mcnPrimary}{HTML}{3A0CA3} \definecolor{mcnSecondary}{HTML}{7209B7} \definecolor{mcnAccent}{HTML}{4361EE} \definecolor{mcnBg}{HTML}{F8F7FF} \definecolor{mcnText}{HTML}{1D1A2E} \definecolor{mcnBoxBg}{HTML}{F0EEFD} \definecolor{mcnBorder}{HTML}{D7D2FA} }{% \ifstrequal{\mcn@palette}{mono}{% \definecolor{mcnPrimary}{HTML}{212529} \definecolor{mcnSecondary}{HTML}{495057} \definecolor{mcnAccent}{HTML}{6C757D} \definecolor{mcnBg}{HTML}{FAFAFA} \definecolor{mcnText}{HTML}{212529} \definecolor{mcnBoxBg}{HTML}{F1F3F5} \definecolor{mcnBorder}{HTML}{CED4DA} }{% % Default: Ocean Palette \definecolor{mcnPrimary}{HTML}{005F73} \definecolor{mcnSecondary}{HTML}{0A9396} \definecolor{mcnAccent}{HTML}{94D2BD} \definecolor{mcnBg}{HTML}{F4F7F6} \definecolor{mcnText}{HTML}{1D2D35} \definecolor{mcnBoxBg}{HTML}{EAF4F4} \definecolor{mcnBorder}{HTML}{CCE3DE} }}}}}} % Environmental standard colors \definecolor{mcnTheorem}{HTML}{023E8A} \definecolor{mcnTheoremBg}{HTML}{EDF4FC} \definecolor{mcnDefinition}{HTML}{0077B6} \definecolor{mcnDefinitionBg}{HTML}{EAF6FB} \definecolor{mcnExample}{HTML}{2B9348} \definecolor{mcnExampleBg}{HTML}{EEF8F1} \definecolor{mcnRemark}{HTML}{555555} \definecolor{mcnRemarkBg}{HTML}{F5F5F5} \definecolor{mcnWarning}{HTML}{D90429} \definecolor{mcnWarningBg}{HTML}{FDE8EA} \definecolor{mcnTip}{HTML}{E07A5F} \definecolor{mcnTipBg}{HTML}{FDF2EF} % ------------------------------------------------------------------- % Document Metadata Fields % ------------------------------------------------------------------- \newcommand{\mcn@course}{} \newcommand{\mcn@coursecode}{} \newcommand{\mcn@professor}{} \newcommand{\mcn@institution}{} \newcommand{\mcn@term}{} \newcommand{\mcn@department}{} \newcommand{\mcn@docsubtitle}{} \newcommand{\mcn@lecturedate}{} \newcommand{\mcn@assignmentname}{} \title{Class Notes} % Default title \newcommand{\course}[1]{\renewcommand{\mcn@course}{#1}} \newcommand{\coursecode}[1]{\renewcommand{\mcn@coursecode}{#1}} \newcommand{\professor}[1]{\renewcommand{\mcn@professor}{#1}} \newcommand{\institution}[1]{\renewcommand{\mcn@institution}{#1}} \newcommand{\term}[1]{\renewcommand{\mcn@term}{#1}} \newcommand{\department}[1]{\renewcommand{\mcn@department}{#1}} \newcommand{\docsubtitle}[1]{\renewcommand{\mcn@docsubtitle}{#1}} \newcommand{\lecturedate}[1]{\renewcommand{\mcn@lecturedate}{#1}} \newcommand{\assignmentname}[1]{\renewcommand{\mcn@assignmentname}{#1}\title{#1}} % ------------------------------------------------------------------- % Dynamic Running Headers & Footers % ------------------------------------------------------------------- \newcommand{\mcn@currentlecture}{} \pagestyle{fancy} \fancyhf{} \lhead{% \small\sffamily\bfseries\color{mcnPrimary}% \ifx\mcn@coursecode\@empty \ifx\mcn@course\@empty Class Notes \else \mcn@course \fi \else \mcn@coursecode\ifx\mcn@course\@empty\else: \mcn@course\fi \fi } \rhead{% \small\sffamily\color{mcnSecondary}% \ifx\mcn@currentlecture\@empty \ifx\mcn@term\@empty \mcn@institution \else \mcn@term \fi \else \mcn@currentlecture \fi } \lfoot{\small\sffamily\color{gray}\ifx\mcn@professor\@empty\else Prof. \mcn@professor\fi} \cfoot{\small\sffamily\color{mcnPrimary}\bfseries\thepage} \rfoot{\small\sffamily\color{gray}\ifx\mcn@institution\@empty\else\mcn@institution\fi} \renewcommand{\headrulewidth}{0.8pt} \renewcommand{\headrule}{{\color{mcnPrimary}\hrule width\headwidth height \headrulewidth \vspace{\headsep}}} \renewcommand{\footrulewidth}{0.4pt} \renewcommand{\footrule}{{\color{mcnBorder}\hrule width\headwidth height \footrulewidth}} % ------------------------------------------------------------------- % Title & Banner Commands % ------------------------------------------------------------------- \renewcommand{\maketitle}{% \ifstrequal{\mcn@mode}{handout}{% % Handout Compact Header Banner \vspace*{-0.5cm}% \noindent \fcolorbox{mcnPrimary}{mcnBoxBg}{% \begin{minipage}{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}% \paddingv \begin{minipage}[t]{0.65\linewidth}% {\raggedright \ifx\mcn@coursecode\@empty\else{\small\sffamily\bfseries\color{mcnSecondary}\mcn@coursecode}\par\fi {\Large\sffamily\bfseries\color{mcnPrimary}\@title}\par \ifx\mcn@docsubtitle\@empty\else{\small\sffamily\color{gray}\mcn@docsubtitle}\par\fi }% \end{minipage}% \begin{minipage}[t]{0.33\linewidth}% {\raggedleft\small\sffamily\color{mcnText}% \ifx\mcn@professor\@empty\else\textbf{Instructor:} \mcn@professor\par\fi \ifx\mcn@term\@empty\else\textbf{Term:} \mcn@term\par\fi \ifx\mcn@lecturedate\@empty\else\textbf{Date:} \mcn@lecturedate\par\fi \ifx\mcn@institution\@empty\else\textbf{Institution:} \mcn@institution\par\fi }% \end{minipage}% \end{minipage}% }% \vspace{0.8em}% }{% \ifstrequal{\mcn@mode}{worksheet}{% % Worksheet Header Banner \vspace*{-0.5cm}% \noindent \fcolorbox{mcnPrimary}{mcnBoxBg}{% \begin{minipage}{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}% \paddingv \begin{minipage}[t]{0.55\linewidth}% {\raggedright \ifx\mcn@coursecode\@empty\else{\small\sffamily\bfseries\color{mcnSecondary}\mcn@coursecode: \mcn@course}\par\fi {\Large\sffamily\bfseries\color{mcnPrimary}\ifx\mcn@assignmentname\@empty\@title\else\mcn@assignmentname\fi}\par \ifx\mcn@term\@empty\else{\small\sffamily\color{gray}\mcn@term}\par\fi }% \end{minipage}% \begin{minipage}[t]{0.43\linewidth}% {\raggedleft\small\sffamily\color{mcnText}% \textbf{Student Name:} \rule{4cm}{0.4pt}\par\vspace{3pt}% \textbf{Student ID:} \rule{4.3cm}{0.4pt}\par\vspace{3pt}% \textbf{Date:} \rule{5cm}{0.4pt}% }% \end{minipage}% \end{minipage}% }% \vspace{0.8em}% }{% % Full Notes Cover Banner \begin{center} \vspace*{0.5cm} \fcolorbox{mcnPrimary}{mcnBoxBg}{% \begin{minipage}{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}% \vspace{12pt}% \centering \ifx\mcn@coursecode\@empty\else{\small\sffamily\bfseries\color{mcnSecondary}\mcn@coursecode}\\[4pt]\fi {\huge\sffamily\bfseries\color{mcnPrimary}\@title}\\[6pt] \ifx\mcn@docsubtitle\@empty\else{\large\sffamily\color{mcnSecondary}\mcn@docsubtitle}\\[8pt]\fi \rule{0.6\linewidth}{1pt}\\[10pt] {\small\sffamily\color{mcnText}% \ifx\mcn@professor\@empty\else \textbf{Professor:} \mcn@professor \quad\textbar\quad \fi \ifx\mcn@term\@empty\else \textbf{Term:} \mcn@term \quad\textbar\quad \fi \ifx\mcn@institution\@empty\else \mcn@institution \fi }% \vspace{12pt}% \end{minipage}% }% \vspace*{0.8cm} \end{center} }} } \newcommand{\paddingv}{\vspace{8pt}} % ------------------------------------------------------------------- % Lecture Tracking System % ------------------------------------------------------------------- \newcounter{lecture} \newcommand{\lecture}[3][]{% [date]{number}{title} \refstepcounter{lecture}% \def\mcn@currentlecture{Lecture #2: #3}% \par\vspace{1.2em}% \noindent \fcolorbox{mcnSecondary}{mcnBoxBg}{% \begin{minipage}{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}% \vspace{6pt}% \noindent\hspace{8pt}% \begin{minipage}{\dimexpr\linewidth-16pt\relax}% {\raggedright {\small\sffamily\bfseries\color{mcnSecondary} LECTURE #2 \ifx&\else\hfill #1\fi}\par\vspace{2pt}% {\Large\sffamily\bfseries\color{mcnPrimary} #3}\par }% \end{minipage}% \vspace{6pt}% \end{minipage}% }% \addcontentsline{toc}{section}{Lecture #2: #3}% \par\vspace{0.8em}% } % ------------------------------------------------------------------- % Universal Custom Modern Callout Box Engine % ------------------------------------------------------------------- % Native TeX callout frame generator (zero external macro dependency) \newcommand{\mcn@callout}[5]{% {BorderColor}{BgColor}{Label}{Icon/Prefix}{Content} \par\addvspace{0.8em}% \noindent \fcolorbox{#1}{#2}{% \begin{minipage}{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}% \vspace{6pt}% \noindent\hspace{8pt}% \begin{minipage}{\dimexpr\linewidth-16pt\relax}% {\sffamily\bfseries\color{#1}#4 #3}\par\vspace{4pt}% \color{mcnText}#5% \end{minipage}% \vspace{6pt}% \end{minipage}% }% \par\addvspace{0.8em}% } % ------------------------------------------------------------------- % Pedagogy & Theorem Environments % ------------------------------------------------------------------- \newcounter{mcnTheoremCount} \newcounter{mcnDefCount} \newcounter{mcnExampleCount} \newcounter{mcnExerciseCount} \newenvironment{theorem}[1][]{% \refstepcounter{mcnTheoremCount}% \def\mcn@title{Theorem \themcnTheoremCount\ifx&\else\ (#1)\fi}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnTheorem}{mcnTheoremBg}{\mcn@title}{[THM]}{\usebox{\mcn@box}}% } \newenvironment{lemma}[1][]{% \refstepcounter{mcnTheoremCount}% \def\mcn@title{Lemma \themcnTheoremCount\ifx&\else\ (#1)\fi}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnTheorem}{mcnTheoremBg}{\mcn@title}{[LEM]}{\usebox{\mcn@box}}% } \newenvironment{proposition}[1][]{% \refstepcounter{mcnTheoremCount}% \def\mcn@title{Proposition \themcnTheoremCount\ifx&\else\ (#1)\fi}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnTheorem}{mcnTheoremBg}{\mcn@title}{[PROP]}{\usebox{\mcn@box}}% } \newenvironment{corollary}[1][]{% \refstepcounter{mcnTheoremCount}% \def\mcn@title{Corollary \themcnTheoremCount\ifx&\else\ (#1)\fi}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnTheorem}{mcnTheoremBg}{\mcn@title}{[COR]}{\usebox{\mcn@box}}% } \newenvironment{definition}[1][]{% \refstepcounter{mcnDefCount}% \def\mcn@title{Definition \themcnDefCount\ifx&\else\ (#1)\fi}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnDefinition}{mcnDefinitionBg}{\mcn@title}{[DEF]}{\usebox{\mcn@box}}% } \newenvironment{example}[1][]{% \refstepcounter{mcnExampleCount}% \def\mcn@title{Example \themcnExampleCount\ifx&\else\ (#1)\fi}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnExample}{mcnExampleBg}{\mcn@title}{[EX]}{\usebox{\mcn@box}}% } \newenvironment{remark}[1][]{% \def\mcn@title{Remark\ifx&\else\ (#1)\fi}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnRemark}{mcnRemarkBg}{\mcn@title}{[REM]}{\usebox{\mcn@box}}% } \newenvironment{warning}[1][]{% \def\mcn@title{Warning\ifx&\else\ (#1)\fi}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnWarning}{mcnWarningBg}{\mcn@title}{[!]}{\usebox{\mcn@box}}% } \newenvironment{tip}[1][]{% \def\mcn@title{Pro Tip\ifx&\else\ (#1)\fi}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnTip}{mcnTipBg}{\mcn@title}{[*]}{\usebox{\mcn@box}}% } \newenvironment{takeaways}{% \def\mcn@title{Key Takeaways}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnPrimary}{mcnBoxBg}{\mcn@title}{[KEY]}{\usebox{\mcn@box}}% } \newenvironment{exercise}[1][]{% \refstepcounter{mcnExerciseCount}% \def\mcn@title{Exercise \themcnExerciseCount\ifx&\else\ (#1)\fi}% \begin{lrbox}{\mcn@box}% \begin{minipage}{\dimexpr\linewidth-24pt\relax}% }{% \end{minipage}% \end{lrbox}% \mcn@callout{mcnSecondary}{mcnBoxBg}{\mcn@title}{[EXR]}{\usebox{\mcn@box}}% } \newenvironment{solution}{% \ifmcn@showsolutions \par\vspace{0.4em}% \noindent{\sffamily\bfseries\color{mcnSecondary}Solution:}\par\vspace{0.2em}% \else \comment \fi }{% \ifmcn@showsolutions \par\vspace{0.6em}% \else \endcomment \fi } \newsavebox{\mcn@box} % Standard Proof environment wrapper \renewenvironment{proof}[1][Proof]{% \par\vspace{0.4em}% \noindent{\sffamily\bfseries\color{mcnPrimary}#1:}\quad\ignorespaces }{% \hfill$\blacksquare$\par\vspace{0.6em}% } % ------------------------------------------------------------------- % Code Snippets & Listings Integration % ------------------------------------------------------------------- \lstset{ basicstyle=\small\ttfamily\color{mcnText}, keywordstyle=\bfseries\color{mcnPrimary}, stringstyle=\color{mcnExample}, commentstyle=\itshape\color{mcnRemark}, numbers=left, numberstyle=\tiny\color{gray}, stepnumber=1, numbersep=8pt, backgroundcolor=\color{mcnBoxBg}, showstringspaces=false, tabsize=2, breaklines=true, breakatwhitespace=false, frame=single, rulecolor=\color{mcnBorder}, xleftmargin=12pt, framexleftmargin=12pt } \newenvironment{codebox}[1][Code Snippet]{% \par\vspace{0.5em}% \noindent{\small\sffamily\bfseries\color{mcnPrimary}#1}\par\vspace{0.3em}% }{% \par\vspace{0.5em}% } % ------------------------------------------------------------------- % Hyperref Configuration % ------------------------------------------------------------------- \RequirePackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=mcnPrimary, citecolor=mcnSecondary, urlcolor=mcnSecondary, pdfborder={0 0 0}, breaklinks=true } \endinput