Debian Codegraph @

texmf-dist/source/latex/whatsnote/whatsnote.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: whatsnote.dtx
4 % -----------------------------------------------------------------------
5 % Copyright (C) 2024-2025 by Mingyu Xia <[email protected]> *
6 % *
7 % This work may be distributed and/or modified under the conditions *
8 % of the LaTeX Project Public License (LPPL), either version 1.3c of *
9 % this license or (at your option) any later version. *
10 % The latest version of this license is in *
11 % *
12 % http://www.latex-project.org/lppl.txt *
13 % *
14 % and version 1.3c or later is part of all distributions of LaTeX *
15 % version 2008 or later. *
16 % *
17 % This work has the LPPL maintenance status `maintained'. *
18 % *
19 % The Current Maintainer of this work is Mingyu Xia. *
20 % *
21 % This work consists of the files whatsnote.dtx, *
22 % whatsnote.ins, *
23 % the derived files whatsnote.cls, *
24 % whats-*-module.code.tex, *
25 % the documentation files whatsnote.pdf, *
26 % and README.md. *
27 % -----------------------------------------------------------------------
28 %
29 % Any modification of this file should ensure that the copyright and
30 % license information is placed in the derived files.
31 %
32 % -----------------------------------------------------------------------
33 %
34 %<*internal>
35 \iffalse
36 %</internal>
37 %
38 %<*readme>
39 [![CTAN Version](https://img.shields.io/ctan/v/whatsnote)](https://ctan.org/pkg/whatsnote)
40 [![GitHub Release](https://img.shields.io/github/v/release/myhsia/whatsnote)](https://github.com/myhsia/whatsnote/releases/latest)
41 [![GitHub Last Commit](https://img.shields.io/github/last-commit/myhsia/whatsnote)](https://github.com/myhsia/whatsnote/commits)
42 [![Actions Status](https://github.com/myhsia/whatsnote/actions/workflows/main.yaml/badge.svg?branch=main)](https://github.com/myhsia/whatsnote/actions)
43 [![GitHub Repo stars](https://img.shields.io/github/stars/myhsia/whatsnote)](https://github.com/myhsia/whatsnote)
44
45 The `whatsnote` Class
46 =======================
47
48 The whatsnote LaTeX class provides an elegant layout and powerful tools for taking notes in science, engineering, etc.
49
50 Overview
51 --------
52
53 See `whatsnote.pdf` for more. Happy TeXing!
54
55 Issues
56 ------
57
58 The issue tracker for `whatsnote` is currently located
59 [on GitHub](https://github.com/myhsia/whatsnote/issues).
60
61 Build status
62 ------------
63
64 This project uses [GitHub Actions](https://github.com/features/actions)
65 as a hosted continuous integration service. For each commit, the build status
66 is tested using the current release of TeX Live.
67
68 _Current build status:_ ![build status](https://github.com/myhsia/whatsnote/actions/workflows/main.yaml/badge.svg?branch=main)
69
70 Copyright and License
71 ---------------------
72
73 Copyright (C) 2024-2025 by Mingyu Xia <[email protected]>
74
75 This work may be distributed and/or modified under the conditions
76 of the LaTeX Project Public License (LPPL), either version 1.3c of
77 this license or (at your option) any later version.
78 The latest version of this license is in
79
80 http://www.latex-project.org/lppl.txt
81
82 and version 1.3c or later is part of all distributions of LaTeX
83 version 2008 or later.
84
85 This work has the LPPL maintenance status `maintained'.
86
87 The Current Maintainer of this work is **Mingyu Xia**.
88 %</readme>
89 %
90 %<*internal>
91 \fi
92 %</internal>
93 %
94 %<*driver>
95 \documentclass{l3doc}
96 \usepackage{pdfpages}
97 \graphicspath{{./demo/}}
98 \usepackage[osf, mono = false]{libertine}
99 \ExplSyntaxOn \makeatletter
100 \DeclareDocumentCommand \key { s m }
101 {
102 \IfBooleanTF {#1} { \textcolor{red}{\ttfamily \bfseries #2} }
103 {
104 \ttfamily
105 \seq_set_from_clist:Nn \l_tmpa_seq {#2}
106 \seq_set_map:NNn \l_tmpb_seq \l_tmpa_seq
107 { \exp_not:n { \textcolor{red}{\bfseries ##1} } }
108 \seq_use:Nn \l_tmpb_seq { ,~ } \:=\:
109 }
110 }
111 \DeclareCommandCopy \val \meta
112 \def \TFF {true\textup{\textbar\underline{\textbf{false}}}}
113 \def \TTF {\textup{\underline{\textbf{true}}\textbar}false}
114 \def \HoLogo@ApLaTeX #1{
115 \HOLOGO@mbox {A\kern -.05em p\kern -.05em \hologo{LaTeX}}}
116 \makeatother \ExplSyntaxOff
117 \newlist{keyval}{itemize}{10}
118 \setlist[keyval]{leftmargin = 0pt, labelsep = 0pt}
119 \makeindex
120 \begin{document}
121 \DocInput{\jobname.dtx}
122 \end{document}
123 %</driver>
124 % \fi
125 %
126 % \title{^^A
127 % The \cls{whatsnote} Class\thanks{^^A
128 % \url{https://github.com/myhsia/whatsnote},
129 % \url{https://ctan.org/pkg/whatsnote}^^A
130 % }^^A
131 % }
132 %
133 % \author{^^A
134 % Mingyu Xia \texttt{<^^A
135 % \href{mailto:[email protected]}{[email protected]}>^^A
136 % }^^A
137 % }
138 %
139 % \date{Released 2025-11-12\quad \texttt{v5.0B}}
140 %
141 % \maketitle
142 %
143 % \begin{documentation}
144 %
145 % \section{Introduction}
146 %
147 % The \cls{whatsnote} \hologo{LaTeX} class provides an elegant layout and
148 % powerful tools for taking notes in science, engineering, etc.
149 % It supports various compilation methods,
150 % such as \hologo{pdfLaTeX}, \hologo{XeLaTeX}, \hologo{ApLaTeX},
151 % \hologo{LuaLaTeX}, etc.
152 %
153 % \section{Usage}
154 %
155 % To load this class, write the line
156 % \begin{quote}
157 % |\documentclass{whatsnote}|
158 % \end{quote}
159 %
160 % \subsection{Cover configuration}
161 %
162 % \begin{function}{\coverset}
163 % \begin{syntax}
164 % \cs{coverset} \marg{keys}
165 % \end{syntax}
166 % The \cs{coverset} macro can config the cover, the mandatory argument
167 % accepts the following keys
168 % \begin{keyval}
169 % \item [\key{title}] \val{string} can set the title on the cover page.
170 % \item [\key{author, afill}] \val{string} can set the author and the
171 % affliction respectively on the cover page, and they will be combined
172 % together with a vertical bar separated.
173 % \item [\key{date}] \val{string} can set the date on the cover page.
174 % \item [\key{extinfo}] \val{string} can add contents at the south east
175 % corner of the cover page (e.g., add your personal seal (``Yìn Zhāng'' in
176 % Chinese)).
177 % \item [\key{head, clogo}] \val{file} can add pictures at the top /
178 % the center white area of the cover page accordingly.
179 % \item [\key{llogos}] \val{files' comma list} can add a series of pictures
180 % at the ``left bar'' of the title page.
181 % \end{keyval}
182 % \end{function}
183 %
184 % \begin{function}{\maketitle}
185 % \begin{syntax}
186 % \cs{maketitle} \oarg{color}
187 % \end{syntax}
188 % The \cs{maketitle} macro can generate the cover and config the theme color
189 % in its optional argument.
190 % \end{function}
191 %
192 % \begin{function}{\sidehead, \sidefoot}
193 % \begin{syntax}
194 % \cs{sidehead} \marg{sidebar header} \cs{sidefoot} \marg{sidebar footer}
195 % \end{syntax}
196 % The \cs{sidehead, sidefoot} macros can config the header and footer in the
197 % sidebar.
198 % \end{function}
199 %
200 % \begin{function}{\mathemph}
201 % \begin{syntax}
202 % \cs{mathemph} \marg{math equation}
203 % \end{syntax}
204 % The \cs{mathemph} macro can color-emphing math formula.
205 % \end{function}
206 %
207 % \section{Working Example} \label{mwe}
208 %
209 % \verbatiminput{whatsnote-demo.tex}
210 %
211 % \includepdf[pages = -, nup = 2x2]{whatsnote-demo.pdf}
212 %
213 % \end{documentation}
214 %
215 % \appendix \pagenumbering{Roman}
216 %
217 % \begin{implementation}
218 %
219 % \section{The Source Code}
220 %
221 % Assign the module name of the variables and control sequences, which will be
222 % automatically replaced by \pkg{l3docstrip}.
223 % \begin{macrocode}
224 %<@@=whats>
225 % \end{macrocode}
226 %
227 % \subsection{The \texttt{whatsnote.cls} file}
228 %
229 % Start the optionlist |class| for \pkg{l3docstrip}.
230 % \begin{macrocode}
231 %<*class>
232 % \end{macrocode}
233 % Define the date, version, and summary variables, and declare the class.
234 % \begin{macrocode}
235 \def \whatsnote@date {2025-11-12}
236 \def \whatsnote@version {v5.0B}
237 \def \whatsnote@tldr
238 {LaTeX class for taking notes in science, engineering, etc.}
239 \ProvidesExplClass {whatsnote} {\whatsnote@date}
240 {\whatsnote@version} {\whatsnote@tldr}
241 % \end{macrocode}
242 % \begin{macro}{\@@_msg_new:nn}
243 % \begin{macro}{\@@_msg_error:nn, \@@_msg_warning:nn}
244 % Functions for broadcast errors and warnings.
245 % \begin{macrocode}
246 \cs_new_protected:Npn \@@_msg_new:nn #1#2
247 { \msg_new:nnn { whatsnote } {#1} {#2} }
248 \cs_new_protected:Npn \@@_msg_error:nn #1#2
249 { \msg_error:nnn { whatsnote } {#1} {#2} }
250 \cs_new_protected:Npn \@@_msg_warning:nn #1#2
251 { \msg_error:nnn { whatsnote } {#1} {#2} }
252 % \end{macrocode}
253 % \end{macro}
254 % \end{macro}
255 % \begin{macro}{\@@_provide_module:n}
256 % Function for providing modules with the predefined date and version variables.
257 % \begin{macrocode}
258 \cs_new_protected_nopar:Npn \@@_provide_module:n #1
259 {
260 \ProvidesExplFile {whats-#1-module.code.tex}
261 {\whatsnote@date} {\whatsnote@version}
262 { whatsNote ~ \text_titlecase:n {#1} ~ Module }
263 }
264 % \end{macrocode}
265 % \begin{macro}{\@@_load_module:n}
266 % Function for loading modules.
267 % \begin{macrocode}
268 \cs_new_protected_nopar:Npn \@@_load_module:n #1
269 {
270 \clist_map_inline:nn {#1}
271 {
272 \file_if_exist_input:nF { whats-##1-module.code.tex }
273 { \@@_msg_error:nn { not found module } {##1} }
274 }
275 }
276 \@@_msg_new:nn { not found module }
277 { The ~ whats ~ module ~ `#1' ~ not ~ found. }
278 % \end{macrocode}
279 % \end{macro}
280 % \end{macro}
281 % \begin{variable}{\g_@@_base_class_options_clist}
282 % Variable for storing global option for basic class.
283 % \begin{macrocode}
284 \clist_new:N \g_@@_base_class_options_clist
285 \keys_define:nn { whats / classoption }
286 {
287 unknown .code:n = \@@_unknown_option:n { #1 },
288 }
289 % \end{macrocode}
290 % \end{variable}
291 % \begin{macro}{\@@_unknown_option:n}
292 % Parsing unknown options: pass them to the basic class.
293 % \begin{macrocode}
294 \cs_new_protected_nopar:Npn \@@_unknown_option:n #1
295 {
296 \tl_if_empty:nTF { #1 }
297 { \clist_gput_right:NV \g_@@_base_class_options_clist \l_keys_key_str }
298 {
299 \exp_args:NNx \clist_gput_right:Nn \g_@@_base_class_options_clist
300 { \l_keys_key_str = \exp_not:n {#1} }
301 }
302 }
303 \ProcessKeyOptions [ whats / classoption ]
304 % \end{macrocode}
305 % \end{macro}
306 % Load basic class with some preloaded options.
307 % \begin{macrocode}
308 \PassOptionsToClass { book } { 11pt }
309 \PassOptionsToPackage { svgnames } { xcolor }
310 \exp_args:NNV \LoadClass [ \g_@@_base_class_options_clist ] { book }
311 % \end{macrocode}
312 % Load modules for \cls{whatsnote}.
313 % \begin{macrocode}
314 \@@_load_module:n { typeset, layout, theorem, cover }
315 % \end{macrocode}
316 % End the input stream of \file{whatsnote.cls}.
317 % \begin{macrocode}
318 \file_input_stop:
319 % \end{macrocode}
320 % End the optionlist |class| for \pkg{l3docstrip}.
321 % \begin{macrocode}
322 %</class>
323 % \end{macrocode}
324 %
325 % \subsection{The \texttt{whats-typeset-module.code.tex} file}
326 %
327 % Start the optionlist |typeset| for \pkg{l3docstrip}.
328 % \begin{macrocode}
329 %<*typeset>
330 % \end{macrocode}
331 % Declare the module file.
332 % \begin{macrocode}
333 \@@_provide_module:n { typeset }
334 % \end{macrocode}
335 % Load the \pkg{amssymb}, \pkg{bbm}, \pkg{bm}, \pkg{cancel}, \pkg{extarrows},
336 % \pkg{mathtools}, \pkg{nicematrix}, \pkg{xfrac} packages.
337 % \begin{macrocode}
338 \RequirePackage{amssymb, bbm, bm, cancel, extarrows,
339 mathtools, nicematrix, xfrac}
340 % \end{macrocode}
341 % Load the |e| style \pkg{esvect} package for \cs[no-index]{vec} arrow,
342 % then define the anti-vector arrow.
343 % \begin{macrocode}
344 \RequirePackage[e]{esvect}
345 \let \vec \vv
346 \DeclareRobustCommand \cev [1]{{\mathpalette\do@cev{#1}}}
347 \newcommand \do@cev [2]{
348 \vbox{\offinterlineskip
349 \ialign{##\cr
350 \hidewidth\reflectbox{$\m@th#1\vec{}\mkern4mu$}\hidewidth\cr
351 $\m@th#1#2$\cr
352 }
353 }
354 }
355 % \end{macrocode}
356 % Load the \pkg{fixdif} and \pkg{derivative} packages for inputting math
357 % derivatives, suppress warnings when using |xetex|.
358 % \begin{macrocode}
359 \sys_if_engine_xetex:T { \PassOptionsToPackage { no-math } { fontspec } }
360 \RequirePackage{fixdif, derivative}
361 % \end{macrocode}
362 % Define some mathematic operators.
363 % \begin{macrocode}
364 \newdif \D {\mathsf D}
365 \newdif \upe {\mathrm e}
366 \newdif \iu {\mathrm i \mkern1mu}
367 \let \sinh \relax \let \cosh \relax \let \tanh \relax \let \coth \relax
368 \DeclareMathOperator \sinh {sh}
369 \DeclareMathOperator \cosh {ch}
370 \DeclareMathOperator \tanh {th}
371 \DeclareMathOperator \coth {cth}
372 \DeclareMathOperator \sgn {sgn}
373 \DeclareMathOperator \cotan {\qopname\relax o{ctg}}
374 \DeclareMathOperator \im {im}
375 \DeclareMathOperator \adj {adj}
376 \DeclareRobustCommand \tran{^{\mkern-1.5mu\mathsf T}}
377 \DeclareRobustCommand \identity {\ensuremath{\mathbbm 1}}
378 % \end{macrocode}
379 % Load the \pkg{siunitx} package for inputting physics units,
380 % then declare the unit ``angstrom''.
381 % \begin{macrocode}
382 \RequirePackage{siunitx}
383 \DeclareSIUnit \angstrom {\text \AA}
384 % \end{macrocode}
385 % Load the \pkg{mhchem} package for inputting chemistry formula.
386 % \begin{macrocode}
387 \RequirePackage[version = 4]{mhchem}
388 % \end{macrocode}
389 % Load the \pkg{physics2} package's some modules for quick math and physics
390 % input. Temporarily change the module name for hacking the package\footnote{
391 % \href{https://github.com/AlphaZTX/}{|@AlphaZTX|} has not merged
392 % \href{https://github.com/AlphaZTX/physics2/issues/28}{my suggestion}
393 % for the \pkg{physics2} package. Blame him!}.
394 % \begin{macrocode}
395 %<@@=phy>
396 \RequirePackage{physics2}
397 \usephysicsmodule{ab, ab.braket, diagmat, xmat, qtext.legacy, op.legacy}
398 % \end{macrocode}
399 % Switch the star and non-star branches for the Dirac brackets inputting
400 % commands to make the non-equal height brackets the default.
401 % \begin{macrocode}
402 \DeclareRobustCommand \bra
403 {\@ifstar{\phy@d@lx{br.m}{br.a}}{\phy@d@lx{br.m}{br.a}*}}
404 \DeclareRobustCommand \ket
405 {\@ifstar{\phy@d@lx{kt.m}{kt.a}}{\phy@d@lx{kt.m}{kt.a}*}}
406 \DeclareRobustCommand \braket
407 {\@ifstar{\phy@d@lx{bk.m}{bk.a}}{\phy@d@lx{bk.m}{bk.a}*}}
408 \DeclareRobustCommand \ketbra
409 {\@ifstar{\phy@d@lx{kb.m}{kb.a}}{\phy@d@lx{kb.m}{kb.a}*}}
410 % \end{macrocode}
411 % Extend the |diagmat| module for the \pkg{physics2} package: support the small
412 % matrices, and enable users to modify the alignments of the matrices' elements.
413 % \begin{macrocode}
414 \DeclareDocumentCommand \diagmat { s O{} m }
415 {
416 \IfBooleanTF {#1}
417 { \@@_diagmat_type:nnn { small } {#2} {#3} }
418 { \@@_diagmat_type:nnn { } {#2} {#3} }
419 }
420 \DeclareDocumentCommand \pdiagmat { s O{} m }
421 {
422 \IfBooleanTF {#1}
423 { \@@_diagmat_type:nnn { psmall } {#2} {#3} }
424 { \@@_diagmat_type:nnn { p } {#2} {#3} }
425 }
426 \DeclareDocumentCommand \bdiagmat { s O{} m }
427 {
428 \IfBooleanTF {#1}
429 { \@@_diagmat_type:nnn { bsmall } {#2} {#3} }
430 { \@@_diagmat_type:nnn { b } {#2} {#3} }
431 }
432 \DeclareDocumentCommand \Bdiagmat { s O{} m }
433 {
434 \IfBooleanTF {#1}
435 { \@@_diagmat_type:nnn { Bsmall } {#2} {#3} }
436 { \@@_diagmat_type:nnn { B } {#2} {#3} }
437 }
438 \DeclareDocumentCommand \vdiagmat { s O{} m }
439 {
440 \IfBooleanTF {#1}
441 { \@@_diagmat_type:nnn { vsmall } {#2} {#3} }
442 { \@@_diagmat_type:nnn { v } {#2} {#3} }
443 }
444 \DeclareDocumentCommand \Vdiagmat { s O{} m }
445 {
446 \IfBooleanTF {#1}
447 { \@@_diagmat_type:nnn { Vsmall } {#2} {#3} }
448 { \@@_diagmat_type:nnn { V } {#2} {#3} }
449 }
450 % \end{macrocode}
451 % Restore the module name.
452 % \begin{macrocode}
453 %<@@=whats>
454 % \end{macrocode}
455 % Load and config the \pkg{hyperref} package, suppress the |bookmark| warnings.
456 % \begin{macrocode}
457 \RequirePackage{hyperref}
458 \hypersetup{colorlinks, citecolor = teal}
459 \let\oldHyPsd@CatcodeWarning\HyPsd@CatcodeWarning
460 \renewcommand \HyPsd@CatcodeWarning [1]
461 {\ifnum\pdfstrcmp{#1}{math shift}=0 \else \oldHyPsd@CatcodeWarning{#1} \fi}
462 \pdfstringdefDisableCommands{
463 \def\intop{int} \def\ilimits@{lim}
464 \def\infty{infty} \let\HyPsd@CatcodeWarning\@gobble
465 }
466 % \end{macrocode}
467 % \begin{macro}{\mathemph}
468 % Macro for color-emphing math formula.
469 % \begin{macrocode}
470 \NewDocumentCommand \mathemph { O{} m } {\ifmmode
471 \colorbox{Crimson!15}{\vphantom{$\displaystyle #1$}$\displaystyle #2$}\else
472 \colorbox{Crimson!15}{\vphantom{#1}#2}\fi}
473 % \end{macrocode}
474 % \end{macro}
475 % \begin{macrocode}
476 \color_set:nnn { eqcolor } { HTML } { 2F4F4F }
477 % \end{macrocode}
478 % Restore the definition for \cs{[} and \cs{]} changed by \pkg{amsmath},
479 % then apply the equations' color (high-unstable, temporarily disabled).
480 % \begin{macrocode}
481 % \def \dollardollar@begin { \def \eqcolor {\color{eqcolor}} \eqcolor $$ }
482 % \def \dollardollar@end { $$ \color_select:n {black} }
483 \DeclareRobustCommand \[
484 {
485 \scan_stop:
486 \if_mode_math:
487 \@badmath
488 \else:
489 \if_mode_vertical:
490 \nointerlineskip
491 \makebox[.6\linewidth]{ }
492 \fi:
493 \dollardollar@begin % \color_select:n { eqcolor }
494 \fi:
495 }
496 \DeclareRobustCommand \]
497 {
498 \scan_stop:
499 \if_mode_math:
500 \if_mode_inner:
501 \@badmath
502 \else:
503 \dollardollar@end
504 \fi:
505 \else:
506 \@badmath
507 \fi:
508 \ignorespaces
509 }
510 % \end{macrocode}
511 % End the input stream of \file{whats-typeset-module.code.tex}.
512 % \begin{macrocode}
513 \file_input_stop:
514 % \end{macrocode}
515 % End the optionlist |typeset| for \pkg{l3docstrip}.
516 % \begin{macrocode}
517 %</typeset>
518 % \end{macrocode}
519 %
520 % \subsection{The \texttt{whats-layout-module.code.tex} file}
521 %
522 % Start the optionlist |layout| for \pkg{l3docstrip}.
523 % \begin{macrocode}
524 %<*layout>
525 % \end{macrocode}
526 % Declare the module file.
527 % \begin{macrocode}
528 \@@_provide_module:n { layout }
529 % \end{macrocode}
530 % Load the \pkg{anyfontsize}, \pkg{lmodern}, \pkg{microtype}, \pkg{manfnt},
531 % \pkg{ragged2e}, \pkg{soul}, \pkg{libertine}, \pkg{ulem}, \pkg{xcolor}
532 % packages.
533 % \begin{macrocode}
534 \RequirePackage{anyfontsize, lmodern, microtype, manfnt, ragged2e, soul}
535 \RequirePackage[mono = false, osf]{libertine}
536 \RequirePackage[normalem]{ulem}
537 \RequirePackage[svgnames]{xcolor}
538 % \end{macrocode}
539 % Config the \pkg{geometry}.
540 % \begin{macrocode}
541 \RequirePackage[left = 1.25in, vmargin = 1in, headheight = 15pt,
542 right = .75in, headsep = 15pt]{geometry}
543 % \end{macrocode}
544 % \begin{macrocode}
545 \RequirePackage{graphicx, pgfplots}
546 \graphicspath{{./media/logos/} {./media/}}
547 \pgfplotsset{compat = newest}
548 % Table and list
549 \RequirePackage{booktabs, array, enumext}
550 \setenumext[enumext, 1]{label = (\alph*)}
551 \setenumext[enumext, 2]{label = \roman*.}
552 \RequirePackage[inline]{enumitem}
553 % \end{macrocode}
554 % Config the header and footer.
555 % \begin{macrocode}
556 \RequirePackage{fancyhdr}
557 \renewcommand* \chaptermark [1]
558 {
559 \markboth
560 {
561 \normalfont \biolinumLF \scshape
562 \int_compare:nNnT { \c@secnumdepth } > { \m@ne }
563 { \if@mainmatter \@chapapp \ \thechapter .~\ \fi } #1
564 } {}
565 }
566 \renewcommand* \sectionmark [1]
567 {
568 \markright
569 {
570 \normalfont \sffamily
571 \int_compare:nNnT { \c@secnumdepth } > { \z@ } { \thesection . \ } #1
572 }
573 }
574 \fancyhead[OR]{\sffamily \rightmark}
575 \fancyhead[OL]{\sffamily \thepage}
576 \fancyhead[EL]{\sffamily \leftmark}
577 \fancyhead[ER]{\sffamily \thepage}
578 \fancyfoot[L,C,R]{}
579 \pagestyle{fancy}
580 % \end{macrocode}
581 % Config the header rule and footer rule style.
582 % \begin{macrocode}
583 \renewcommand* \headrulewidth {1pt}
584 \renewcommand* \footrulewidth {.5pt}
585 \hook_gput_code:nnn { cmd / headrule / before } {.}
586 { \color_select:n { black!25 } }
587 \renewcommand \footrule
588 {
589 \if@fancyplain \let \footrulewidth \plainfootrulewidth \fi
590 \color_select:n { black!25 }
591 \hrule \@width \headwidth \@height \footrulewidth
592 }
593 % \end{macrocode}
594 % Paragraphs configurations.
595 % \begin{macrocode}
596 \linespread{1.2}
597 \RequirePackage{titlesec, subcaption}
598 \titleformat \chapter [hang] {\huge \bfseries \sffamily}
599 {\biolinumLF \scshape \@chapapp\ \thechapter} {1em} {}
600 \titlespacing* \chapter {\z@} {\z@} {30pt}
601 \titlespacing \paragraph {\z@} {1.5ex minus .1 ex} {1pc}
602 \RequirePackage{paracol}
603 \columnratio{.64}
604 \RequirePackage{framed}
605 \setlength \FrameSep {\z@}
606 \setlength \parindent {\z@}
607 % \end{macrocode}
608 % Config the appearance of appendix in toc.
609 % \begin{macrocode}
610 \renewcommand \@pnumwidth {2.5em}
611 \renewcommand \appendix {
612 \cleardoublepage
613 \setcounter{chapter}{0}
614 \setcounter{section}{0}
615 \gdef\@chapapp{\appendixname}
616 \gdef\thechapter{\@Alph\c@chapter}
617 \addtocontents {toc} { \protect \makeatletter }
618 \addtocontents {toc} {
619 \token_to_str:N \renewcommand* \token_to_str:N \l@section
620 { \token_to_str:N \@dottedtocline {1} {1.5em} {5em} }
621 }
622 \addtocontents {toc} { \protect \makeatother }
623 \renewcommand*\familydefault {\sfdefault}
624 \pagenumbering{roman}
625 }
626 % \end{macrocode}
627 % End the input stream of \file{whats-layout-module.code.tex}.
628 % \begin{macrocode}
629 \file_input_stop:
630 % \end{macrocode}
631 % End the optionlist |class| for \pkg{l3docstrip}.
632 % \begin{macrocode}
633 %</layout>
634 % \end{macrocode}
635 %
636 % \subsection{The \texttt{whats-theorem-module.code.tex} file}
637 %
638 % Start the optionlist |theorem| for \pkg{l3docstrip}.
639 % \begin{macrocode}
640 %<*theorem>
641 % \end{macrocode}
642 % Declare the module file.
643 % \begin{macrocode}
644 \@@_provide_module:n { theorem }
645 % \end{macrocode}
646 % Load the \pkg{keytheorems} package, and predefine the following environments.
647 % \begin{macrocode}
648 \RequirePackage{keytheorems}
649 \newcounter {week}
650 \newcommand \newweek { \refstepcounter{week} \clearpage }
651 \newkeytheorem { theorem } [ parent = section, style = definition ]
652 \newkeytheorem { example } [ parent = section, style = definition ]
653 \newkeytheorem { definition } [ parent = section, style = definition ]
654 \newkeytheorem { problem } [ parent = week, style = definition ]
655 \newkeytheorem { solution } [ numbered = false, style = definition ]
656 \newkeytheorem { remark } [ numbered = false, style = remark ]
657 % \end{macrocode}
658 %
659 % \begin{macrocode}
660 \file_input_stop:
661 % \end{macrocode}
662 %
663 % \begin{macrocode}
664 %</theorem>
665 % \end{macrocode}
666 %
667 % \subsection{The \texttt{whats-cover-module.code.tex} file}
668 %
669 % Start the optionlist |cover| for \pkg{l3docstrip}.
670 % \begin{macrocode}
671 %<*cover>
672 % \end{macrocode}
673 % Declare the module file.
674 % \begin{macrocode}
675 \@@_provide_module:n { cover }
676 % \end{macrocode}
677 % Load the \pkg{tikz} package for graphing the
678 % (The |expl3| syntax needs to be temporarily turned off).
679 % \begin{macrocode}
680 \RequirePackage{tikz, zref-totpages}
681 \ExplSyntaxOff
682 \usetikzlibrary{fadings, patterns, arrows.meta}
683 \tikzset{ > = Stealth, every picture/.append style = {
684 line join = round, line cap = round, thick } }
685 \ExplSyntaxOn
686 % \end{macrocode}
687 % \begin{macro}{\coverset}
688 % Macro for cover configuration by setting keys.
689 % \begin{macrocode}
690 \DeclareDocumentCommand \coverset { m } { \keys_set:nn { @@ / coverset } {#1} }
691 % \end{macrocode}
692 % \begin{variable}{\l_@@_cover_llogos_clist}
693 % Comma list for storing the left logos' path.
694 % \begin{macrocode}
695 \clist_new:N \l_@@_cover_llogos_clist
696 % \end{macrocode}
697 % \begin{variable}
698 % {
699 % \@title, \@author, \@afill, \@date, \l_@@_cover_extinfo_tl,
700 % \l_@@_cover_head_tl, \l_@@_cover_clogo_tl
701 % }
702 % Token lists for storing elements on the cover page.
703 % \begin{macrocode}
704 \keys_define:nn { @@ / coverset }
705 {
706 title .tl_gset:N = \@title,
707 author .tl_gset:N = \@author,
708 afill .tl_gset:N = \@afill,
709 date .tl_gset:N = \@date,
710 date .initial:n = \today,
711 extinfo .tl_set:N = \l_@@_cover_extinfo_tl,
712 head .tl_set:N = \l_@@_cover_head_tl,
713 clogo .tl_set:N = \l_@@_cover_clogo_tl,
714 llogos .clist_set:N = \l_@@_cover_llogos_clist,
715 }
716 % \end{macrocode}
717 % \end{variable}
718 % \end{variable}
719 % \end{macro}
720 % \begin{macro}{\sidehead, \sidefoot}
721 % \begin{variable}{\@sidehead, \@sidefoot}
722 % Macros for configuring the header and footer on the sidebar.
723 % \begin{macrocode}
724 \DeclareRobustCommand * \sidehead [1] { \tl_gset:Nn \@sidehead {#1} }
725 \DeclareRobustCommand * \sidefoot [1] { \tl_gset:Nn \@sidefoot {#1} }
726 % \end{macrocode}
727 % \end{variable}
728 % Set the header and footer of the sidebar \meta{title name},
729 % \meta{page number} / \meta{total page} by default.
730 % \begin{macrocode}
731 \sidehead{\@title}
732 \sidefoot{\thepage\,/\,\ztotpages}
733 % \end{macrocode}
734 % \end{macro}
735 % Declare a hook for sidebar.
736 % \begin{macrocode}
737 \hook_gset_rule:nnnn { shipout / background } { shipout_@@ }
738 { before } { pgfrcs }
739 % \end{macrocode}
740 % \begin{macro}{\maketitle}
741 % Redefine the \cs{maketitle} macro for graphing the cover and load the hook.
742 % \begin{macrocode}
743 \DeclareDocumentCommand \maketitle { O { gray } }
744 {
745 \@@_@maketitle:n {#1}
746 \hook_gput_code:nnn { shipout / background } { shipout_@@ }
747 { \if@mainmatter \@@_sidebar_hook:n {#1} \fi }
748 }
749 % \end{macrocode}
750 % \end{macro}
751 % \begin{macro}{\@@_@maketitle:n}
752 % The auxiliary command for \cs{maketitle}.
753 % \begin{macrocode}
754 \cs_new_protected_nopar:Npn \@@_@maketitle:n #1
755 {
756 \pagecolor{#1!10}
757 \let \cleardoublepage \clearpage
758 \begin{titlepage}
759 \begin{tikzpicture} [ remember ~ picture, overlay ]
760 \tl_if_empty:NF \l_@@_cover_head_tl
761 {
762 \node [ yshift = .325\paperheight, opacity = .5,
763 rotate ~ around = { pi \c_colon_str
764 ([yshift = .325\paperheight]current ~ page.center)} ]
765 at (current ~ page.center)
766 { \includegraphics [width = \paperwidth]
767 { \l_@@_cover_head_tl } };
768 }
769 \clist_if_empty:NF \l_@@_cover_llogos_clist
770 {
771 \int_step_inline:nn { \clist_count:N \l_@@_cover_llogos_clist }
772 {
773 \node
774 [ opacity = .25, yshift = {
775 -.6\paperheight / 2 /
776 \clist_count:N \l_@@_cover_llogos_clist +
777 ##1 * .6\paperheight /
778 \clist_count:N \l_@@_cover_llogos_clist }
779 ] at ([xshift = .1\paperwidth]current ~ page.south ~ west)
780 {
781 \includegraphics
782 [
783 height = .6\paperheight/6,
784 width = .16\paperwidth, keepaspectratio
785 ] { \clist_item:Nn \l_@@_cover_llogos_clist { ##1 } }
786 };
787 }
788 }
789 \fill [ white, opacity = .5 ] (current ~ page.south ~ east) rectangle +
790 (-.8\paperwidth, .6\paperheight);
791 \node [ gray, above ~ left, inner ~ sep = 1em ] at
792 (current ~ page.south ~ east) { \l_@@_cover_extinfo_tl };
793 \fill [ white, opacity = .5 ] (current ~ page.south ~ east) rectangle +
794 (-.7\paperwidth, .7\paperheight);
795 \node
796 [ shift = {(-.35*\paperwidth,.65*\paperheight)},
797 darkgray, font = \Huge \bfseries \sffamily
798 ] at (current ~ page.south ~ east) { \@title };
799 \node
800 [ shift = {(-.75*\paperwidth,.3*\paperheight)},
801 rotate = 90, gray, opacity = .6, font = \huge \sffamily
802 ] at (current ~ page.south ~ east) { \@author\ | \ \@afill };
803 \tl_if_empty:NF { \l_@@_cover_clogo_tl }
804 {
805 \node (cover ~ logo)
806 [ shift = {(.65*\paperwidth,.3*\paperheight)}]
807 at (current ~ page.south ~ west)
808 {
809 \includegraphics[ height = .4\paperheight ]
810 { \l_@@_cover_clogo_tl }
811 };
812 }
813 \end{tikzpicture}
814 \clearpage \thispagestyle{empty}
815 \centering
816 \vspace* \fill \sffamily
817 \Large This ~ page ~ was ~ intentionally ~ left ~ blank.
818 \vspace* \fill
819 \end{titlepage}
820 \pagecolor{Beige!30}
821 }
822 % \end{macrocode}
823 % \end{macro}
824 % \begin{macro}{\@@_sidebar_hook:n}
825 % Hook for graphing the sidebar: different on odd and even pages.
826 % \begin{macrocode}
827 \cs_new_protected:Npn \@@_sidebar_hook:n #1
828 {
829 \int_if_odd:nTF { \arabic { page } }
830 {
831 \tikz [remember ~ picture, overlay] {
832 \fill [ #1, opacity = .125 ]
833 (current ~ page.south ~ west) rectangle
834 ([xshift = +.5in]current ~ page.north ~ west);
835 \node [ opacity = .25, inner ~ xsep = .25in,
836 above, inner ~ ysep = {1in - \footskip + 1ex},
837 font = \sffamily \large,
838 ] at ([xshift = +.25in]current ~ page.south ~ west)
839 { \rotatebox {-90} {\@sidehead} };
840 \node [ opacity = .25, inner ~ xsep = .25in,
841 above, inner ~ ysep = \headsep, yshift = -1in,
842 font = \sffamily \large,
843 ] at ([xshift = +.25in]current ~ page.north ~ west)
844 { \rotatebox {-90} {\@sidefoot} };
845 }
846 }
847 {
848 \tikz [remember ~ picture, overlay] {
849 \fill [ #1, opacity = .125 ]
850 (current ~ page.south ~ east) rectangle
851 ([xshift = -.5in]current ~ page.north ~ east);
852 \node [ opacity = .25, inner ~ xsep = .25in,
853 above, inner ~ ysep = {1in - \footskip + 1ex},
854 font = \sffamily \large,
855 ] at ([xshift = -.25in]current ~ page.south ~ east)
856 { \rotatebox {+90} {\@sidehead} };
857 \node [ opacity = .25, inner ~ xsep = .25in,
858 above, inner ~ ysep = \headsep, yshift = -1in,
859 font = \sffamily \large,
860 ] at ([xshift = -.25in]current ~ page.north ~ east)
861 { \rotatebox {+90} {\@sidefoot} };
862 }
863 }
864 }
865 % \end{macrocode}
866 % \end{macro}
867 % End the input stream of \file{whats-cover-module.code.tex}.
868 % \begin{macrocode}
869 \file_input_stop:
870 % \end{macrocode}
871 % End the optionlist |cover| for \pkg{l3docstrip}.
872 % \begin{macrocode}
873 %</cover>
874 % \end{macrocode}
875 % \end{implementation}
876 % \clearpage
877 % \PrintIndex
878 % \iffalse
879 %<*thmlist>
880 % \begin{macrocode}
881 \ProvidesExplPackage {thmlist} {2024-11-26} {0.1b}
882 {Formally a part of the class litebook}
883 \msg_new:nnn { thmlist } { Obsolete ~ LaTeX ~ Package }
884 { This ~ package ~ is ~ obsoleted, ~
885 using ~ the ~ `whatsnote' ~ class ~ instead. }
886 \msg_error:nn { thmlist } { Obsolete ~ LaTeX ~ Package }
887 \file_input_stop:
888 % \end{macrocode}
889 %</thmlist>
890 %<*litebook>
891 % \begin{macrocode}
892 \ProvidesExplClass {litebook} {2024-11-26} {0.2b}
893 {Now replaced by the whatsnote class}
894 \msg_new:nnn { litebook } { Obsolete ~ LaTeX ~ Package }
895 { This ~ package ~ is ~ obsoleted, ~
896 using ~ the ~ `whatsnote' ~ class ~ instead. }
897 \msg_error:nn { litebook } { Obsolete ~ LaTeX ~ Package }
898 \LoadClass{minimal}
899 \file_input_stop:
900 % \end{macrocode}
901 %</litebook>
902 %<*litesolution>
903 % \begin{macrocode}
904 \ProvidesExplClass {litesolution} {2024-11-26} {2.4a}
905 {Now replaced by the whatsnote class}
906 \msg_new:nnn { litesolution } { Obsolete ~ LaTeX ~ Package }
907 { This ~ package ~ is ~ obsoleted, ~
908 using ~ the ~ `whatsnote' ~ class ~ instead. }
909 \msg_error:nn { litesolution } { Obsolete ~ LaTeX ~ Package }
910 \LoadClass{minimal}
911 \file_input_stop:
912 % \end{macrocode}
913 %</litesolution>
914 % \fi