update math packages to pysty

This commit is contained in:
Maximilian Keßler 2021-10-06 20:35:06 +02:00
parent af9f6cb245
commit 6ad0a2b411
12 changed files with 137 additions and 172 deletions

View file

@ -1,6 +1,4 @@
\NeedsTeXFormat{LaTeX2e} __HEADER__(Faktor package that also handles cofaktors)
\ProvidesPackage{mkessler-faktor}[2021-09-06 - Faktor package]
%%%%%%%%%%%%%%%%%%
% Extension the faktor package for % Extension the faktor package for
% - cofaktor command that provides A \ B notation % - 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 % This package only packages the corresponding answer and provides an analoguous way of a \cofactor command
%Dependencies %Dependencies
\RequirePackage{xparse} \RequirePackage{xparse}
\RequirePackage{amssymb} % provides \diagup and \diagdown \RequirePackage{amssymb} % provides \diagup and \diagdown

View file

@ -1,17 +1,12 @@
\NeedsTeXFormat{LaTeX2e} __HEADER__(Main math package.)
\ProvidesPackage{mkessler-math}[2021/03/31 - Math package] % Collects the basic math packages used for my lecture-note write-ups
%%%%%%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__
__END_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
%%%% Import the other custom math packages %%%% Import the other custom math packages
\RequirePackage{mkessler-mathfont} % Load this first to ensure untouched fonts \RequirePackage{mkessler-mathfont} % Load this first to ensure untouched fonts
@ -36,7 +31,7 @@
\RequirePackage{mkessler-mathsymb} \RequirePackage{mkessler-mathsymb}
\RequirePackage[basic]{mkessler-mathalias} \RequirePackage[basic]{mkessler-mathalias}
% mkessler-mathfont has already been imported % 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-mathfig}
\RequirePackage{mkessler-unicodechar} \RequirePackage{mkessler-unicodechar}
\RequirePackage{mkessler-mathfixes} % Load this last since it renews behaviour \RequirePackage{mkessler-mathfixes} % Load this last since it renews behaviour

41
math/mathalias.pysty Normal file
View file

@ -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\<mathcommand>{<prefix>}{<Set of letters>}
% to declare commands of form \<prefix><Letter> as \<mathcommand>{<Letter>} 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

View file

@ -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\<mathcommand>{<prefix>}{<Set of letters>}
% to declare commands of form \<prefix><Letter> as \<mathcommand>{<Letter>} 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

View file

@ -1,7 +1,4 @@
\NeedsTeXFormat{LaTeX2e} __HEADER__(Math figures with TikZ / pgfplots / xy)
\ProvidesPackage{mkessler-mathfig}[2021/03/31 - Math figures with TikZ / pgfplots / xy]
%%%%%%%%
% This is just a collection of the packages I use to typeset mathematical figures % This is just a collection of the packages I use to typeset mathematical figures
% most commonly plots, commutative diagrams or geometry % most commonly plots, commutative diagrams or geometry

36
math/mathfixes.pysty Normal file
View file

@ -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)
}

View file

@ -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
}

24
math/mathfont.pysty Normal file
View file

@ -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)}

View file

@ -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}

View file

