diff options
author | Karl Berry <karl@freefriends.org> | 2021-11-30 22:53:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-11-30 22:53:25 +0000 |
commit | 679fad7dbed7a085a1423bc907ec5bae404e0e6c (patch) | |
tree | 3882071f6375e96600c8061064ede486d98d0cff /Master/texmf-dist/tex/latex | |
parent | 6f7d67116e922a6dda38642c40d1518878719465 (diff) |
rbt-mathnotes (30nov21)
git-svn-id: svn://tug.org/texlive/trunk@61193 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
6 files changed, 2055 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-formula-sheet.cls b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-formula-sheet.cls new file mode 100644 index 00000000000..85e789b34a1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-formula-sheet.cls @@ -0,0 +1,150 @@ +%% rbt-mathnotes-formula-sheet.cls +%% Copyright 2021 Rebecca B. Turner. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Rebecca B. Turner. +% +% This work consists of the files: +% README.md +% rbt-mathnotes.tex +% rbt-mathnotes.sty +% rbt-mathnotes.cls +% rbt-mathnotes-util.sty +% rbt-mathnotes-messages.sty +% rbt-mathnotes-hw.cls +% rbt-mathnotes-formula-sheet.cls +% examples/cheat-sheet.tex +% examples/multivar.tex +% examples/topology-hw-1.tex +% and the derived files: +% rbt-mathnotes.pdf +% examples/cheat-sheet.pdf +% examples/multivar.pdf +% examples/topology-hw-1.pdf + +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplClass{rbt-mathnotes-formula-sheet}{2021/11/29}{1.0.2}{Styles + for mathematical exam formula sheets.} + +\LoadClass{article} + +\RequirePackage{rbt-mathnotes} + +\cs_set:Npn \@maketitle + { + \textbf{\@title}~ + (\@author,~\@date) + } + +\cs_set:Npn \mn__tiny_thm:nn #1#2 + { + \RenewDocumentEnvironment { #1 } { o } + { + \textbf + { + #2 + \IfValueT { ##1 } + { + :~##1 + } + . + } + } + { + } + } + +\mn__tiny_thm:nn { thm } { Thm } +\mn__tiny_thm:nn { lem } { Lem } +\mn__tiny_thm:nn { cor } { Cor } +\mn__tiny_thm:nn { prop } { Prop } +\mn__tiny_thm:nn { defn } { Defn } +\mn__tiny_thm:nn { ex } { Ex } +\mn__tiny_thm:nn { note } { Note } +\mn__tiny_thm:nn { remark } { Rmrk } + +\prg_new_conditional:Npnn \mn__if_should_use_multicols: + { T, } + { + \int_compare:nNnTF + { \g__mn_fs_columns_int } = { \c_one_int } + { \prg_return_false: } + { \prg_return_true: } + } + +\RequirePackage{multicol} +\AtBeginDocument + { + \scriptsize + \mn__if_should_use_multicols:T + { + \begin + { + multicols + \bool_if:NF \g__mn_should_balance_multicols_bool + { * } + } + { + \int_use:N \g__mn_fs_columns_int + } + } + \skip_set:Nn \abovedisplayskip { 0pt } + \skip_set:Nn \belowdisplayskip { 0pt } + } + +\AtEndDocument + { + \mn__if_should_use_multicols:T + { + \end + { + multicols + \bool_if:NF \g__mn_should_balance_multicols_bool + { * } + } + } + } + +\bool_new:N \g__mn_should_balance_multicols_bool + +\keys_define:nn { mn__main } + { + columns .int_set:N = \g__mn_fs_columns_int , + columns .initial:x = 3 , + + balance~columns .default:n = true , + balance~columns .bool_set:N = \g__mn_should_balance_multicols_bool , + + width .value_required:n = true , + width .code:n = \geometry{ paperwidth = #1 } , + + height .value_required:n = true , + height .code:n = \geometry{ paperheight = #1 } , + } + +\RequirePackage + [ + letterpaper , + margin = 0.1in , + ] + { geometry } + +\skip_set:Nn \parskip { 0.25em } + +\RequirePackage { enumitem } +\setlist + { + nosep + } + +\def\section#1{\hrulefill\\\textbf{#1}\\} diff --git a/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-hw.cls b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-hw.cls new file mode 100644 index 00000000000..24e91f715e3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-hw.cls @@ -0,0 +1,325 @@ +%% rbt-mathnotes-hw.cls +%% Copyright 2021 Rebecca B. Turner. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Rebecca B. Turner. +% +% This work consists of the files: +% README.md +% rbt-mathnotes.tex +% rbt-mathnotes.sty +% rbt-mathnotes.cls +% rbt-mathnotes-util.sty +% rbt-mathnotes-messages.sty +% rbt-mathnotes-hw.cls +% rbt-mathnotes-formula-sheet.cls +% examples/cheat-sheet.tex +% examples/multivar.tex +% examples/topology-hw-1.tex +% and the derived files: +% rbt-mathnotes.pdf +% examples/cheat-sheet.pdf +% examples/multivar.pdf +% examples/topology-hw-1.pdf + +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplClass{rbt-mathnotes-hw}{2021/11/29}{1.0.2}{Companion styles + to rbt-mathnotes for typeset homework assignments.} + +% \PassOptionsToPackage{noxcolor}{rbt-mathnotes} + +\RequirePackage{kvoptions} +\DeclareDefaultOption + { + \PassOptionsToClass { \CurrentOption } { rbt-mathnotes } + } +\ProcessKeyvalOptions* + +\LoadClass { rbt-mathnotes } + +\cs_set:Npn \mn__undefine_thm:n #1 + { + \cs_undefine:c { #1 } + \cs_undefine:c { end#1 } + \cs_undefine:c { #1* } + \cs_undefine:c { end#1* } + } + +\mn__undefine_thm:n { thm } +\mn__undefine_thm:n { lem } +\mn__undefine_thm:n { cor } +\mn__undefine_thm:n { prop } +\mn__undefine_thm:n { defn } +\mn__undefine_thm:n { notation } +\mn__undefine_thm:n { ex } + +\cs_undefine:N \mn__undefine_thm:n + +\theoremstyle { definition } +\newtheorem { thm } { Theorem } +\newtheorem { lem } { Lemma } +\newtheorem { cor } { Corollary } +\newtheorem { prop } { Proposition } +\newtheorem { defn } { Definition } +\newtheorem { notation } { Notation } +\newtheorem { ex } { Example } + +% The displayed problem number. \g__mn_problems_int isn't incremented if a +% custom number is given. +\int_new:N \g__mn_problems_int +\int_set_eq:NN \g__mn_problems_int \c_one_int + +% The internal problem number. \g__mn_all_problems_int is *always* +% incremented, so it can be used as a unique identifier in hyperref +% pdf bookmark names. +\int_new:N \g__mn_all_problems_int +\int_set_eq:NN \g__mn_all_problems_int \c_one_int + +% Label prepended to problem numbers. +\tl_const:Nn \g__mn_problem_string_tl { Problem } + +\skip_const:Nn \g__mn_problem_before_skip { 2em } + +% Label appended to problem numbers; omitted from PDF bookmarks. +\tl_const:Nn \g__mn_problem_after_tl { . } + +% A possible custom problem number. If \c_novalue_tl, use +% \g__mn_problems_int instead. +\tl_new:N \mn__problem_number_tl +\tl_set_eq:NN \mn__problem_number_tl \c_novalue_tl + +\tl_const:Nn \mn__problem_number_default_tl + { + \int_to_arabic:n { \g__mn_problems_int } + } + +% Current problem number, either from \g__mn_problems_int or +% \mn__problem_number_tl. +\tl_new:N \mn__problem_number_current_tl + +% Current problem display title, including "problem" label, number, and +% custom title. +% \tl_new:N \mn__problem_display_title_tl + +\keys_define:nn { mn__main } + { + problem~string .value_required:n = true , + problem~string .tl_set:N = \g__mn_problem_string_tl , + problem~before~skip .skip_set:N = \g__mn_problem_before_skip + } + +\keys_define:nn { mn__problem } + { + number .value_required:n = true , + number .tl_set:N = \mn__problem_number_tl , + + title .value_required:n = true , + title .tl_set:N = \mn__problem_title_tl , + title .initial:n = , + + label .value_required:n = true , + label .tl_set:N = \mn__problem_label_tl , + + % Treat unknown keys as the problem number; this lets us avoid having + % 2 or more optional arguments. + unknown .code:n = + \tl_if_empty:nTF { #1 } + { + % No value; use it for the problem number. + \tl_set_eq:NN \mn__problem_number_tl \l_keys_key_tl + } + { + % Non-empty value; give an error. + \msg_error:nnx + { mathnotes } + { no key in problem } + { \tl_use:N \l_keys_key_tl } + } , + } + +\cs_set:Npn \mn__problem_title_pdf: + { + % A string like "Problem" or "Exercise" or "Question" + \tl_use:N \g__mn_problem_string_tl + % The problem number. + \tl_if_empty:NF \mn__problem_number_current_tl + { + \ \tl_use:N \mn__problem_number_current_tl + } + \tl_if_empty:NF \mn__problem_title_tl + { + :~\tl_use:N \mn__problem_title_tl + } + } + +\cs_set:Npn \mn__problem_title: + { + \mn__problem_title_pdf: + % The text after the problem, nominally a period ("."). + \tl_use:N \g__mn_problem_after_tl + } + +% PDF anchor / bookmark name for hyperref. +\cs_set:Npn \mn__problem_anchor: + { + problem.\int_to_arabic:n { \g__mn_all_problems_int } + } + +\NewDocumentEnvironment { problem } + { + O{} % Problem number or options + } + { + \keys_set:nn { mn__problem } { #1 } + + % Set the problem number + \tl_set:Nn \mn__problem_number_current_tl { } + \tl_if_eq:NNTF \mn__problem_number_tl \c_novalue_tl + { + % No number given + \tl_set_eq:NN \mn__problem_number_current_tl \mn__problem_number_default_tl + } + { + % Some number given, *maybe* empty + \tl_set_eq:NN \mn__problem_number_current_tl \mn__problem_number_tl + } + + \vspace { \skip_use:N \g__mn_problem_before_skip } + + \phantomsection + \addcontentsline + { toc } + { chapter } + { \mn__problem_title_pdf: } + \begin{mdframed} + [ + style = note , + startinnercode = + \mn__note_title:n + { + \cs_gset:Npx \@currentlabel { \tl_use:N \mn__problem_number_current_tl } + \cs_gset:Npx \@currentlabelname { \mn__problem_title: } + \tl_if_empty:NF \mn__problem_label_tl + { + \exp_after:wN \label { \tl_use:N \mn__problem_label_tl } + } + \mn__problem_title: + } + , + ] + } + { + \end{mdframed} + % If we didn't get a custom number, increment the counter. + \tl_if_eq:NNT \mn__problem_number_tl \c_novalue_tl + { + \int_gincr:N \g__mn_problems_int + } + % But always increment the internal counter. + \int_gincr:N \g__mn_all_problems_int + } + +\NewDocumentCommand \prob + { + O{} % Problem number or options + m % Problem text + } + { + \begin{problem}[#1] + #2 + \end{problem} + } + +\cs_set:Npn \mn__add_par_arg_to_sectioning_cmd:N #1 + { + \cs_set_eq:cN { mn__\cs_to_str:N #1 _old } #1 + \cs_set_eq:cc + { mn__the\cs_to_str:N #1 _old } + { the\cs_to_str:N #1 } + \RenewDocumentCommand #1 + { + s % ##1: Numbered / in ToC? + d() % ##2: Number override. + o % ##3: ToC title. + o % ##4: Page header title. + m % ##5: Title. + } + { + \group_begin: + \cs_set:Npx \mn__current_thesection_cmd + { the\cs_to_str:N #1 } + % Is there a number override? + \IfValueTF { ##2 } + { + % If yes, *globally* change the number format. + \cs_gset:cpn { \mn__current_thesection_cmd } { ##2 } + } + { + % Otherwise, restore the number format from a previous override, + % if applicable. + \cs_gset_eq:cc + { \mn__current_thesection_cmd } + { mn__the\cs_to_str:N #1 _old } + } + % Save the original command so we can use it as a single token. + \cs_set_eq:Nc \mn__orig_sectioning_cmd { mn__\cs_to_str:N #1 _old } + \exp_last_unbraced:Ne \mn__orig_sectioning_cmd + { + % Propagate the star. + \IfBooleanT { ##1 } { * } + % Propogate other arguments. + \IfValueT { ##3 } { [##3] } + \IfValueT { ##4 } { [##4] } + { ##5 } + } + \group_end: + } + } + +\cs_set:Npn \mn__add_par_arg_to_sectioning_cmds:n #1 + { + \clist_map_function:nN { #1 } \mn__add_par_arg_to_sectioning_cmd:N + } + +\makeheadstyles { rbt-mathnotes-hw } + { + \chapterstyle { rbt-mathnotes } + \headstyles { rbt-mathnotes } + + % Don't use chapter numbers in sections and beyond: + \cs_set:Npn \thesection { \arabic{section} } + + % Add paren-arg to override numbers in sectioning commands. + \mn__add_par_arg_to_sectioning_cmds:n + { + \chapter , + \section , + \subsection , + \subsubsection , + \paragraph , + \subparagraph , + } + } + +\headstyles { rbt-mathnotes-hw } + +\setlength{\columnsep}{3em} + +% No chapter numbers for figures. +\counterwithout{figure}{chapter} + +% Put author name, title in headings +\makeevenfoot { headings } { } { } { } +\makeoddfoot { headings } { } { } { } +\makeevenhead { headings } { } { } { \thepage } +\makeoddhead { headings } { \@author,~\textit{ \@title } } { } { \thepage } diff --git a/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-messages.sty b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-messages.sty new file mode 100644 index 00000000000..30b0c1a777d --- /dev/null +++ b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-messages.sty @@ -0,0 +1,76 @@ +%% rbt-mathnotes-messages.sty +%% Copyright 2021 Rebecca B. Turner. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Rebecca B. Turner. +% +% This work consists of the files: +% README.md +% rbt-mathnotes.tex +% rbt-mathnotes.sty +% rbt-mathnotes.cls +% rbt-mathnotes-util.sty +% rbt-mathnotes-messages.sty +% rbt-mathnotes-hw.cls +% rbt-mathnotes-formula-sheet.cls +% examples/cheat-sheet.tex +% examples/multivar.tex +% examples/topology-hw-1.tex +% and the derived files: +% rbt-mathnotes.pdf +% examples/cheat-sheet.pdf +% examples/multivar.pdf +% examples/topology-hw-1.pdf + +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplPackage{rbt-mathnotes-messages}{2021/11/29}{1.0.2}{Messages + for mathnotes.} + +\msg_new:nnnn { mathnotes } + { no name } + { + No~author~name~given~but~\exp_not:N \maketitle~was~still~used. + } + { + Set~your~name~in~the~preamble: \\ + \exp_not:N \mathnotes\{~name~=~Your~name~...~,~\} + } + +\msg_new:nnnn { mathnotes } + { acronym already defined } + { + Command~#1~already~defined;~refusing~to~redefine~as~an~acronym~for~#2. + } + { + Pick~a~different~destination~control~sequence~with~\protect\newacronym's~ + optional~argument? + } + +\msg_new:nnnn { mathnotes } + { no key in problem } + { + Key~#1~is~not~defined~for~the~problem~environment. + } + { + If~you~meant~to~set~the~problem~number,~don't~include~a~value. + } + + +\msg_new:nnnn { mathnotes } + { requires memoir class } + { + Option~#1~can~only~be~used~with~the~memoir~class! + } + { + Use~the~memoir~document~class~or~one~of~the~rbt-mathnotes~classes~wrapping~it. + } diff --git a/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-util.sty b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-util.sty new file mode 100644 index 00000000000..b95c73da01f --- /dev/null +++ b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes-util.sty @@ -0,0 +1,180 @@ +%% rbt-mathnotes-util.sty +%% Copyright 2021 Rebecca B. Turner. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Rebecca B. Turner. +% +% This work consists of the files: +% README.md +% rbt-mathnotes.tex +% rbt-mathnotes.sty +% rbt-mathnotes.cls +% rbt-mathnotes-util.sty +% rbt-mathnotes-messages.sty +% rbt-mathnotes-hw.cls +% rbt-mathnotes-formula-sheet.cls +% examples/cheat-sheet.tex +% examples/multivar.tex +% examples/topology-hw-1.tex +% and the derived files: +% rbt-mathnotes.pdf +% examples/cheat-sheet.pdf +% examples/multivar.pdf +% examples/topology-hw-1.pdf + +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplPackage{rbt-mathnotes-util}{2021/11/29}{1.0.2}{Utility commands + for rbt-mathnotes.} + +\cs_set:Npn \mn__legacy_bool_option:n #1 + { + \bool_new:c { g__mn_#1_bool } + \csname if\@currname @#1 \endcsname + \bool_gset_true:c { g__mn_#1_bool } + \else + \bool_gset_false:c { g__mn_#1_bool } + \fi + } + +\keys_define:nn { mn_options } + { + init .tl_set:N = \l__mn_options_init_tl , + init .default:n = true , + init .initial:x = \tl_use:N \c_novalue_tl , + + default .tl_set:N = \l__mn_options_default_tl , + default .value_required:n = true , + default .initial:x = \tl_use:N \c_novalue_tl , + + type .choice: , + type .choices:nn = { bool, str } + { \tl_set_eq:NN \l__mn_options_type_tl \l_keys_choice_tl } , + type .value_required:n = true , + type .initial:n = bool , + } + +% A hook which executes after \ProcessKeyvalOptions and is used to convert +% TeX booleans and so on to LaTeX3 booleans and strings. +\tl_new:N \g__mn_after_options_hook_tl +% A hook used to define a particular option, allowing keys to be set only in +% a group. +\tl_new:N \g__mn_define_option_tl +% Initializes complementary #1 and no#1 package options. +\NewDocumentCommand \mn__option_new { o m } + { + \tl_gclear:N \g__mn_define_option_tl + \group_begin: + \tl_if_novalue:nF { #1 } + { \keys_set:nn { mn_options } { #1 } } + + \tl_set:Nn \l_tmpa_tl { bool } + \tl_if_eq:NNT \l__mn_options_type_tl \l_tmpa_tl + { + % If no default was given, use `false` for bools. + \tl_if_eq:NNT \l__mn_options_init_tl \c_novalue_tl + { \tl_set:Nn \l__mn_options_init_tl { false } } + + \tl_gput_right:Nx \g__mn_define_option_tl + { + \exp_not:N \DeclareBoolOption [\l__mn_options_init_tl]{#2} + \exp_not:N \DeclareComplementaryOption {no#2}{#2} + } + + % After we process options, convert to an expl3 bool. + \tl_gput_right:Nn \g__mn_after_options_hook_tl + { + % Adapt the legacy bool into an expl3 bool. + \mn__legacy_bool_option:n { #2 } + % Then, delete the legacy bool. + \mn__legacy_bool_undefine:n { \@currname @#2 } + } + } + + % For a string option: + \tl_set:Nn \l_tmpa_tl { str } + \tl_if_eq:NNT \l__mn_options_type_tl \l_tmpa_tl + { + \tl_gput_right:No \g__mn_define_option_tl + { + \exp_not:N \DeclareStringOption + \tl_if_eq:NNF \l__mn_options_init_tl \c_novalue_tl + { [\l__mn_options_init_tl] } + { #2 } + \tl_if_eq:NNF \l__mn_options_default_tl \c_novalue_tl + { [\l__mn_options_default_tl] } + } + + \tl_gput_right:Nn \g__mn_after_options_hook_tl + { + % Create the new tl for this option. + \tl_new:c { g__mn_#2_tl } + % Set it to the command kvoptions created. + \tl_set:co { g__mn_#2_tl } { \cs:w \@currname @#2 \cs_end: } + % Delete the old command. + \cs_undefine:c { \@currname @#2 } + } + } + \group_end: + \tl_use:N \g__mn_define_option_tl + } + +\cs_set:Npn \mn__process_options:n #1 + { + \ProcessKeyvalOptions { #1 } + \tl_use:N \g__mn_after_options_hook_tl + } + +\cs_set:Npn \mn__legacy_bool_undefine:n #1 + { + \cs_undefine:c { if#1 } + \cs_undefine:c { #1true } + \cs_undefine:c { #1false } + } + +% Package configuration string values. +% {< module >}{< family >}{< key name >} +\cs_set:Npn \mn__key_new:nnn #1#2#3 + { + \tl_set_eq:cN { l__#1_#3_tl } \c_novalue_tl + \keys_define:nn { #2 } + { + #1 .value_required:n = true, + #1 .tl_set:c = l__#1_#3_tl, + } + } + +\cs_set:Npn \mn__mathnotes_key_new:n #1 + { + \mn__key_new:nnn { mn } { mathnotes } { #1 } + } + +\cs_set:Npn \mn__keys_new:n #1 { \clist_map_function:nN { #1 } \mn__mathnotes_key_new:n } + +\prg_new_conditional:Npnn \mn__if_package_loaded:n #1 + { p, T, F, TF } + { + \@ifpackageloaded { #1 } + { \prg_return_true: } + { \prg_return_false: } + } + +\prg_new_conditional:Npnn \mn__if_novalue:N #1 + { p, T, F, TF } + { + \tl_if_eq:NNTF \c_novalue_tl #1 + { \prg_return_true: } + { \prg_return_false: } + } +\prg_generate_conditional_variant:Nnn \mn__if_novalue:N + { c } + { p, T, F, TF } diff --git a/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes.cls b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes.cls new file mode 100644 index 00000000000..df69338ad12 --- /dev/null +++ b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes.cls @@ -0,0 +1,202 @@ +%% rbt-mathnotes.cls +%% Copyright 2021 Rebecca B. Turner. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Rebecca B. Turner. +% +% This work consists of the files: +% README.md +% rbt-mathnotes.tex +% rbt-mathnotes.sty +% rbt-mathnotes.cls +% rbt-mathnotes-util.sty +% rbt-mathnotes-messages.sty +% rbt-mathnotes-hw.cls +% rbt-mathnotes-formula-sheet.cls +% examples/cheat-sheet.tex +% examples/multivar.tex +% examples/topology-hw-1.tex +% and the derived files: +% rbt-mathnotes.pdf +% examples/cheat-sheet.pdf +% examples/multivar.pdf +% examples/topology-hw-1.pdf + +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplClass{rbt-mathnotes}{2021/11/29}{1.0.2}{Styles for mathematical + note taking.} + +\PassOptionsToClass { openany, oneside } { memoir } + +\LoadClass{memoir} +\setsecnumdepth{subsubsection} +\settocdepth{subsubsection} +\nouppercaseheads +\makeevenfoot { plain } { } { } { } +\makeoddfoot { plain } { } { } { } +\makeevenhead { plain } { } { } { \thepage } +\makeoddhead { plain } { } { } { \thepage } + +\RequirePackage{etoolbox} +\RequirePackage{xparse} +\AtBeginDocument{ + \patchcmd { \@tocmaketitle } + { \thispagestyle { chapter } } + { } + { } + { } + } + +\makechapterstyle { rbt-mathnotes } + { + % allow for 99 chapters! + \settowidth{\chapindent}{\chapnumfont 999} + + \RenewDocumentCommand \chapnumfont { } + { + \normalfont + \huge + \exp:w \mn__color:n {MNsecnum} + } + \RenewDocumentCommand \chapterheadstart { } { } + \RenewDocumentCommand \printchaptername { } { } + \RenewDocumentCommand \chapternamenum { } { } + \RenewDocumentCommand \printchapternum { } + { + \noindent + \llap + { + \makebox [ \chapindent ] + { \chapnumfont \thechapter } + } + } + \RenewDocumentCommand \afterchapternum { } { } + \RenewDocumentCommand \printchaptertitle { m } + { + \raggedright + \huge + ##1 + } + \RenewDocumentCommand \afterchaptertitle { } + { + \vskip \onelineskip + \hrule + \vskip \onelineskip + } + } + +\makeheadstyles { rbt-mathnotes } + { + \chapterstyle { rbt-mathnotes } + + \setsecnumformat + { + \group_begin: + \exp:w \mn__color:n {MNsecnum} + \cs:w the##1 \cs_end: + \quad + \group_end: + } + + % Sections. + \setbeforesecskip + { + -1\onelineskip plus -0.5\onelineskip minus -0.5\onelineskip + } + \setaftersecskip + { + 1\onelineskip plus 0.1\onelineskip + } + \setsecheadstyle + { + \normalfont + \memRTLraggedright + \bfseries + \LARGE + % \scshape + % \MakeTextLowercase + } + + % Subsections. + \setbeforesubsecskip + { + -1.0\onelineskip plus -0.25\onelineskip minus -0.25\onelineskip + } + \setaftersubsecskip + { + 1.0\onelineskip plus 0.1\onelineskip + } + \setsubsecheadstyle + { + \sethangfrom { \noindent ####1 } + \normalfont + \bfseries + \memRTLraggedright + } + + % Subsubsections. + \setbeforesubsubsecskip + { + 1.0\onelineskip plus 0.5\onelineskip minus 0.2\onelineskip + } + \setaftersubsubsecskip + { + 1.0\onelineskip plus 0.1\onelineskip + } + \setsubsubsecheadstyle + { + \normalfont + \normalsize + \bfseries + \memRTLraggedright + } + + % Paragraphs. + \setbeforeparaskip + { + 1.0\onelineskip plus 0.5\onelineskip minus 0.2\onelineskip + } + \setafterparaskip { -1em } + \setparaheadstyle + { + \normalfont + \normalsize + \bfseries + } + + % Subparagraphs. + \setsubparaindent { \parindent } + \setbeforesubparaskip + { + 1.0\onelineskip plus 0.5\onelineskip minus 0.2\onelineskip + } + \setaftersubparaskip { -1em } + \setsubparaheadstyle + { + \normalfont + \normalsize + \itshape + \addperiod + } + } + +\headstyles { rbt-mathnotes } + +% \chapterstyle{hangnum} +% \cs_set:Npn \chapnumfont + % { + % \HUGE \bfseries + % \exp:w \mn__color:n {MNsecnum} + % } + +\RequirePackage { rbt-mathnotes } diff --git a/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes.sty b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes.sty new file mode 100644 index 00000000000..afa05cbfb8d --- /dev/null +++ b/Master/texmf-dist/tex/latex/rbt-mathnotes/rbt-mathnotes.sty @@ -0,0 +1,1122 @@ +%% rbt-mathnotes.sty +%% Copyright 2021 Rebecca B. Turner. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Rebecca B. Turner. +% +% This work consists of the files: +% README.md +% rbt-mathnotes.tex +% rbt-mathnotes.sty +% rbt-mathnotes.cls +% rbt-mathnotes-util.sty +% rbt-mathnotes-messages.sty +% rbt-mathnotes-hw.cls +% rbt-mathnotes-formula-sheet.cls +% examples/cheat-sheet.tex +% examples/multivar.tex +% examples/topology-hw-1.tex +% and the derived files: +% rbt-mathnotes.pdf +% examples/cheat-sheet.pdf +% examples/multivar.pdf +% examples/topology-hw-1.pdf + +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplPackage{rbt-mathnotes}{2021/11/29}{1.0.2}{Styles for + mathematical note taking.} +\errorcontextlines 20 +% Module 'mn' + +% Load some utility packages. +\RequirePackage{xparse} % Better command declarations. +\RequirePackage{xkeyval} % Better keyval parsing. +% {{{ Package options +\RequirePackage{kvoptions} % More flexible package options. +\RequirePackage{rbt-mathnotes-util} + +\SetupKeyvalOptions + { + family = mn__package_options , + } + +\mn__option_new[init = true]{fonts} +\mn__option_new[init = true]{stix} +\mn__option_new[init = true]{symbols} +\mn__option_new[init = true]{maketitle} +\mn__option_new[init = true]{titles} +\mn__option_new[init = true]{xcolor} +\mn__option_new[init = true]{theorems} +\mn__option_new[init = true]{enumitem} +\mn__option_new{listings} +\mn__option_new{knowledge} +\mn__option_new{index} +\mn__option_new{footnotes} +\mn__option_new{figures} +\mn__option_new{tabu} +\mn__option_new{kindle} + +\mn__process_options:n { mn__package_options } % }}} + +\RequirePackage{rbt-mathnotes-messages} + +% {{{ Load fonts. +% Check if we can load fontspec; this is taken from fontspec.sty. +\bool_new:N \c__mn_fontspec_bool +\bool_set:Nn \c__mn_fontspec_bool + { + \sys_if_engine_xetex_p: || \sys_if_engine_luatex_p: + } + +% NOTE: The order these packages are loaded in is very important. +% - mathtools has to be loaded before these or overbrackets and such get +% messed up +% - unicode-math overwrites a bunch of commands, so should be loaded after +% amsmath and others +% - amsmath should be loaded after stix2 (not sure why, but the stix2 +% documentation specifies this) -- however, if we can use fontspec, we +% just load the stix2 fonts without the stix2 package itself, so we load +% amsmath before unicode-math (and the stix2 fonts) +\RequirePackage{mathtools} +\bool_if:NTF \g__mn_fonts_bool + { + \bool_if:NTF \c__mn_fontspec_bool + { + \RequirePackage{amsmath}[2013/01/14] + % unicode-math makes equations copy/pastable in PDF output. + % Note that unicode-math encapsulates the functionality of fontspec. + \RequirePackage[ + warnings-off={mathtools-colon,mathtools-overbracket} + ]{unicode-math} + \bool_if:NT \g__mn_stix_bool + { + \setmainfont + [ + UprightFont = *-Regular , + ItalicFont = *-Italic , + BoldFont = *-Bold , + BoldItalicFont = *-BoldItalic , + Extension = .otf , + ] + { STIX2Text } + + \setmathfont + [ + StylisticSet = + { + 1 , % better caligraphic forms + 8 , % upright integrals + } , + Extension = .otf , + ] + { STIX2Math } + } + } + { + % Otherwise, load non-XeTeX fallbacks. + \bool_if:NT \g__mn_stix_bool + { + \RequirePackage[upint]{stix2} + } + \RequirePackage{amsmath}[2013/01/14] + } + } + { + % No fonts + \RequirePackage{amsmath}[2013/01/14] + } % }}} + +\bool_if:NT \g__mn_symbols_bool % {{{ Define math symbol commands + { + % Logical not + \mn__if_package_loaded:nTF { unicode-math } + { \DeclareDocumentCommand \lnot {} { \char "AC } } % 0xAC = ¬ + { \mathchardef \Not = "1218 } + + % Blackboard bold set symbols + \NewDocumentCommand \Rational {}{\mathbb{Q}} + \ProvideDocumentCommand \Rat {}{\Rational} + \ProvideDocumentCommand \Q {}{\Rational} + + % \NewDocumentCommand \Irrational {}{\mathbb{I}} + % \ProvideDocumentCommand \Irrat {}{\Irrational} + % \ProvideDocumentCommand \I {}{\Irrational} + + \NewDocumentCommand \Natural {}{\mathbb{N}} + \ProvideDocumentCommand \Nat {}{\Natural} + \ProvideDocumentCommand \N {}{\Natural} + + \NewDocumentCommand \Integer {}{\mathbb{Z}} + \ProvideDocumentCommand \Int {}{\Integer} + \ProvideDocumentCommand \Z {}{\Integer} + + \NewDocumentCommand \Complex {}{\mathbb{C}} + \ProvideDocumentCommand \Comp {}{\Complex} + % Renew \C to mean \Complex in math-mode; normally, \C just gives an + % error in math-mode. + % ...if \C isn't defined, just define it normally. + \AtBeginDocument + { + \cs_if_free:NTF \C + { \NewDocumentCommand } + { + \cs_set_eq:NN \mn__C_old \C + \RenewDocumentCommand + } + \C {}{ + \mode_if_math:TF + { \Complex } % Complex set + { \mn__C_old } % Copyright sign + } + } + + \NewDocumentCommand \Real {}{\mathbb{R}} + \ProvideDocumentCommand \R {}{\Real} + + % Using the Weierstrass p here is probably a bit controversial, but I like + % it. I'm open to change, though... + \ProvideDocumentCommand \powerset {}{\wp} + + \RenewDocumentCommand \vec {m}{\mathbf{#1}} + + % Operator synonyms. + % Set intersect. + \ProvideDocumentCommand \intersection {}{\cap} + \ProvideDocumentCommand \inter {}{\cap} + \ProvideDocumentCommand \bigintersection {}{\bigcap} + \ProvideDocumentCommand \biginter {}{\bigcap} + + % Set union. + \ProvideDocumentCommand \union {}{\cup} + \ProvideDocumentCommand \bigunion {}{\bigcup} + % Disjoint union. + \ProvideDocumentCommand \disjointunion {}{\sqcup} + \ProvideDocumentCommand \disunion {}{\sqcup} + + % Divisiblity. + \ProvideDocumentCommand \divisible {}{\mid} + \ProvideDocumentCommand \div {}{\mid} + % Negation. + \ProvideDocumentCommand \notdivisible {}{\nmid} + \ProvideDocumentCommand \ndivisible {}{\nmid} + \ProvideDocumentCommand \notdiv {}{\nmid} + \ProvideDocumentCommand \ndiv {}{\nmid} + + % Wrappers around floor and ceil. + \ProvideDocumentCommand \floor {m}{\lfloor #1\rfloor} + \ProvideDocumentCommand \ceil {m}{\lceil #1\rceil} + + % The default empty set symbol is very ugly. Use \varnothing instead, + % which is less ugly. + \AtBeginDocument{\RenewDocumentCommand \emptyset {}{\varnothing}} + \ProvideDocumentCommand \es {}{\emptyset} + + % Function composition. The notation g \after f helps internalize the + % order of operations. :) + \ProvideDocumentCommand \after {}{\circ} + + % Cross product. + \ProvideDocumentCommand \cross {}{\times} + + % Operators. + % Function image. + \cs_if_free:NT \img + { \DeclareMathOperator \img {img} } + % Function pre-image. + \cs_if_free:NT \pre + { \DeclareMathOperator \pre {pre} } + % Function stabilizer. + \cs_if_free:NT \Stab + { \DeclareMathOperator \Stab {Stab} } + % Set of a function's fixed points. + \cs_if_free:NT \FixPt + { \DeclareMathOperator \FixPt {FixPt} } + % Identity function + \cs_if_free:NT \id + { \DeclareMathOperator \id {id} } + + % Injective function. + \ProvideDocumentCommand \injection {}{\hookrightarrow} + \ProvideDocumentCommand \inj {}{\hookrightarrow} + % Surjective function. + \ProvideDocumentCommand \surjection {}{\twoheadrightarrow} + \ProvideDocumentCommand \surj {}{\twoheadrightarrow} + % Bijective function. + \ProvideDocumentCommand \bijection {}{\twoheadrightarrowtail} + \ProvideDocumentCommand \bijective {}{\twoheadrightarrowtail} + \ProvideDocumentCommand \bij {}{\twoheadrightarrowtail} + % Function restriction. + \cs_if_free:NT \restriction + { \DeclareMathOperator \restriction {|} } + \ProvideDocumentCommand \restr {}{\restriction} + + % d/dx + \ProvideDocumentCommand \dd { O{} m }{\frac{d#1}{d#2}} + \ProvideDocumentCommand \pd { O{} m }{\frac{\partial#1}{\partial#2}} + \ProvideDocumentCommand \gradient {}{\nabla} + \ProvideDocumentCommand \grad {}{\nabla} + \cs_if_free:NT \curl + { \DeclareMathOperator \curl {curl} } + \cs_if_free:NT \dive + { \DeclareMathOperator \dive {div} } + } % }}} + +% Gives this an equation a number in an amsmath starred environment. +\ProvideDocumentCommand \numberthis { } % {{{ + { + \tag { \theequation } + \refstepcounter { equation } + } % }}} + +% Gives this equation a number and label in an amsmath starred environment. +\ProvideDocumentCommand \labelthis { m } % {{{ + { + \numberthis + \IfValueT { #1 } + { \label { #1 } } + } % }}} + +\bool_if:NT \g__mn_enumitem_bool + { \RequirePackage{enumitem} } + +\bool_if:NT \g__mn_listings_bool + { \RequirePackage{listings} } + +\bool_if:NT \g__mn_xcolor_bool % {{{ Load xcolor and define MN colors + { + \PassOptionsToPackage { rgb } { xcolor } + \RequirePackage { xcolor } + \providecolorset { HTML } + % Prefix/postfix of all color names + { } { } + { + \use_none:n + ; MNthmtitle , 0F0066 + ; MNthmbg , EBFEFF + ; MNthmline , 4836B3 + ; MNextitle , 692219 + ; MNexbg , FFF0EB + ; MNexline , CC7468 + ; MNdefntitle , 00540B + ; MNdefnline , 196924 + ; MNdefnbg , EBFFED + ; MNnotetitle , 6B0019 + ; MNnoteline , CC3F60 + ; MNnotebg , FFF5F7 + + ; MNsecnum , 8015A1 + + ; MNlink , 113DB8 + } + } % }}} + +\bool_if:NT \g__mn_listings_bool % {{{ Better default styles + { + \RequirePackage { xcolor } + \lstset + { + % Use a monospace font for code listings. + basicstyle = \ttfamily , + language = Mathematica , + % Tab size of 4, but you should probably use spaces. + tabsize = 4 , + % Keywords in blue. + keywordstyle = \bfseries\ttfamily\color[rgb]{0,.3,.7} , + % Comments in green. + commentstyle = \color[rgb]{0.133,0.545,0.133} , + % Strings in orange. + stringstyle = \color[rgb]{0.75,0.49,0.07} , + % The default listings characters are too widely-spaced. + % 0.55em/character makes things look a lot better. + basewidth = 0.55em , + % Wrap lines if they're too long, and wrap at whitespace. + breaklines , + breakatwhitespace = true , + } + } % }}} + +% Creates an acronym-command. +% \newacronym[<\command>]{<text>} defines \command to be \textsc{text}. +% \newacronym{<text>} defines \text to be \textsc{text}. +\ProvideDocumentCommand \newacronym { o m } % {{{ + { + \group_begin: + % If we have #1, then #1 is the cs we're going to define; #1 is a cs. + % Otherwise, we define \#2. + \IfValueTF { #1 } + { \cs_set:Npn \mn__acronym_cs: { \cs_to_str:N #1 } } + { \cs_set:Npn \mn__acronym_cs: { #2 } } + + % Ensure that the cs is undefined. + \cs_if_exist:cT { \mn__acronym_cs: } + { + \msg_error:nnxx + { mathnotes } + { acronym already defined } + { \exp_not:c { \mn__acronym_cs: } } + { #2 } + } + + % Finally, define the acronym command. + \cs_new:cpn { \mn__acronym_cs: } + { \textsc { #2 } } + \group_end: + } % }}} + +% \newacronyms takes a comma-separated list as its argument and defines them +% all as acronyms. +\ProvideDocumentCommand \newacronyms { m } + { \clist_map_function:nN { #1 } \newacronym } + +% {{{ Package configuration string values; \mathnotes command +\keys_define:nn { mn__main } + { + date .value_required:n = true , + date .code:n = \date{#1} , + author .value_required:n = true , + author .code:n = \author{#1} , + title .value_required:n = true , + title .code:n = \title{#1} , + + generate~thanks .value_required:n = false , + generate~thanks .bool_set:N = \g__mn_should_make_thanks , + generate~thanks .default:n = true , + generate~thanks .initial:n = true , + } + +\cs_set:Npn \mn__key_new:n #1 + { + \keys_define:nn { mn__main } + { + #1 .value_required:n = true , + #1 .tl_gset:c = g__mn_#1_tl , + #1 .initial:x = , + } + } + +\cs_set:Npn \mn__keys_new:n #1 { \clist_map_function:nN { #1 } \mn__key_new:n } + +\mn__keys_new:n + { + instructor, course, name, email, institution, semester, + } + +\NewDocumentCommand \mathnotes { m } + { + \keys_set:nn { mn__main } { #1 } + } +% }}} + +\bool_if:NT \g__mn_maketitle_bool % {{{ \author, \title, \maketitle, \thanks, etc. + { + \bool_new:N \g__mn_author_set + \cs_set:Npn \author #1 + { + \bool_gset_true:N \g__mn_author_set + \cs_gset:Npn \@author { #1 } + } + + \bool_new:N \g__mn_title_set + \cs_set:Npn \title #1 + { + \bool_gset_true:N \g__mn_title_set + \cs_gset:Npn \@title { #1 } + } + + \prg_new_conditional:Npnn \mn__if_should_make_thanks: % {{{ + { T, } + { + \bool_if:NTF \g__mn_should_make_thanks + { + \bool_lazy_all:nTF + { + { \tl_if_empty_p:N \g__mn_email_tl } + { \tl_if_empty_p:N \g__mn_course_tl } + { \tl_if_empty_p:N \g__mn_instructor_tl } + { \tl_if_empty_p:N \g__mn_institution_tl } + { \tl_if_empty_p:N \g__mn_semester_tl } + } + { \prg_return_false: } + { \prg_return_true: } + } + { \prg_return_false: } + } % }}} + + \cs_set:Npn \mn__make_thanks_text % {{{ + { + \tl_if_empty:NF \g__mn_email_tl + { + \email { \tl_use:N { \g__mn_email_tl } } + \bool_lazy_all:nF + { + { \tl_if_empty_p:N \g__mn_course_tl } + { \tl_if_empty_p:N \g__mn_instructor_tl } + { \tl_if_empty_p:N \g__mn_institution_tl } + { \tl_if_empty_p:N \g__mn_semester_tl } + } + { ;~ } + } + \tl_if_empty:NF \g__mn_course_tl + { + \tl_use:N \g__mn_course_tl + \bool_lazy_all:nF + { + { \tl_if_empty_p:N \g__mn_instructor_tl } + { \tl_if_empty_p:N \g__mn_institution_tl } + { \tl_if_empty_p:N \g__mn_semester_tl } + } + { ~ } + } + \tl_if_empty:NF \g__mn_instructor_tl + { + \bool_lazy_all:nTF + { + { \tl_if_empty_p:N \g__mn_email_tl } + { \tl_if_empty_p:N \g__mn_course_tl } + } + { Taught~by~ } + { taught~by~ } + \tl_use:N \g__mn_instructor_tl + } + \tl_if_empty:NF \g__mn_institution_tl + { + \bool_lazy_all:nTF + { + { \tl_if_empty_p:N \g__mn_email_tl } + { \tl_if_empty_p:N \g__mn_course_tl } + { \tl_if_empty_p:N \g__mn_instructor_tl } + } + { At~ } + { ~at~ } + \tl_use:N \g__mn_institution_tl + } + \tl_if_empty:NF \g__mn_semester_tl + { + \bool_lazy_all:nF + { + { \tl_if_empty_p:N \g__mn_email_tl } + { \tl_if_empty_p:N \g__mn_course_tl } + { \tl_if_empty_p:N \g__mn_instructor_tl } + { \tl_if_empty_p:N \g__mn_institution_tl } + } + { ,~ } + \tl_use:N \g__mn_semester_tl + } + . + } % }}} + + \cs_set:Npn \@author % {{{ + { + % If the author hasn't been set, we provide this (complicated, PITA) + % default; however, if we don't have any information to put in it, we + % still give a warning. + \tl_if_eq:NNTF \g__mn_name_tl \c_novalue_tl + { + \msg_warning:nn { mathnotes } { no name } + } + { + \tl_use:N \g__mn_name_tl + % Do we have any information to put in a \thanks? + \mn__if_should_make_thanks:T + { + \thanks { \mn__make_thanks_text } + } + } + } % }}} + + % {{{ \@maketitle and \maketitle + \skip_const:Nn \g__mn_maketitle_after_title { 1em } + \skip_const:Nn \g__mn_maketitle_after_author { 0.5em } + \skip_const:Nn \g__mn_maketitle_after { 1.5em } + + \RenewDocumentCommand \@maketitle {} + { + \begin{center} + \let \footnote \thanks + + % Set the title, if it exists. + \bool_if:NT \g__mn_title_set + { + \group_begin: + \HUGE + \bfseries + \@title + \par + \group_end: + } + \skip_vertical:N \g__mn_maketitle_after_title + + % Set the author. + \group_begin: + \LARGE + \lineskip 0.5em + \begin{tabular}[t]{c} + \@author + \end{tabular} + \par + \group_end: + \skip_vertical:N \g__mn_maketitle_after_author + + % Set the date. + \large + \@date + + \end{center} + \par + \skip_vertical:N \g__mn_maketitle_after + } + + \RenewDocumentCommand \maketitle {} + { + \par + \group_begin: + \cs_set:Npn \thefootnote + { + \@fnsymbol + \c@footnote + } + \cs_set:Npn \@makefnmark + { + \rlap + { + \@textsuperscript { \normalfont \@thefnmark } + } + } + \cs_set:Npn \@makefntext ##1 + { + \parindent 1em + \noindent + \hbox_to_wd:nn + { 1.8em } + { + \hss + \@textsuperscript { \normalfont \@thefnmark } + } + ##1 + } + \legacy_if:nTF { @twocolumn } + { + \if_int_compare:w \col@number = \@ne + \@maketitle + \else: + \twocolumn [ \@maketitle ] + \fi: + } + { + \newpage + \global\@topnum\z@ + \@maketitle + } + \thispagestyle{empty} + \@thanks + \group_end: + \setcounter{footnote}{0} + \cs_set:Npn \thanks ##1 { } + % NOTE: we don't erase the definitions of \@title, etc. + } + % }}} \@maketitle and \maketitle + } % }}} + +\bool_if:NT \g__mn_kindle_bool % {{{ + { + \keys_set:nn { mn__main } + { + generate~thanks = false , + } + \skip_gset:Nn \g__mn_maketitle_after_title { 0em } + \skip_gset:Nn \g__mn_maketitle_after_author { 0em } + \skip_gset:Nn \g__mn_maketitle_after { 0em } + \@ifclassloaded { memoir } + { + \pagestyle { empty } + + \setstocksize{12.2cm}{9cm} + \settrimmedsize{12.2cm}{9cm}{*} + \settypeblocksize{12.2cm}{9cm}{*} + + \setlrmargins{0cm}{*}{*} + \setulmargins{0cm}{*}{*} + + \setlength{\headheight}{0cm} + \setlength{\headsep}{0cm} + \setlength{\footskip}{0cm} + + \checkandfixthelayout + } + { + \msg_error:nnx + { mathnotes } + { requires memoir class } + { kindle } + } + } % }}} + +% e.g. `\exp:w \mn__color:n { MNnotetitle }` +\cs_set:Npn \mn__color:n #1 % {{{ + { + \bool_if:NTF \g__mn_xcolor_bool + { + \exp_end: + \color{#1} + } + { + \exp_end: + } + } % }}} + +\bool_if:NT \g__mn_theorems_bool % {{{ mdtheorem setup + { + \RequirePackage[thmmarks, amsmath, amsthm]{ntheorem} + + \RequirePackage{mdframed} + + \mdfdefinestyle { theorem } + { + linewidth = 1.5pt , + } + + \bool_if:NT \g__mn_xcolor_bool + { + \mdfapptodefinestyle { theorem } + { + frametitlefont = \normalfont\bfseries\color{MNthmtitle} , + linecolor = MNthmline , + backgroundcolor = MNthmbg , + } + } + + \mdfdefinestyle { minor-theorem } + { + style = theorem , + linewidth = 0.75pt , + } + + \mdfdefinestyle { example } + { + theoremtitlefont = \normalfont , + } + + \bool_if:NT \g__mn_xcolor_bool + { + \mdfapptodefinestyle { example } + { + frametitlefont = \normalfont\bfseries\color{MNextitle} , + linecolor = MNexline , + backgroundcolor = MNexbg , + } + } + + \mdfdefinestyle { definition } + { + } + + \bool_if:NT \g__mn_xcolor_bool + { + \mdfapptodefinestyle { definition } + { + frametitlefont = \normalfont\bfseries\color{MNdefntitle} , + linecolor = MNdefnline , + backgroundcolor = MNdefnbg , + } + } + + \mdfdefinestyle { note } + { + topline = false , + rightline = false , + bottomline = false , + linewidth = 2pt , + } + + \bool_if:NT \g__mn_xcolor_bool + { + \mdfapptodefinestyle { note } + { + frametitlefont = \normalfont\bfseries\color{MNnotetitle} , + linecolor = MNnoteline , + backgroundcolor = MNnotebg , + } + } + + \mdfdefinestyle { example } + { + theoremtitlefont = \normalfont , + } + + \bool_if:NT \g__mn_xcolor_bool + { + \mdfapptodefinestyle { example } + { + frametitlefont = \normalfont\bfseries\color{MNextitle} , + linecolor = MNexline , + backgroundcolor = MNexbg , + } + } + + \mdtheorem + [ style = theorem ] + { thm } + { Theorem } + % \newtheorem{shortthm}[thm]{Theorem} + \mdtheorem + [ style = minor-theorem ] + { lem } + { Lemma } + \mdtheorem + [ style = minor-theorem ] + { cor } + { Corollary } + \mdtheorem + [ style = minor-theorem ] + { prop } + { Proposition } + + % \theoremstyle{definition} + \mdtheorem + [ style = definition ] + { defn } + { Definition } + \mdtheorem + [ style = definition ] + { notation } + { Notation } + + % \theoremstyle{remark} + \mdtheorem + [ style = example ] + { ex } + { Example } + + \skip_new:N \mn__note_title_after_skip + \skip_set:Nn \mn__note_title_after_skip { 1em plus 0.25em minus 0.75em } + \cs_set:Npn \mn__note_title:n #1 + { + \textbf + { + \exp:w \mn__color:n { MNnotetitle } + #1 + } + \skip_horizontal:N \mn__note_title_after_skip + } + + \newmdenv + [ + style = note , + startinnercode = \mn__note_title:n { Note: } , + ] + { note } + + \newmdenv + [ + style = note , + startinnercode = \mn__note_title:n { Remark: } , + ] + { remark } + + \newmdenv + [ + style = note , + startinnercode = \mn__note_title:n { Hint: } , + ] + { hint } + + \newmdenv + [ + style = note , + startinnercode = \mn__note_title:n { Abuse of notation: } , + ] + { abuse-of-notation } + + % % reset for future defn.s + % \theoremstyle{plain} + } % }}} + +\NewDocumentCommand \TODO { o } % {{{ + { + \framebox + { + \textbf{ TODO \IfValueT { #1 } { :~} } + \IfValueT { #1 } { #1 } + } + } % }}} + +% \bool_if:NT \g__mn_titles_bool % {{{ + % { + % \RequirePackage{titlesec} + % % \titleformat { \command } [ shape ] { format } { label } { sep } { before-code } [ after-code ] + % % before-code can be a command + % \titleformat { \chapter } + % [ block ] + % { \bfseries \HUGE } + % { { \exp:w \mn__color:n {MNsecnum} \thechapter} } + % { 20pt } + % { } + % [ ] + + % \titleformat { \section } + % [ hang ] + % { \bfseries \LARGE } + % { { \exp:w \mn__color:n {MNsecnum} \thesection} } + % { 16pt } + % { } + % [ ] + + % \titleformat { \subsection } + % [ hang ] + % { \bfseries \Large } + % { { \exp:w \mn__color:n {MNsecnum} \thesubsection} } + % { 16pt } + % { } + % [ ] + + % % \titlespacing* { \command } { left } { before } { after } [ right ] + % \titlespacing* { \chapter } { 0em } { 0em } { 2em } [ 0em ] + % \titlespacing* { \section } { 0em } { 2em } { 0.5em } [ 0em ] + % \titlespacing* { \subsection } { 0em } { 1em } { 0em } [ 0em ] + % \titlespacing* { \subsubsection } { 0em } { 1em } { 0em } [ 0em ] + % } % }}} + +\bool_if:NT \g__mn_xcolor_bool % {{{ + { + \RequirePackage[hidelinks]{hyperref} + \hypersetup + { + colorlinks = true , + allcolors = MNlink , + } + } % }}} + +\bool_if:NT \g__mn_index_bool + { + \bool_set_true:N \g__mn_knowledge_bool + } + +\bool_if:NTF \g__mn_knowledge_bool % {{{ + { + \bool_if:NT \g__mn_xcolor_bool + { + \PassOptionsToPackage{xcolor}{knowledge} + \providecolorset { HTML } + % Prefix/postfix of all color names + { } { } + { + \use_none:n + ; MNunknown , DE0B0F + ; MNunknowncont , AD483E + ; MNintro , 051338 + } + } + \RequirePackage[quotation, notion, makeidx]{knowledge} + + % Disable the redefined \label command; this fixes some documents. + \KnowledgeConfigureBooleanOption[\knowledge_configuration_label_autoscope_bool]{patch~label} + + % {{{ Patch in the automatic-AP feature + \bool_new:N \g__mn_noAP_bool + \NewDocumentCommand \noAP { } + { \bool_gset_true:N \g__mn_noAP_bool } + \cs_set:Npn \mn__maybe_AP:N #1 + { + \bool_if:NTF \g__mn_noAP_bool + { \bool_gset_false:N \g__mn_noAP_bool } + { #1 } + } + + \RequirePackage{etoolbox} + \pretocmd { \intro } + { \mn__maybe_AP:N \AP } + { } { } + + \bool_new:N \l__mn_using_itemAP + \cs_set:Npn \mn__use_itemAP: + { + \bool_if:NF \l__mn_using_itemAP + { + \let \mn__item_orig: \item + \bool_set_true:N \l__mn_using_itemAP + \RenewDocumentCommand \item { o } + { + \IfNoValueTF { ##1 } + { + \mn__item_orig: + \mn__maybe_AP:N \AP + } + { + \mn__item_orig: + [ + \mn__maybe_AP:N \knowledge_itemAP: + % NOTE: this isn't expandable, which fucks up + % everything. + \cs_set_eq:NN \AP \prg_do_nothing: + ##1 + ] + } + } + } + } + \apptocmd { \enumerate } { \mn__use_itemAP: } { } { } + \apptocmd { \itemize } { \mn__use_itemAP: } { } { } + \apptocmd { \description } { \mn__use_itemAP: } { } { } + % }}} + + % {{{ Make some better styles. + \knowledgeconfigure + { + visible~anchor~points = false + } + \cs_set:Npn \mn__knowledgestyles:nn #1#2 + { + \clist_map_inline:nn { #1 } + { \knowledgestyle* { ##1 } { #2 } } + } + % List of default styles + % notion, intro notion + % intro, intro unknown, intro unknown cont + % kl unknown, kl unknown cont + \bool_if:NTF \g__mn_xcolor_bool + { + \mn__knowledgestyles:nn + { notion , intro~notion } + { + color = MNlink , + } + \mn__knowledgestyles:nn + { intro , intro~notion , intro~unknown, intro~unknown~cont , } + { + boldface , + color = MNintro , + } + \mn__knowledgestyles:nn + { intro~unknown , intro~unknown~cont , kl~unknown , kl~unknown~cont , } + { + underline = false , + color = MNunknown , + } + \mn__knowledgestyles:nn + { intro~unknown~cont , kl~unknown~cont , } + { + color = MNunknowncont , + } + } + { + % These blank definitions are important for erasing some very poorly + % typeset decisions. + \mn__knowledgestyles:nn + { notion , intro~notion } + { + } + \mn__knowledgestyles:nn + { intro , intro~notion , intro~unknown, intro~unknown~cont , } + { + boldface , + } + \mn__knowledgestyles:nn + { intro~unknown , intro~unknown~cont , kl~unknown , kl~unknown~cont , } + { + } + \mn__knowledgestyles:nn + { intro~unknown~cont , kl~unknown~cont , } + { + } + } + % }}} + } + { + % If we don't load the knowledge package, provide a *similar* interface + % to make writing commands that *optionally* use the knowledge interface + % easier. + \ProvideDocumentCommand \itemAP { O{} } { \item[#1] } + \ProvideDocumentCommand \AP { } { } + \ProvideDocumentCommand \phantomintro { d() m } { } + \ProvideDocumentCommand \nointro { m } { } + \ProvideDocumentCommand \reintro { s o m } { #3 } + \ProvideDocumentCommand \intro { d() o d() m } { #4 } + \ProvideDocumentCommand \kl { d() o d() m } { #4 } + } % }}} + +\bool_if:NT \g__mn_index_bool + { + \makeindex + } + +% The \emailstyle command gives the style of an email; by default, we +% initialize it to \texttt. +\ProvideDocumentCommand \emailstyle { m } { \texttt{#1} } +% The \email command typesets an email; if the user has loaded the +% hyperref package, we can add a link as well. +\mn__if_package_loaded:nTF { hyperref } % {{{ + { + \ProvideDocumentCommand \email { m } + { \href{mailto:#1}{\emailstyle{#1}} } + } + { + \ProvideDocumentCommand \email { m } + { \emailstyle{#1} } + } % }}} + +\bool_if:NT \g__mn_tabu_bool % {{{ + { + \RequirePackage{multirow} + \RequirePackage{booktabs} + \RequirePackage{longtable} + \RequirePackage{tabu} + \ProvideExpandableDocumentCommand \Th { O{l} m } + { + \multicolumn + { 1 } % For 1 column... + { #1 } % ...with column-spec #1... + { \textbf{#2} } % Typeset #2 in bold. + } + } % }}} + +\bool_if:NT \g__mn_figures_bool % {{{ + { + % figure captions + \RequirePackage{graphicx} + \RequirePackage{caption} + \captionsetup + { + format = hang, + font = { sf, footnotesize }, + margin = 1in + } + } % }}} + +% {{{ Footnotes +\bool_if:NT \g__mn_footnotes_bool + { + \PassOptionsToPackage{bottom, hang}{footmisc} + \RequirePackage{footmisc} + } +\setlength { \footnotesep } { \baselineskip } +% }}} + +% Document style. +\setlength { \parindent } { 0em } +\setlength { \parskip } { 1em } +% {{{ Set \parskip=0 around \tableofcontents +\RequirePackage{etoolbox} +\pretocmd { \tableofcontents } + { + \group_begin: + \setlength{\parskip}{0pt} + } + { } { } +\apptocmd { \tableofcontents } + { \group_end: } + { } { } +% }}} + +% This has to be hooked so that it doesn't break the other bools undefined +% with it first. +\AtEndOfPackage { \cs_undefine:N \mn__legacy_bool_undefine:n } |