% \iffalse meta-comment
%
% File: whatsnote.dtx
% -----------------------------------------------------------------------
%   Copyright (C) 2024-2025 by Mingyu Xia <myhsia@outlook.com>          *
%                                                                       *
%   This work may be distributed and/or modified under the conditions   *
%   of the LaTeX Project Public License (LPPL), 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 or later.                                              *
%                                                                       *
%   This work has the LPPL maintenance status `maintained'.             *
%                                                                       *
%   The Current Maintainer of this work is Mingyu Xia.                  *
%                                                                       *
%   This work consists of the files whatsnote.dtx,                      *
%                                   whatsnote.ins,                      *
%                 the derived files whatsnote.cls,                      *
%                                   whats-*-module.code.tex,            *
%           the documentation files whatsnote.pdf,                      *
%                               and README.md.                          *
% -----------------------------------------------------------------------
%
%   Any modification of this file should ensure that the copyright and
%   license information is placed in the derived files.
%
% -----------------------------------------------------------------------
%
%<*internal>
\iffalse
%</internal>
%
%<*readme>
[![CTAN Version](https://img.shields.io/ctan/v/whatsnote)](https://ctan.org/pkg/whatsnote)
[![GitHub Release](https://img.shields.io/github/v/release/myhsia/whatsnote)](https://github.com/myhsia/whatsnote/releases/latest)
[![GitHub Last Commit](https://img.shields.io/github/last-commit/myhsia/whatsnote)](https://github.com/myhsia/whatsnote/commits)
[![Actions Status](https://github.com/myhsia/whatsnote/actions/workflows/main.yaml/badge.svg?branch=main)](https://github.com/myhsia/whatsnote/actions)
[![GitHub Repo stars](https://img.shields.io/github/stars/myhsia/whatsnote)](https://github.com/myhsia/whatsnote)

The `whatsnote` Class
=======================

The whatsnote LaTeX class provides an elegant layout and powerful tools for taking notes in science, engineering, etc.

Overview
--------

See `whatsnote.pdf` for more. Happy TeXing!

Issues
------

The issue tracker for `whatsnote` is currently located
[on GitHub](https://github.com/myhsia/whatsnote/issues).

Build status
------------

This project uses [GitHub Actions](https://github.com/features/actions)
as a hosted continuous integration service. For each commit, the build status
is tested using the current release of TeX Live.

_Current build status:_ ![build status](https://github.com/myhsia/whatsnote/actions/workflows/main.yaml/badge.svg?branch=main)

Copyright and License
---------------------

Copyright (C) 2024-2025 by Mingyu Xia <myhsia@outlook.com>

This work may be distributed and/or modified under the conditions
of the LaTeX Project Public License (LPPL), 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 or later.

This work has the LPPL maintenance status `maintained'.