@ -1,13 +1,9 @@
\NeedsTeXFormat{LaTeX2e} __HEADER__(Math Operator Package)
\ProvidesPackage{mkessler-mathop}[2021-04-27 - Operator Package]
%%%%%%%%%%%%%%%%%
%Provides some commonly used Operators used in the write-ups of my lecture notes %Provides some commonly used Operators used in the write-ups of my lecture notes
\newif\if@mkessler@operators@english\@mkessler@operators@englishtrue __LANGUAGE_OPTIONS__
\DeclareOption{german}{\@mkessler@operators@englishfalse}
\DeclareOption{english}{\@mkessler@operators@englishtrue} __END_OPTIONS__
\DeclareOption*{\PackageWarning{mkessler-operators}{Unknown '\CurrentOption'}}
\ProcessOptions\relax
%%%%%Package dependencies %%%%%Package dependencies
\RequirePackage{amsmath} \RequirePackage{amsmath}
@ -23,15 +19,15 @@
%%%For distributions %%%For distributions
%Introduce synonym for \operatorname %Introduce synonym for \operatorname
\newcommand\mkessler@operators@distribution[1]{\operatorname{#1}} \newcommand__PACKAGE_MACRO__(distribution)[1]{\operatorname{#1}}
%Easily declare new distributions %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 %%%For categories
%Introduce synonym for \operatorname %Introduce synonym for \operatorname
\newcommand\mkessler@operators@category[1]{\operatorname{\textbf{#1}}} \newcommand__PACKAGE_MACRO__(category)[1]{\operatorname{\textbf{#1}}}
%Easily declare new categories %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 %%%%%%%%%%% Operators
@ -51,27 +47,27 @@
% \lcm would print 'kgV' % \lcm would print 'kgV'
% The starred versions of the four commands will ignore the language option and print their % The starred versions of the four commands will ignore the language option and print their
% exact names (without the *, of course) % exact names (without the *, of course)
\DeclareMathOperator{\@mkessler@operators@ggT}{ggT} \DeclareMathOperator{\@__PACKAGE_PREFIX__ggT}{ggT}
\DeclareMathOperator{\@@mkessler@operators@ggT}{\if@mkessler@operators@english gcd\else ggT\fi} \DeclareMathOperator{\@@__PACKAGE_PREFIX__ggT}{\if@__PACKAGE_PREFIX__english gcd\else ggT\fi}
\def\ggT{\@ifstar\@mkessler@operators@ggT\@@mkessler@operators@ggT} \def\ggT{\@ifstar\@__PACKAGE_PREFIX__ggT\@@__PACKAGE_PREFIX__ggT}
\DeclareMathOperator{\@mkessler@operators@gcd}{gcd} \DeclareMathOperator{\@__PACKAGE_PREFIX__gcd}{gcd}
\DeclareMathOperator{\@@mkessler@operators@gcd}{\if@mkessler@operators@english gcd\else ggT\fi} \DeclareMathOperator{\@@__PACKAGE_PREFIX__gcd}{\if@__PACKAGE_PREFIX__english gcd\else ggT\fi}
\def\gcd{\@ifstar\@mkessler@operators@gcd\@@mkessler@operators@gcd} \def\gcd{\@ifstar\@__PACKAGE_PREFIX__gcd\@@__PACKAGE_PREFIX__gcd}
\DeclareMathOperator{\@mkessler@operators@kgV}{kgV} \DeclareMathOperator{\@__PACKAGE_PREFIX__kgV}{kgV}
\DeclareMathOperator{\@@mkessler@operators@kgV}{\if@mkessler@operators@english lcm\else kgV\fi} \DeclareMathOperator{\@@__PACKAGE_PREFIX__kgV}{\if@__PACKAGE_PREFIX__english lcm\else kgV\fi}
\def\kgV{\@ifstar\@mkessler@operators@kgV\@@mkessler@operators@kgV} \def\kgV{\@ifstar\@__PACKAGE_PREFIX__kgV\@@__PACKAGE_PREFIX__kgV}
\DeclareMathOperator{\@mkessler@operators@lcm}{lcm} \DeclareMathOperator{\@__PACKAGE_PREFIX__lcm}{lcm}
\DeclareMathOperator{\@@mkessler@operators@lcm}{\if@mkessler@operators@english lcm\else kgV\fi} \DeclareMathOperator{\@@__PACKAGE_PREFIX__lcm}{\if@__PACKAGE_PREFIX__english lcm\else kgV\fi}
\def\lcm{\@ifstar\@mkessler@operators@lcm\@@mkessler@operators@lcm} \def\lcm{\@ifstar\@__PACKAGE_PREFIX__lcm\@@__PACKAGE_PREFIX__lcm}
%Complex numbers %Complex numbers
\DeclareMathOperator{\mkessler@impart}{Im} \DeclareMathOperator{__PACKAGE_MACRO__(impart)}{Im}
\renewcommand\Im\mkessler@impart \renewcommand\Im__PACKAGE_MACRO__(impart)
\DeclareMathOperator{\mkessler@repart}{Re} \DeclareMathOperator{__PACKAGE_MACRO__(repart)}{Re}
\renewcommand\Re\mkessler@impart \renewcommand\Re__PACKAGE_MACRO__(repart)
%Linear Algebra %Linear Algebra
\DeclareSimpleMathOperator{Sym} \DeclareSimpleMathOperator{Sym}

View file

@ -1,15 +1,9 @@
\NeedsTeXFormat{LaTeX2e} __HEADER__(Some extra math-related symbols.)
\ProvidesPackage{mkessler-mathsymb}[2021-09-06 - 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 % A collection of math-related symbols / tools I often use, mainly collected together from Stack Overflow or hacked together myself
%Dependencies %Dependencies
\RequirePackage{tikz} \RequirePackage{tikz}
% noloc command by % noloc command by
% user 'egreg' (https://tex.stackexchange.com/users/4427/egreg) % user 'egreg' (https://tex.stackexchange.com/users/4427/egreg)
% posted on % posted on

View file

@ -1,8 +1,4 @@
\NeedsTeXFormat{LaTeX2e} __HEADER__(Wrapper for the newunicodechare package with some defined unicode symbols.)
\ProvidesPackage{mkessler-unicodechar}[2021/09/08 - Wrapper for the newunicodchar package with 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 % This is just a simple package loading the newunicodechar package and defining the common unicode symbols i regularly use for typesetting mathematics
\RequirePackage{newunicodechar} \RequirePackage{newunicodechar}