diff --git a/math/faktor.sty b/math/faktor.pysty similarity index 94% rename from math/faktor.sty rename to math/faktor.pysty index 3fab7a7..81b3a6a 100644 --- a/math/faktor.sty +++ b/math/faktor.pysty @@ -1,6 +1,4 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-faktor}[2021-09-06 - Faktor package] -%%%%%%%%%%%%%%%%%% +__HEADER__(Faktor package that also handles cofaktors) % Extension the faktor package for % - cofaktor command that provides A \ B notation @@ -13,7 +11,6 @@ % % This package only packages the corresponding answer and provides an analoguous way of a \cofactor command - %Dependencies \RequirePackage{xparse} \RequirePackage{amssymb} % provides \diagup and \diagdown diff --git a/math/math.sty b/math/math.pysty similarity index 54% rename from math/math.sty rename to math/math.pysty index 49b2c19..03725ff 100644 --- a/math/math.sty +++ b/math/math.pysty @@ -1,17 +1,12 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-math}[2021/03/31 - Math package] -%%%%%%Collects the basic math packages used for my lecture-note write-ups +__HEADER__(Main math package.) +% Collects the basic math packages used for my lecture-note write-ups +% This just imports all the packages I use for writing up mathematics +% Probably, you will just want to load them separately for more +% customization -%% This just imports all the packages I use for writing up mathematics +__LANGUAGE_OPTIONS__ - -\newif\if@mkessler@math@english\@mkessler@math@englishtrue -\DeclareOption{german}{\@mkessler@math@englishfalse} -\DeclareOption{ngerman}{\@mkessler@math@englishfalse} -\DeclareOption{english}{\@mkessler@math@englishtrue} - -\DeclareOption*{\PackageWarning{mkessler-math}{Unknown '\CurrentOption'}} -\ProcessOptions\relax +__END_OPTIONS__ %%%% Import the other custom math packages \RequirePackage{mkessler-mathfont} % Load this first to ensure untouched fonts @@ -36,7 +31,7 @@ \RequirePackage{mkessler-mathsymb} \RequirePackage[basic]{mkessler-mathalias} % mkessler-mathfont has already been imported -\RequirePackage[\if@mkessler@math@english english\else german\fi]{mkessler-mathop} +\RequirePackage[__IF__(english) english\else german\fi]{mkessler-mathop} \RequirePackage{mkessler-mathfig} \RequirePackage{mkessler-unicodechar} \RequirePackage{mkessler-mathfixes} % Load this last since it renews behaviour diff --git a/math/mathalias.pysty b/math/mathalias.pysty new file mode 100644 index 0000000..c368508 --- /dev/null +++ b/math/mathalias.pysty @@ -0,0 +1,41 @@ +__HEADER__(Easy aliasing for math style commands) + +__NEW_IF__(basic,false) +__NEW_IF__(extended,false) + +\DeclareOption{basic}{__SET_IF__(basic,true)} +\DeclareOption{extended}{__SET_IF__(extended,true)__SET_IF__(basic,true)} + +__END_OPTIONS__ + +%Usage: \makealiasesforwith\{}{} +% to declare commands of form \ as \{} for each +% of the specfied letters +% +% E.g. \makealiasesforwith\mathcal{c}{ABC} will declare +% \cA \cB \cC \cD as \mathcal{A}, \mathcal{B}, \mathcal{C} +% This is also ensuring math context, so that +% \cA will be valid even in normal text. + +\def\makealiasesforwith#1#2#3{ + \def__PACKAGE_MACRO__(makealias)##1{ + \expandafter\def\csname #2##1\endcsname{\ensuremath{#1{##1}}} + } + \def__PACKAGE_MACRO__(recurse)##1{ + \ifx##1__PACKAGE_MACRO__(dummy)\else + __PACKAGE_MACRO__(makealias){##1}\expandafter__PACKAGE_MACRO__(recurse)\fi + } + __PACKAGE_MACRO__(recurse) #3__PACKAGE_MACRO__(dummy) +} + +\def__PACKAGE_MACRO__(all){ABCDEFGHIJKLMNOPQRSTUVWXYZ} + +__IF__(basic) + \RequirePackage{amsfonts} + \makealiasesforwith\mathbb{}{CFKNQRZ} +\fi + +__IF__(extended) + \expandafter\makealiasesforwith\expandafter\mathcal\expandafter{\expandafter c\expandafter}\expandafter{__PACKAGE_MACRO__(all)} + \expandafter\makealiasesforwith\expandafter\mathfrak\expandafter{\expandafter f\expandafter}\expandafter{__PACKAGE_MACRO__(all)} +\fi diff --git a/math/mathalias.sty b/math/mathalias.sty deleted file mode 100644 index 6f73daf..0000000 --- a/math/mathalias.sty +++ /dev/null @@ -1,45 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathalias}[2021/09/09 Easy aliasing for math style commands] - -%%%%%% - -\newif\ifmkessler@mathalias@basic\mkessler@mathalias@basicfalse -\DeclareOption{basic}{\mkessler@mathalias@basictrue} - -\newif\ifmkessler@mathalias@extended\mkessler@mathalias@extendedfalse -\DeclareOption{extended}{\mkessler@mathalias@extendedtrue\mkessler@mathalias@basictrue} - -\DeclareOption*{\PackageWarning{mkessler-mathalias}{Unknown '\CurrentOption'}} -\ProcessOptions\relax - -%Usage: \makealiasesforwith\{}{} -% to declare commands of form \ as \{} for each -% of the specfied letters -% -% E.g. \makealiasesforwith\mathcal{c}{ABC} will declare -% \cA \cB \cC \cD as \mathcal{A}, \mathcal{B}, \mathcal{C} -% This is also ensuring math context, so that -% \cA will be valid even in normal text. - -\def\makealiasesforwith#1#2#3{ - \def\mkessler@aliases@makealias##1{ - \expandafter\def\csname #2##1\endcsname{\ensuremath{#1{##1}}} - } - \def\mkessler@aliases@recurse##1{ - \ifx##1\mkessler@dummy\else - \mkessler@aliases@makealias{##1}\expandafter\mkessler@aliases@recurse\fi - } - \mkessler@aliases@recurse #3\mkessler@dummy -} - -\def\mkessler@mathalias@all{ABCDEFGHIJKLMNOPQRSTUVWXYZ} - -\ifmkessler@mathalias@basic - \RequirePackage{amsfonts} - \makealiasesforwith\mathbb{}{CFKNQRZ} -\fi - -\ifmkessler@mathalias@extended - \expandafter\makealiasesforwith\expandafter\mathcal\expandafter{\expandafter c\expandafter}\expandafter{\mkessler@mathalias@all} - \expandafter\makealiasesforwith\expandafter\mathfrak\expandafter{\expandafter f\expandafter}\expandafter{\mkessler@mathalias@all} -\fi diff --git a/math/mathfig.sty b/math/mathfig.pysty similarity index 85% rename from math/mathfig.sty rename to math/mathfig.pysty index 9fbe017..849f129 100644 --- a/math/mathfig.sty +++ b/math/mathfig.pysty @@ -1,7 +1,4 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathfig}[2021/03/31 - Math figures with TikZ / pgfplots / xy] - -%%%%%%%% +__HEADER__(Math figures with TikZ / pgfplots / xy) % This is just a collection of the packages I use to typeset mathematical figures % most commonly plots, commutative diagrams or geometry diff --git a/math/mathfixes.pysty b/math/mathfixes.pysty new file mode 100644 index 0000000..88683ce --- /dev/null +++ b/math/mathfixes.pysty @@ -0,0 +1,36 @@ +__HEADER__(Hacky math packages for some (custom) fixes) +% This just brings together some (possibly ugly) hacks that I use when writing math. Likely, you do not want to use this except when building around this package (like I did), or already have similar shortcuts + +%Proper Degree command +\def__PACKAGE_MACRO__(degree){\ensuremath{^\circ}} +\AtBeginDocument{\let\degree__PACKAGE_MACRO__(degree)} + +% Always put limits under \limit +\let\oldlim\lim\def\lim{\oldlim\limits} + +% Print equal sign under subset by default to not confuse people +% (I still write \subset, because this enables me remove this renewcommand and have the default \subset command evaluated instead +\let__PACKAGE_MACRO__(subseteq)\subseteq +\let__PACKAGE_MACRO__(supseteq)\supseteq +\AtBeginDocument{ + \let\subset__PACKAGE_MACRO__(subseteq) + \let\supset__PACKAGE_MACRO__(supseteq) +} + +%%Renew phi and epsilon to their proper versions, make the old ones available as +% uglyphi and uglyepsilon + +\let__PACKAGE_MACRO__(stored@phi)\phi +\let__PACKAGE_MACRO__(stored@varphi)\varphi +\AtBeginDocument{ + \let\phi__PACKAGE_MACRO__(stored@varphi) + \let\uglyphi__PACKAGE_MACRO__(stored@phi) + \let\oldphi__PACKAGE_MACRO__(stored@phi) +} + +\let__PACKAGE_MACRO__(stored@epsilon)\epsilon +\let__PACKAGE_MACRO__(stored@varepsilon)\varepsilon +\AtBeginDocument{ + \let\epsilon__PACKAGE_MACRO__(stored@varepsilon) + \let\uglyepsilon__PACKAGE_MACRO__(stored@epsilon) +} diff --git a/math/mathfixes.sty b/math/mathfixes.sty deleted file mode 100644 index cbf80e5..0000000 --- a/math/mathfixes.sty +++ /dev/null @@ -1,39 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathfixes}[2021-04-27 - Hacky math packages for some (custom) fixes] -%%%%% - -% This just brings together some (possibly ugly) hacks that I use when writing math. Likely, you do not want to use this except when building around this package (like I did), or already have similar shortcuts - -%Proper Degree command -\def\mkessler@mathfixes@degree{\ensuremath{^\circ}} -\AtBeginDocument{\let\degree\mkessler@mathfixes@degree} - -% Always put limits under \limit -\let\oldlim\lim\def\lim{\oldlim\limits} - -% Print equal sign under subset by default to not confuse people -% (I still write \subset, because this enables me remove this renewcommand and have the default \subset command evaluated instead -\let\mkessler@mathfixes@subseteq\subseteq -\let\mkessler@mathfixes@supseteq\supseteq -\AtBeginDocument{ - \let\subset\mkessler@mathfixes@subseteq - \let\supset\mkessler@mathfixes@supseteq -} - -%%Renew phi and epsilon to their proper versions, make the old ones available as -% uglyphi and uglyepsilon - -\let\mkessler@mathfixes@stored@phi\phi -\let\mkessler@mathfixes@stored@varphi\varphi -\AtBeginDocument{ - \let\phi\mkessler@mathfixes@stored@varphi - \let\uglyphi\mkessler@mathfixes@stored@phi - \let\oldphi\mkessler@mathfixes@stored@phi -} - -\let\mkessler@mathfixes@stored@epsilon\epsilon -\let\mkessler@mathfixes@stored@varepsilon\varepsilon -\AtBeginDocument{ - \let\epsilon\mkessler@mathfixes@stored@varepsilon - \let\uglyepsilon\mkessler@mathfixes@stored@epsilon -} diff --git a/math/mathfont.pysty b/math/mathfont.pysty new file mode 100644 index 0000000..9f8d9ec --- /dev/null +++ b/math/mathfont.pysty @@ -0,0 +1,24 @@ +__HEADER__(Collects several math fonts together) +%%% Store away the several (partially conflicting) fonts in internal macros + +\let__PACKAGE_MACRO__(none@mathcal)\mathcal + +\RequirePackage{mathrsfs} +\let__PACKAGE_MACRO__(mathrsfs@mathscr)\mathscr + +\RequirePackage[mathscr]{eucal} +\let__PACKAGE_MACRO__(eucal@optionmathscr@mathscr)\mathscr + +\RequirePackage{amsfonts} +\let__PACKAGE_MACRO__(amsfonts@mathfrak)\mathfrak + +%%% Provide user commands to internally stored macros +\def__PACKAGE_MACRO__(restorefonts){ + \let\mathcal__PACKAGE_MACRO__(none@mathcal) % Set \mathcal to default calligrapic + \let\mathfrak__PACKAGE_MACRO__(amsfonts@mathfrak) % Set \mathfrak to mathfrak from amsfonts + \let\mathscr__PACKAGE_MACRO__(mathrsfs@mathscr) % Set \mathscr to mathscript from mathrsfs package + \let\mathcat__PACKAGE_MACRO__(mathrsfs@mathscr) % Set \mathcat to mathscript from mathrsfs package + \let\mathcalo__PACKAGE_MACRO__(eucal@optionmathscr@mathscr) % Set \mathcom (for comic) to \mathscr from [mathscr]{eucal} package +} + +\AtBeginDocument{__PACKAGE_MACRO__(restorefonts)} diff --git a/math/mathfont.sty b/math/mathfont.sty deleted file mode 100644 index 69ad8f7..0000000 --- a/math/mathfont.sty +++ /dev/null @@ -1,27 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathfont}[2021/09/06 - Collects several math fonts together] - - -%%% Store away the several (partially conflicting) fonts in internal macros - -\let\mkessler@mathfonts@none@mathcal\mathcal - -\RequirePackage{mathrsfs} -\let\mkessler@mathfonts@mathrsfs@mathscr\mathscr - -\RequirePackage[mathscr]{eucal} -\let\mkessler@mathfonts@eucal@optionmathscr@mathscr\mathscr - -\RequirePackage{amsfonts} -\let\mkessler@mathfonts@amsfonts@mathfrak\mathfrak - -%%% Provide user commands to internally stored macros -\def\mkessler@mathfonts@restorefonts{ - \let\mathcal\mkessler@mathfonts@none@mathcal % Set \mathcal to default calligrapic - \let\mathfrak\mkessler@mathfonts@amsfonts@mathfrak % Set \mathfrak to mathfrak from amsfonts - \let\mathscr\mkessler@mathfonts@mathrsfs@mathscr % Set \mathscr to mathscript from mathrsfs package - \let\mathcat\mkessler@mathfonts@mathrsfs@mathscr % Set \mathcat to mathscript from mathrsfs package - \let\mathcalo\mkessler@mathfonts@eucal@optionmathscr@mathscr % Set \mathcom (for comic) to \mathscr from [mathscr]{eucal} package -} - -\AtBeginDocument{\mkessler@mathfonts@restorefonts} diff --git a/math/mathop.sty b/math/mathop.pysty similarity index 72% rename from math/mathop.sty rename to math/mathop.pysty index f0d4b30..7bd8337 100644 --- a/math/mathop.sty +++ b/math/mathop.pysty @@ -1,13 +1,9 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathop}[2021-04-27 - Operator Package] -%%%%%%%%%%%%%%%%% +__HEADER__(Math Operator Package) %Provides some commonly used Operators used in the write-ups of my lecture notes -\newif\if@mkessler@operators@english\@mkessler@operators@englishtrue -\DeclareOption{german}{\@mkessler@operators@englishfalse} -\DeclareOption{english}{\@mkessler@operators@englishtrue} -\DeclareOption*{\PackageWarning{mkessler-operators}{Unknown '\CurrentOption'}} -\ProcessOptions\relax +__LANGUAGE_OPTIONS__ + +__END_OPTIONS__ %%%%%Package dependencies \RequirePackage{amsmath} @@ -23,15 +19,15 @@ %%%For distributions %Introduce synonym for \operatorname -\newcommand\mkessler@operators@distribution[1]{\operatorname{#1}} +\newcommand__PACKAGE_MACRO__(distribution)[1]{\operatorname{#1}} %Easily declare new distributions -\newcommand\DeclareDistribution[1]{\expandafter\def\csname #1\endcsname{\mkessler@operators@distribution{#1}}} +\newcommand\DeclareDistribution[1]{\expandafter\def\csname #1\endcsname{__PACKAGE_MACRO__(distribution){#1}}} %%%For categories %Introduce synonym for \operatorname -\newcommand\mkessler@operators@category[1]{\operatorname{\textbf{#1}}} +\newcommand__PACKAGE_MACRO__(category)[1]{\operatorname{\textbf{#1}}} %Easily declare new categories -\newcommand\DeclareCategory[1]{\expandafter\def\csname #1\endcsname{\mkessler@operators@category{#1}}} +\newcommand\DeclareCategory[1]{\expandafter\def\csname #1\endcsname{__PACKAGE_MACRO__(category){#1}}} %%%%%%%%%%% Operators @@ -51,27 +47,27 @@ % \lcm would print 'kgV' % The starred versions of the four commands will ignore the language option and print their % exact names (without the *, of course) -\DeclareMathOperator{\@mkessler@operators@ggT}{ggT} -\DeclareMathOperator{\@@mkessler@operators@ggT}{\if@mkessler@operators@english gcd\else ggT\fi} -\def\ggT{\@ifstar\@mkessler@operators@ggT\@@mkessler@operators@ggT} +\DeclareMathOperator{\@__PACKAGE_PREFIX__ggT}{ggT} +\DeclareMathOperator{\@@__PACKAGE_PREFIX__ggT}{\if@__PACKAGE_PREFIX__english gcd\else ggT\fi} +\def\ggT{\@ifstar\@__PACKAGE_PREFIX__ggT\@@__PACKAGE_PREFIX__ggT} -\DeclareMathOperator{\@mkessler@operators@gcd}{gcd} -\DeclareMathOperator{\@@mkessler@operators@gcd}{\if@mkessler@operators@english gcd\else ggT\fi} -\def\gcd{\@ifstar\@mkessler@operators@gcd\@@mkessler@operators@gcd} +\DeclareMathOperator{\@__PACKAGE_PREFIX__gcd}{gcd} +\DeclareMathOperator{\@@__PACKAGE_PREFIX__gcd}{\if@__PACKAGE_PREFIX__english gcd\else ggT\fi} +\def\gcd{\@ifstar\@__PACKAGE_PREFIX__gcd\@@__PACKAGE_PREFIX__gcd} -\DeclareMathOperator{\@mkessler@operators@kgV}{kgV} -\DeclareMathOperator{\@@mkessler@operators@kgV}{\if@mkessler@operators@english lcm\else kgV\fi} -\def\kgV{\@ifstar\@mkessler@operators@kgV\@@mkessler@operators@kgV} +\DeclareMathOperator{\@__PACKAGE_PREFIX__kgV}{kgV} +\DeclareMathOperator{\@@__PACKAGE_PREFIX__kgV}{\if@__PACKAGE_PREFIX__english lcm\else kgV\fi} +\def\kgV{\@ifstar\@__PACKAGE_PREFIX__kgV\@@__PACKAGE_PREFIX__kgV} -\DeclareMathOperator{\@mkessler@operators@lcm}{lcm} -\DeclareMathOperator{\@@mkessler@operators@lcm}{\if@mkessler@operators@english lcm\else kgV\fi} -\def\lcm{\@ifstar\@mkessler@operators@lcm\@@mkessler@operators@lcm} +\DeclareMathOperator{\@__PACKAGE_PREFIX__lcm}{lcm} +\DeclareMathOperator{\@@__PACKAGE_PREFIX__lcm}{\if@__PACKAGE_PREFIX__english lcm\else kgV\fi} +\def\lcm{\@ifstar\@__PACKAGE_PREFIX__lcm\@@__PACKAGE_PREFIX__lcm} %Complex numbers -\DeclareMathOperator{\mkessler@impart}{Im} -\renewcommand\Im\mkessler@impart -\DeclareMathOperator{\mkessler@repart}{Re} -\renewcommand\Re\mkessler@impart +\DeclareMathOperator{__PACKAGE_MACRO__(impart)}{Im} +\renewcommand\Im__PACKAGE_MACRO__(impart) +\DeclareMathOperator{__PACKAGE_MACRO__(repart)}{Re} +\renewcommand\Re__PACKAGE_MACRO__(repart) %Linear Algebra \DeclareSimpleMathOperator{Sym} diff --git a/math/mathsymb.sty b/math/mathsymb.pysty similarity index 90% rename from math/mathsymb.sty rename to math/mathsymb.pysty index 2f48cc3..372ec07 100644 --- a/math/mathsymb.sty +++ b/math/mathsymb.pysty @@ -1,15 +1,9 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathsymb}[2021-09-06 - Some extra math-related symbols] - -%%%%%%%%%%%%%%%%%% +__HEADER__(Some extra math-related symbols.) % A collection of math-related symbols / tools I often use, mainly collected together from Stack Overflow or hacked together myself - %Dependencies \RequirePackage{tikz} - - % noloc command by % user 'egreg' (https://tex.stackexchange.com/users/4427/egreg) % posted on diff --git a/math/unicodechar.sty b/math/unicodechar.pysty similarity index 88% rename from math/unicodechar.sty rename to math/unicodechar.pysty index c3448eb..303fc69 100644 --- a/math/unicodechar.sty +++ b/math/unicodechar.pysty @@ -1,8 +1,4 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-unicodechar}[2021/09/08 - Wrapper for the newunicodchar package with defined unicode symbols] - -%%%%%%%% - +__HEADER__(Wrapper for the newunicodechare package with some defined unicode symbols.) % This is just a simple package loading the newunicodechar package and defining the common unicode symbols i regularly use for typesetting mathematics \RequirePackage{newunicodechar}