The Current Maintainer of this work is **Mingyu Xia**.
%</readme>
%
%<*internal>
\fi
%</internal>
%
%<*driver>
\documentclass{l3doc}
\usepackage{pdfpages}
\graphicspath{{./demo/}}
\usepackage[osf, mono = false]{libertine}
\ExplSyntaxOn \makeatletter
\DeclareDocumentCommand \key { s m }
  {
    \IfBooleanTF {#1} { \textcolor{red}{\ttfamily \bfseries #2} }
      {
        \ttfamily
        \seq_set_from_clist:Nn \l_tmpa_seq {#2}
        \seq_set_map:NNn \l_tmpb_seq \l_tmpa_seq
          { \exp_not:n { \textcolor{red}{\bfseries ##1} } }
        \seq_use:Nn \l_tmpb_seq { ,~ } \:=\:
      }
  }
\DeclareCommandCopy \val \meta
\def \TFF {true\textup{\textbar\underline{\textbf{false}}}}
\def \TTF {\textup{\underline{\textbf{true}}\textbar}false}
\def \HoLogo@ApLaTeX #1{
  \HOLOGO@mbox {A\kern -.05em p\kern -.05em \hologo{LaTeX}}}
\makeatother \ExplSyntaxOff
\newlist{keyval}{itemize}{10}
\setlist[keyval]{leftmargin = 0pt, labelsep = 0pt}
\makeindex
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \title{^^A
%   The \cls{whatsnote} Class\thanks{^^A
%     \url{https://github.com/myhsia/whatsnote},
%     \url{https://ctan.org/pkg/whatsnote}^^A
%   }^^A
% }
%
% \author{^^A
%   Mingyu Xia \texttt{<^^A
%     \href{mailto:xiamingyu@westlake.edu.cn}{xiamingyu@westlake.edu.cn}>^^A
%   }^^A
% }
%
% \date{Released 2025-11-12\quad \texttt{v5.0B}}
%
% \maketitle
%
% \begin{documentation}
%
% \section{Introduction}
%
% The \cls{whatsnote} \hologo{LaTeX} class provides an elegant layout and
% powerful tools for taking notes in science, engineering, etc.
% It supports various compilation methods,
% such as \hologo{pdfLaTeX}, \hologo{XeLaTeX}, \hologo{ApLaTeX},
% \hologo{LuaLaTeX}, etc.
%
% \section{Usage}
%
% To load this class, write the line
% \begin{quote}
%   |\documentclass{whatsnote}|
% \end{quote}
%
% \subsection{Cover configuration}
%
% \begin{function}{\coverset}
%   \begin{syntax}
%     \cs{coverset} \marg{keys}
%   \end{syntax}
%   The \cs{coverset} macro can config the cover, the mandatory argument
%   accepts the following keys
%   \begin{keyval}
%     \item [\key{title}] \val{string} can set the title on the cover page.
%     \item [\key{author, afill}] \val{string} can set the author and the
%     affliction respectively on the cover page, and they will be combined
%     together with a vertical bar separated.
%     \item [\key{date}] \val{string} can set the date on the cover page.
%     \item [\key{extinfo}] \val{string} can add contents at the south east
%     corner of the cover page (e.g., add your personal seal (``Yìn Zhāng'' in
%     Chinese)).
%     \item [\key{head, clogo}] \val{file} can add pictures at the top /
%     the center white area of the cover page accordingly.
%     \item [\key{llogos}] \val{files' comma list} can add a series of pictures
%     at the ``left bar'' of the title page.
%   \end{keyval}
% \end{function}
%
% \begin{function}{\maketitle}
%   \begin{syntax}
%     \cs{maketitle} \oarg{color}
%   \end{syntax}
%   The \cs{maketitle} macro can generate the cover and config the theme color
%   in its optional argument.
% \end{function}
%
% \begin{function}{\sidehead, \sidefoot}
%   \begin{syntax}
%     \cs{sidehead} \marg{sidebar header} \cs{sidefoot} \marg{sidebar footer}
%   \end{syntax}
%   The \cs{sidehead, sidefoot} macros can config the header and footer in the
%   sidebar.
% \end{function}
%
% \begin{function}{\mathemph}
%   \begin{syntax}
%     \cs{mathemph} \marg{math equation}
%   \end{syntax}
%   The \cs{mathemph} macro can color-emphing math formula.
% \end{function}
%
% \section{Working Example} \label{mwe}
%
% \verbatiminput{whatsnote-demo.tex}
%
% \includepdf[pages = -, nup = 2x2]{whatsnote-demo.pdf}
%
% \end{documentation}
%
% \appendix \pagenumbering{Roman}
%
% \begin{implementation}
%
% \section{The Source Code}
%
% Assign the module name of the variables and control sequences, which will be
% automatically replaced by \pkg{l3docstrip}.
%    \begin{macrocode}
%<@@=whats>
%    \end{macrocode}
%
% \subsection{The \texttt{whatsnote.cls} file}
%
% Start the optionlist |class| for \pkg{l3docstrip}.
%    \begin{macrocode}
%<*class>
%    \end{macrocode}
% Define the date, version, and summary variables, and declare the class.
%    \begin{macrocode}
\def \whatsnote@date    {2025-11-12}
\def \whatsnote@version {v5.0B}
\def \whatsnote@tldr
  {LaTeX class for taking notes in science, engineering, etc.}
\ProvidesExplClass {whatsnote} {\whatsnote@date}
  {\whatsnote@version} {\whatsnote@tldr}
%    \end{macrocode}
% \begin{macro}{\@@_msg_new:nn}
% \begin{macro}{\@@_msg_error:nn, \@@_msg_warning:nn}
% Functions for broadcast errors and warnings.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_msg_new:nn #1#2 
  { \msg_new:nnn { whatsnote } {#1} {#2} }
\cs_new_protected:Npn \@@_msg_error:nn #1#2
  { \msg_error:nnn { whatsnote } {#1} {#2} }
\cs_new_protected:Npn \@@_msg_warning:nn #1#2
  { \msg_error:nnn { whatsnote } {#1} {#2} }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\@@_provide_module:n}
% Function for providing modules with the predefined date and version variables.
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_provide_module:n #1
  {
    \ProvidesExplFile {whats-#1-module.code.tex}
      {\whatsnote@date} {\whatsnote@version}
      { whatsNote ~ \text_titlecase:n {#1} ~ Module }
  }
%    \end{macrocode}
% \begin{macro}{\@@_load_module:n}
% Function for loading modules.
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_load_module:n #1 
  {
    \clist_map_inline:nn {#1}
      {
        \file_if_exist_input:nF { whats-##1-module.code.tex }
          { \@@_msg_error:nn { not found module } {##1} }
      }
  }
\@@_msg_new:nn { not found module }
  { The ~ whats ~ module ~ `#1' ~ not ~ found. }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{variable}{\g_@@_base_class_options_clist}
% Variable for storing global option for basic class.
%    \begin{macrocode}
\clist_new:N \g_@@_base_class_options_clist
\keys_define:nn { whats / classoption }
  {
    unknown .code:n = \@@_unknown_option:n { #1 },
  }
%    \end{macrocode}
% \end{variable}
% \begin{macro}{\@@_unknown_option:n}
% Parsing unknown options: pass them to the basic class.
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_unknown_option:n #1
  {
    \tl_if_empty:nTF { #1 }
      { \clist_gput_right:NV \g_@@_base_class_options_clist \l_keys_key_str }
      {
        \exp_args:NNx \clist_gput_right:Nn \g_@@_base_class_options_clist
          { \l_keys_key_str = \exp_not:n {#1} }
      }
  }
\ProcessKeyOptions [ whats / classoption ]
%    \end{macrocode}
% \end{macro}
% Load basic class with some preloaded options.
%    \begin{macrocode}
\PassOptionsToClass { book } { 11pt }
\PassOptionsToPackage { svgnames } { xcolor }
\exp_args:NNV \LoadClass [ \g_@@_base_class_options_clist ] { book }
%    \end{macrocode}
% Load modules for \cls{whatsnote}.
%    \begin{macrocode}
\@@_load_module:n { typeset, layout, theorem, cover }
%    \end{macrocode}
% End the input stream of \file{whatsnote.cls}.
%    \begin{macrocode}
\file_input_stop:
%    \end{macrocode}
% End the optionlist |class| for \pkg{l3docstrip}.
%    \begin{macrocode}
%</class>
%    \end{macrocode}
%
% \subsection{The \texttt{whats-typeset-module.code.tex} file}
%
% Start the optionlist |typeset| for \pkg{l3docstrip}.
%    \begin{macrocode}
%<*typeset>
%    \end{macrocode}
% Declare the module file.
%    \begin{macrocode}
\@@_provide_module:n { typeset }
%    \end{macrocode}
% Load the \pkg{amssymb}, \pkg{bbm}, \pkg{bm}, \pkg{cancel}, \pkg{extarrows},
% \pkg{mathtools}, \pkg{nicematrix}, \pkg{xfrac} packages.
%    \begin{macrocode}
\RequirePackage{amssymb, bbm, bm, cancel, extarrows,
                mathtools, nicematrix, xfrac}
%    \end{macrocode}
% Load the |e| style \pkg{esvect} package for \cs[no-index]{vec} arrow,
% then define the anti-vector arrow.
%    \begin{macrocode}
\RequirePackage[e]{esvect}
\let \vec \vv
\DeclareRobustCommand \cev [1]{{\mathpalette\do@cev{#1}}}
\newcommand \do@cev [2]{
  \vbox{\offinterlineskip
    \ialign{##\cr
      \hidewidth\reflectbox{$\m@th#1\vec{}\mkern4mu$}\hidewidth\cr
      $\m@th#1#2$\cr
    }
  }
}
%    \end{macrocode}
% Load the \pkg{fixdif} and \pkg{derivative} packages for inputting math
% derivatives, suppress warnings when using |xetex|.
%    \begin{macrocode}
\sys_if_engine_xetex:T { \PassOptionsToPackage { no-math } { fontspec } }
\RequirePackage{fixdif, derivative}
%    \end{macrocode}
% Define some mathematic operators.
%    \begin{macrocode}
\newdif \D {\mathsf D}
\newdif \upe {\mathrm e}
\newdif \iu {\mathrm i \mkern1mu}
\let \sinh \relax \let \cosh \relax \let \tanh \relax \let \coth \relax
\DeclareMathOperator \sinh  {sh}
\DeclareMathOperator \cosh  {ch}
\DeclareMathOperator \tanh  {th}
\DeclareMathOperator \coth  {cth}
\DeclareMathOperator \sgn   {sgn}
\DeclareMathOperator \cotan {\qopname\relax o{ctg}}
\DeclareMathOperator \im    {im}
\DeclareMathOperator \adj   {adj}
\DeclareRobustCommand \tran{^{\mkern-1.5mu\mathsf T}}
\DeclareRobustCommand \identity {\ensuremath{\mathbbm 1}}
%    \end{macrocode}
% Load the \pkg{siunitx} package for inputting physics units,
% then declare the unit ``angstrom''.
%    \begin{macrocode}
\RequirePackage{siunitx}
\DeclareSIUnit \angstrom {\text \AA}
%    \end{macrocode}
% Load the \pkg{mhchem} package for inputting chemistry formula.
%    \begin{macrocode}
\RequirePackage[version = 4]{mhchem}
%    \end{macrocode}
% Load the \pkg{physics2} package's some modules for quick math and physics
% input. Temporarily change the module name for hacking the package\footnote{
% \href{https://github.com/AlphaZTX/}{|@AlphaZTX|} has not merged
% \href{https://github.com/AlphaZTX/physics2/issues/28}{my suggestion}
% for the \pkg{physics2} package. Blame him!}.
%    \begin{macrocode}
%<@@=phy>
\RequirePackage{physics2}
\usephysicsmodule{ab, ab.braket, diagmat, xmat, qtext.legacy, op.legacy}
%    \end{macrocode}
% Switch the star and non-star branches for the Dirac brackets inputting
% commands to make the non-equal height brackets the default.
%    \begin{macrocode}
\DeclareRobustCommand \bra
  {\@ifstar{\phy@d@lx{br.m}{br.a}}{\phy@d@lx{br.m}{br.a}*}}
\DeclareRobustCommand \ket
  {\@ifstar{\phy@d@lx{kt.m}{kt.a}}{\phy@d@lx{kt.m}{kt.a}*}}
\DeclareRobustCommand \braket
  {\@ifstar{\phy@d@lx{bk.m}{bk.a}}{\phy@d@lx{bk.m}{bk.a}*}}
\DeclareRobustCommand \ketbra
  {\@ifstar{\phy@d@lx{kb.m}{kb.a}}{\phy@d@lx{kb.m}{kb.a}*}}
%    \end{macrocode}
% Extend the |diagmat| module for the \pkg{physics2} package: support the small
% matrices, and enable users to modify the alignments of the matrices' elements.
%    \begin{macrocode}
\DeclareDocumentCommand \diagmat { s O{} m }
  {
    \IfBooleanTF {#1}
      { \@@_diagmat_type:nnn {  small } {#2} {#3} }
      { \@@_diagmat_type:nnn {        } {#2} {#3} }
  }
\DeclareDocumentCommand \pdiagmat { s O{} m }
  {
    \IfBooleanTF {#1}
      { \@@_diagmat_type:nnn { psmall } {#2} {#3} }
      { \@@_diagmat_type:nnn { p      } {#2} {#3} }
  }
\DeclareDocumentCommand \bdiagmat { s O{} m }
  {
    \IfBooleanTF {#1}
      { \@@_diagmat_type:nnn { bsmall } {#2} {#3} }
      { \@@_diagmat_type:nnn { b      } {#2} {#3} }
  }
\DeclareDocumentCommand \Bdiagmat { s O{} m }
  {
    \IfBooleanTF {#1}
      { \@@_diagmat_type:nnn { Bsmall } {#2} {#3} }
      { \@@_diagmat_type:nnn { B      } {#2} {#3} }
  }
\DeclareDocumentCommand \vdiagmat { s O{} m }
  {
    \IfBooleanTF {#1}
      { \@@_diagmat_type:nnn { vsmall } {#2} {#3} }
      { \@@_diagmat_type:nnn { v      } {#2} {#3} }
  }
\DeclareDocumentCommand \Vdiagmat { s O{} m }
  {
    \IfBooleanTF {#1}
      { \@@_diagmat_type:nnn { Vsmall } {#2} {#3} }
      { \@@_diagmat_type:nnn { V      } {#2} {#3} }
  }
%    \end{macrocode}
% Restore the module name.
%    \begin{macrocode}
%<@@=whats>
%    \end{macrocode}
% Load and config the \pkg{hyperref} package, suppress the |bookmark| warnings.
%    \begin{macrocode}
\RequirePackage{hyperref}
\hypersetup{colorlinks, citecolor = teal}
\let\oldHyPsd@CatcodeWarning\HyPsd@CatcodeWarning
\renewcommand \HyPsd@CatcodeWarning [1]
  {\ifnum\pdfstrcmp{#1}{math shift}=0 \else \oldHyPsd@CatcodeWarning{#1} \fi}
\pdfstringdefDisableCommands{
  \def\intop{int} \def\ilimits@{lim}
  \def\infty{infty} \let\HyPsd@CatcodeWarning\@gobble
}
%    \end{macrocode}
% \begin{macro}{\mathemph}
% Macro for color-emphing math formula.
%    \begin{macrocode}
\NewDocumentCommand \mathemph { O{} m } {\ifmmode
  \colorbox{Crimson!15}{\vphantom{$\displaystyle #1$}$\displaystyle #2$}\else
  \colorbox{Crimson!15}{\vphantom{#1}#2}\fi}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\color_set:nnn { eqcolor } { HTML } { 2F4F4F }
%    \end{macrocode}
% Restore the definition for \cs{[} and \cs{]} changed by \pkg{amsmath},
% then apply the equations' color (high-unstable, temporarily disabled).
%    \begin{macrocode}
% \def \dollardollar@begin { \def \eqcolor {\color{eqcolor}} \eqcolor $$ }
% \def \dollardollar@end   { $$ \color_select:n {black} }
\DeclareRobustCommand \[
  {
    \scan_stop:
    \if_mode_math:
      \@badmath
    \else:
      \if_mode_vertical:
        \nointerlineskip
        \makebox[.6\linewidth]{ }
      \fi:
    \dollardollar@begin % \color_select:n { eqcolor }
    \fi:
  }
\DeclareRobustCommand \]
  {
    \scan_stop:
    \if_mode_math:
      \if_mode_inner:
        \@badmath
      \else:
        \dollardollar@end
      \fi:
    \else:
      \@badmath
    \fi:
    \ignorespaces
  }
%    \end{macrocode}
% End the input stream of \file{whats-typeset-module.code.tex}.
%    \begin{macrocode}
\file_input_stop:
%    \end{macrocode}
% End the optionlist |typeset| for \pkg{l3docstrip}.
%    \begin{macrocode}
%</typeset>
%    \end{macrocode}
%
% \subsection{The \texttt{whats-layout-module.code.tex} file}
%
% Start the optionlist |layout| for \pkg{l3docstrip}.
%    \begin{macrocode}
%<*layout>
%    \end{macrocode}
% Declare the module file.
%    \begin{macrocode}
\@@_provide_module:n { layout }
%    \end{macrocode}
% Load the \pkg{anyfontsize}, \pkg{lmodern}, \pkg{microtype}, \pkg{manfnt},
% \pkg{ragged2e}, \pkg{soul}, \pkg{libertine}, \pkg{ulem}, \pkg{xcolor}
% packages.
%    \begin{macrocode}
\RequirePackage{anyfontsize, lmodern, microtype, manfnt, ragged2e, soul}
\RequirePackage[mono = false, osf]{libertine}
\RequirePackage[normalem]{ulem}
\RequirePackage[svgnames]{xcolor}
%    \end{macrocode}
% Config the \pkg{geometry}.
%    \begin{macrocode}
\RequirePackage[left  = 1.25in, vmargin = 1in, headheight = 15pt,
                right = .75in,  headsep = 15pt]{geometry}
%    \end{macrocode}
%    \begin{macrocode}
\RequirePackage{graphicx, pgfplots}
\graphicspath{{./media/logos/} {./media/}}
\pgfplotsset{compat = newest}
% Table and list
\RequirePackage{booktabs, array, enumext}
\setenumext[enumext, 1]{label = (\alph*)}
\setenumext[enumext, 2]{label = \roman*.}
\RequirePackage[inline]{enumitem}
%    \end{macrocode}
% Config the header and footer.
%    \begin{macrocode}
\RequirePackage{fancyhdr}
\renewcommand* \chaptermark [1]
  {
    \markboth
      {
        \normalfont \biolinumLF \scshape
        \int_compare:nNnT { \c@secnumdepth } > { \m@ne }
          { \if@mainmatter \@chapapp \ \thechapter .~\ \fi } #1
      } {}
  }
\renewcommand* \sectionmark [1]
  {
    \markright
      {
        \normalfont \sffamily
        \int_compare:nNnT { \c@secnumdepth } > { \z@ } { \thesection . \ } #1
      }
  }
\fancyhead[OR]{\sffamily \rightmark}
\fancyhead[OL]{\sffamily \thepage}
\fancyhead[EL]{\sffamily \leftmark}
\fancyhead[ER]{\sffamily \thepage}
\fancyfoot[L,C,R]{}
\pagestyle{fancy}
%    \end{macrocode}
% Config the header rule and footer rule style.
%    \begin{macrocode}
\renewcommand* \headrulewidth {1pt}
\renewcommand* \footrulewidth {.5pt}
\hook_gput_code:nnn { cmd / headrule / before } {.}
  { \color_select:n { black!25 } }
\renewcommand \footrule
  {
    \if@fancyplain \let \footrulewidth \plainfootrulewidth \fi
    \color_select:n { black!25 }
    \hrule \@width \headwidth \@height \footrulewidth
  }
%    \end{macrocode}
% Paragraphs configurations.
%    \begin{macrocode}
\linespread{1.2}
\RequirePackage{titlesec, subcaption}
\titleformat \chapter [hang] {\huge \bfseries \sffamily}
  {\biolinumLF \scshape \@chapapp\ \thechapter} {1em} {}
\titlespacing* \chapter {\z@} {\z@} {30pt}
\titlespacing \paragraph {\z@} {1.5ex minus .1 ex} {1pc}
\RequirePackage{paracol}
\columnratio{.64}
\RequirePackage{framed}
\setlength \FrameSep {\z@}
\setlength \parindent {\z@}
%    \end{macrocode}
% Config the appearance of appendix in toc.
%    \begin{macrocode}
\renewcommand \@pnumwidth {2.5em}
\renewcommand \appendix {
  \cleardoublepage
  \setcounter{chapter}{0}
  \setcounter{section}{0}
  \gdef\@chapapp{\appendixname}
  \gdef\thechapter{\@Alph\c@chapter}
  \addtocontents {toc} { \protect \makeatletter }
  \addtocontents {toc} {
    \token_to_str:N \renewcommand* \token_to_str:N \l@section
      { \token_to_str:N \@dottedtocline {1} {1.5em} {5em} }
  }
  \addtocontents {toc} { \protect \makeatother }
  \renewcommand*\familydefault {\sfdefault}
  \pagenumbering{roman}
}
%    \end{macrocode}
% End the input stream of \file{whats-layout-module.code.tex}.
%    \begin{macrocode}
\file_input_stop:
%    \end{macrocode}
% End the optionlist |class| for \pkg{l3docstrip}.
%    \begin{macrocode}
%</layout>
%    \end{macrocode}
%
% \subsection{The \texttt{whats-theorem-module.code.tex} file}
%
% Start the optionlist |theorem| for \pkg{l3docstrip}.
%    \begin{macrocode}
%<*theorem>
%    \end{macrocode}
% Declare the module file.
%    \begin{macrocode}
\@@_provide_module:n { theorem }
%    \end{macrocode}
% Load the \pkg{keytheorems} package, and predefine the following environments.
%    \begin{macrocode}
\RequirePackage{keytheorems}
\newcounter {week}
\newcommand \newweek { \refstepcounter{week} \clearpage }
\newkeytheorem { theorem    } [ parent    = section, style = definition ]
\newkeytheorem { example    } [ parent    = section, style = definition ]
\newkeytheorem { definition } [ parent    = section, style = definition ]
\newkeytheorem { problem    } [ parent    = week,    style = definition ]
\newkeytheorem { solution   } [ numbered  = false,   style = definition ]
\newkeytheorem { remark     } [ numbered  = false,   style = remark     ]
%    \end{macrocode}
%
%    \begin{macrocode}
\file_input_stop:
%    \end{macrocode}
%
%    \begin{macrocode}
%</theorem>
%    \end{macrocode}
%
% \subsection{The \texttt{whats-cover-module.code.tex} file}
%
% Start the optionlist |cover| for \pkg{l3docstrip}.
%    \begin{macrocode}
%<*cover>
%    \end{macrocode}
% Declare the module file.
%    \begin{macrocode}
\@@_provide_module:n { cover }
%    \end{macrocode}
% Load the \pkg{tikz} package for graphing the 
% (The |expl3| syntax needs to be temporarily turned off).
%    \begin{macrocode}
\RequirePackage{tikz, zref-totpages}
\ExplSyntaxOff
\usetikzlibrary{fadings, patterns, arrows.meta}
\tikzset{ > = Stealth, every picture/.append style = {
          line join = round, line cap = round, thick } }
\ExplSyntaxOn
%    \end{macrocode}
% \begin{macro}{\coverset}
% Macro for cover configuration by setting keys.
%    \begin{macrocode}
\DeclareDocumentCommand \coverset { m } { \keys_set:nn { @@ / coverset } {#1} }
%    \end{macrocode}
% \begin{variable}{\l_@@_cover_llogos_clist}
% Comma list for storing the left logos' path.
%    \begin{macrocode}
\clist_new:N \l_@@_cover_llogos_clist
%    \end{macrocode}
% \begin{variable}
%   {
%     \@title, \@author, \@afill, \@date, \l_@@_cover_extinfo_tl,
%     \l_@@_cover_head_tl,                \l_@@_cover_clogo_tl
%   }
% Token lists for storing elements on the cover page.
%    \begin{macrocode}
\keys_define:nn { @@ / coverset }
  {
    title         .tl_gset:N    = \@title,
    author        .tl_gset:N    = \@author,
    afill         .tl_gset:N    = \@afill,
    date          .tl_gset:N    = \@date,
      date        .initial:n    = \today,
    extinfo       .tl_set:N     = \l_@@_cover_extinfo_tl,
    head          .tl_set:N     = \l_@@_cover_head_tl,
    clogo         .tl_set:N     = \l_@@_cover_clogo_tl,
    llogos        .clist_set:N  = \l_@@_cover_llogos_clist,
  }
%    \end{macrocode}
% \end{variable}
% \end{variable}
% \end{macro}
% \begin{macro}{\sidehead, \sidefoot}
% \begin{variable}{\@sidehead, \@sidefoot}
% Macros for configuring the header and footer on the sidebar.
%    \begin{macrocode}
\DeclareRobustCommand * \sidehead [1] { \tl_gset:Nn \@sidehead {#1} }
\DeclareRobustCommand * \sidefoot [1] { \tl_gset:Nn \@sidefoot {#1} }
%    \end{macrocode}
% \end{variable}
% Set the header and footer of the sidebar \meta{title name},
% \meta{page number} / \meta{total page} by default.
%    \begin{macrocode}
\sidehead{\@title}
\sidefoot{\thepage\,/\,\ztotpages}
%    \end{macrocode}
% \end{macro}
% Declare a hook for sidebar.
%    \begin{macrocode}
\hook_gset_rule:nnnn { shipout / background } { shipout_@@ }
                     { before } { pgfrcs }
%    \end{macrocode}
% \begin{macro}{\maketitle}
% Redefine the \cs{maketitle} macro for graphing the cover and load the hook.
%    \begin{macrocode}
\DeclareDocumentCommand \maketitle { O { gray } }
  {
    \@@_@maketitle:n {#1}
    \hook_gput_code:nnn { shipout / background } { shipout_@@ }
      { \if@mainmatter \@@_sidebar_hook:n {#1} \fi }
  }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@@_@maketitle:n}
% The auxiliary command for \cs{maketitle}.
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_@maketitle:n #1
  {
    \pagecolor{#1!10}
    \let \cleardoublepage \clearpage
    \begin{titlepage}
      \begin{tikzpicture} [ remember ~ picture, overlay ]
        \tl_if_empty:NF \l_@@_cover_head_tl
          {
            \node [ yshift = .325\paperheight, opacity = .5,
                    rotate ~ around = { pi \c_colon_str
                    ([yshift = .325\paperheight]current ~ page.center)} ]
              at (current ~ page.center)
              { \includegraphics [width = \paperwidth]
                { \l_@@_cover_head_tl } };
          }
        \clist_if_empty:NF \l_@@_cover_llogos_clist
          {
            \int_step_inline:nn { \clist_count:N \l_@@_cover_llogos_clist }
              {
                \node
                  [ opacity = .25, yshift = {
                    -.6\paperheight / 2 /
                      \clist_count:N \l_@@_cover_llogos_clist +
                    ##1 * .6\paperheight /
                      \clist_count:N \l_@@_cover_llogos_clist }
                  ] at ([xshift = .1\paperwidth]current ~ page.south ~ west)
                  {
                    \includegraphics
                      [
                        height  = .6\paperheight/6,
                        width   = .16\paperwidth, keepaspectratio
                      ] { \clist_item:Nn \l_@@_cover_llogos_clist { ##1 } }
                  };
              }
          }
        \fill [ white, opacity = .5 ] (current ~ page.south ~ east) rectangle +
          (-.8\paperwidth, .6\paperheight);
        \node [ gray, above ~ left, inner ~ sep = 1em ] at
          (current ~ page.south ~ east) { \l_@@_cover_extinfo_tl };
        \fill [ white, opacity = .5 ] (current ~ page.south ~ east) rectangle +
          (-.7\paperwidth, .7\paperheight);
        \node
          [ shift = {(-.35*\paperwidth,.65*\paperheight)},
            darkgray, font = \Huge \bfseries \sffamily
          ] at (current ~ page.south ~ east) { \@title };
        \node
          [ shift = {(-.75*\paperwidth,.3*\paperheight)},
            rotate = 90, gray, opacity = .6, font = \huge \sffamily
          ] at (current ~ page.south ~ east) { \@author\ | \ \@afill };
        \tl_if_empty:NF { \l_@@_cover_clogo_tl }
          {
            \node (cover ~ logo)
              [ shift = {(.65*\paperwidth,.3*\paperheight)}]
              at (current ~ page.south ~ west)
              {
                \includegraphics[ height = .4\paperheight ]
                  { \l_@@_cover_clogo_tl }
              };
          }
      \end{tikzpicture}
      \clearpage \thispagestyle{empty}
      \centering
      \vspace* \fill \sffamily
        \Large This ~ page ~ was ~ intentionally ~ left ~ blank.
      \vspace* \fill
    \end{titlepage}
    \pagecolor{Beige!30}
  }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@@_sidebar_hook:n}
% Hook for graphing the sidebar: different on odd and even pages.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_sidebar_hook:n #1
  {
    \int_if_odd:nTF { \arabic { page } }
      {
        \tikz [remember ~ picture, overlay] {
          \fill [ #1, opacity = .125 ]
                (current ~ page.south ~ west) rectangle
                ([xshift = +.5in]current ~ page.north ~ west);
          \node [ opacity = .25, inner ~ xsep = .25in,
                  above, inner ~ ysep = {1in - \footskip + 1ex},
                  font = \sffamily \large,
                ] at ([xshift = +.25in]current ~ page.south ~ west)
                { \rotatebox {-90} {\@sidehead} };
          \node [ opacity = .25, inner ~ xsep = .25in,
                  above, inner ~ ysep = \headsep, yshift = -1in,
                  font = \sffamily \large,
                ] at ([xshift = +.25in]current ~ page.north ~ west)
                { \rotatebox {-90} {\@sidefoot} };
          }
      }
      {
        \tikz [remember ~ picture, overlay] {
          \fill [ #1, opacity = .125 ]
                (current ~ page.south ~ east) rectangle
                ([xshift = -.5in]current ~ page.north ~ east);
          \node [ opacity = .25, inner ~ xsep = .25in,
                  above, inner ~ ysep = {1in - \footskip + 1ex},
                  font = \sffamily \large,
                ] at ([xshift = -.25in]current ~ page.south ~ east)
                { \rotatebox {+90} {\@sidehead} };
          \node [ opacity = .25, inner ~ xsep = .25in,
                  above, inner ~ ysep = \headsep, yshift = -1in,
                  font = \sffamily \large,
                ] at ([xshift = -.25in]current ~ page.north ~ east)
                { \rotatebox {+90} {\@sidefoot} };
          }
      }
  }
%    \end{macrocode}
% \end{macro}
% End the input stream of \file{whats-cover-module.code.tex}.
%    \begin{macrocode}
\file_input_stop:
%    \end{macrocode}
% End the optionlist |cover| for \pkg{l3docstrip}.
%    \begin{macrocode}
%</cover>
%    \end{macrocode}
% \end{implementation}
% \clearpage
% \PrintIndex
% \iffalse
%<*thmlist>
%    \begin{macrocode}
\ProvidesExplPackage {thmlist} {2024-11-26} {0.1b}
  {Formally a part of the class litebook}
\msg_new:nnn { thmlist } { Obsolete ~ LaTeX ~ Package }
  { This ~ package ~ is ~ obsoleted, ~
    using ~ the ~ `whatsnote' ~ class ~ instead. }
\msg_error:nn { thmlist } { Obsolete ~ LaTeX ~ Package }
\file_input_stop:
%    \end{macrocode}
%</thmlist>
%<*litebook>
%    \begin{macrocode}
\ProvidesExplClass {litebook} {2024-11-26} {0.2b}
  {Now replaced by the whatsnote class}
\msg_new:nnn { litebook } { Obsolete ~ LaTeX ~ Package }
  { This ~ package ~ is ~ obsoleted, ~
    using ~ the ~ `whatsnote' ~ class ~ instead. }
\msg_error:nn { litebook } { Obsolete ~ LaTeX ~ Package }
\LoadClass{minimal}
\file_input_stop:
%    \end{macrocode}
%</litebook>
%<*litesolution>
%    \begin{macrocode}
\ProvidesExplClass {litesolution} {2024-11-26} {2.4a}
  {Now replaced by the whatsnote class}
\msg_new:nnn { litesolution } { Obsolete ~ LaTeX ~ Package }
  { This ~ package ~ is ~ obsoleted, ~
    using ~ the ~ `whatsnote' ~ class ~ instead. }
\msg_error:nn { litesolution } { Obsolete ~ LaTeX ~ Package }
\LoadClass{minimal}
\file_input_stop:
%    \end{macrocode}
%</litesolution>
% \fi