latex-packages/math/mkessler-mathop.sty

180 lines
5.8 KiB
Text
Raw Normal View History

2021-08-26 13:41:40 +02:00
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-mathop}[2021-04-27 - Operator Package]
%%%%%%%%%%%%%%%%%
2021-08-26 13:41:40 +02:00
%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}
2021-08-26 13:41:40 +02:00
\DeclareOption*{\PackageWarning{mkessler-operators}{Unknown '\CurrentOption'}}
\ProcessOptions\relax
%%%%%Package dependencies
2021-08-26 13:41:40 +02:00
\RequirePackage{amsmath}
\RequirePackage{bbm}
2021-09-09 21:46:01 +02:00
\RequirePackage{mathtools}
%%%%Different types of operator wrappers:
% For simple math operators that are just to be printed as their name
\newcommand\DeclareSimpleMathOperator[1]{
\expandafter\providecommand\csname #1\endcsname{\operatorname{#1}}
}
%%%For distributions
%Introduce synonym for \operatorname
\newcommand\mkessler@operators@distribution[1]{\operatorname{#1}}
%Easily declare new distributions
\newcommand\DeclareDistribution[1]{\expandafter\def\csname #1\endcsname{\mkessler@operators@distribution{#1}}}
%%%For categories
%Introduce synonym for \operatorname
\newcommand\mkessler@operators@category[1]{\operatorname{\textbf{#1}}}
%Easily declare new categories
\newcommand\DeclareCategory[1]{\expandafter\def\csname #1\endcsname{\mkessler@operators@category{#1}}}
2021-08-26 13:41:40 +02:00
%%%%%%%%%%% Operators
%Basic commands
\DeclareSimpleMathOperator{id}
\DeclareSimpleMathOperator{im}
\DeclareSimpleMathOperator{Bild}
\DeclareSimpleMathOperator{dom}
\DeclareSimpleMathOperator{Span}
\DeclareSimpleMathOperator{Aut}
\DeclareMathOperator{\rhs}{RHS} %Right hand side of equation
\DeclareMathOperator{\lhs}{LHS} %Left hand side of equation
%%Provide \ggT \gcd \kgV \lcm for 'greatest common denominator' and 'least common multiple'
% \ggT und \gcd, as well as \kgV and \lcm are synonyms and language-aware, so that
% e.g. when the german language option is loaded, even
% \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{\@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{\@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{\@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}
2021-08-26 13:41:40 +02:00
%Complex numbers
\DeclareMathOperator{\mkessler@impart}{Im}
\renewcommand\Im\mkessler@impart
\DeclareMathOperator{\mkessler@repart}{Re}
\renewcommand\Re\mkessler@impart
2021-08-26 13:41:40 +02:00
%Linear Algebra
\DeclareSimpleMathOperator{Sym}
\DeclareSimpleMathOperator{supp}
\DeclareSimpleMathOperator{sgn}
\DeclareSimpleMathOperator{coker}
\DeclareSimpleMathOperator{rank}
\DeclareSimpleMathOperator{Mat}
\DeclareSimpleMathOperator{ev}
2021-08-26 13:41:40 +02:00
%Algebra
\DeclareSimpleMathOperator{Quot}
\DeclareSimpleMathOperator{Gal}
\DeclareSimpleMathOperator{Ext}
\DeclareSimpleMathOperator{Tor}
\DeclareSimpleMathOperator{MaxSpec}
\DeclareSimpleMathOperator{Sh}
\DeclareSimpleMathOperator{Proj}
\DeclareSimpleMathOperator{QCoh}
\DeclareSimpleMathOperator{MaxSpec}
\DeclareSimpleMathOperator{Fun}
\DeclareMathOperator{\PreSh}{Pre-Sh}
\newcommand{\tensor}{\otimes} %Synonym for tensoring
2021-08-26 13:41:40 +02:00
%Analysis
\DeclareSimpleMathOperator{dx}
\DeclareSimpleMathOperator{dy}
\DeclareSimpleMathOperator{dz}
\DeclareSimpleMathOperator{dt}
2021-08-26 13:41:40 +02:00
%Sets
\DeclareSimpleMathOperator{conv}
\DeclareSimpleMathOperator{dist}
\DeclareSimpleMathOperator{diam}
2021-08-26 13:41:40 +02:00
%%Stochastic (Algorithmische Mathematik II)
\DeclareDistribution{Bin}
\DeclareDistribution{Ber}
\DeclareDistribution{Geo}
\DeclareDistribution{Poi}
\DeclareDistribution{Unif}
\DeclareDistribution{Var}
\DeclareDistribution{Cov}
2021-08-26 13:41:40 +02:00
%Topology
\DeclareSimpleMathOperator{pr}
\def\twedge{\vee} % Semantically correct macros for wedge product
\def\tsmash{\wedge} % Semantically correct macro for smash product
2021-08-26 13:41:40 +02:00
%Category Theory
\DeclareSimpleMathOperator{Ob}
\DeclareSimpleMathOperator{Hom}
\DeclareSimpleMathOperator{Mor}
\DeclareSimpleMathOperator{End}
2021-09-09 22:42:08 +02:00
\DeclareSimpleMathOperator{colim}
2021-08-26 13:41:40 +02:00
%Categories
\DeclareCategory{Top}
\DeclareCategory{hTop}
\DeclareCategory{Set}
\DeclareCategory{CHaus}
\DeclareCategory{Grp}
\DeclareCategory{Ab}
\DeclareCategory{CRing}
\DeclareCategory{Vect}
\DeclareCategory{Fin}
\DeclareCategory{Ab}
\DeclareCategory{Cat}
%Set theory
\DeclareSimpleMathOperator{card}
\DeclareSimpleMathOperator{Cd}
\DeclareSimpleMathOperator{Ord}
\DeclareSimpleMathOperator{otp}
\DeclareSimpleMathOperator{Card}
2021-08-26 13:41:40 +02:00
%%Galoiskohomologie
\DeclareSimpleMathOperator{Br}
\DeclareSimpleMathOperator{EXT}
\DeclareSimpleMathOperator{Ind}
\DeclareSimpleMathOperator{char}
\DeclareSimpleMathOperator{res}
\DeclareSimpleMathOperator{inf}
\DeclareSimpleMathOperator{cov}
\newcommand{\del}{\partial} % Semantically correct operator for boundary maps
2021-08-26 13:41:40 +02:00
% Characteristic function
\newcommand*{\cfun}{\ensuremath{\mathbbm{1}}}
\newcommand*{\One}{\cfun}
2021-08-26 13:41:40 +02:00
2021-09-09 21:46:01 +02:00
%Paired Delimiters
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
%Norm and absolute value
%Make them scaling by default and have \abs*{} as the non-scaling version of the command
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\let\oldabs\abs
\def\abs{\@ifstar{\oldabs}{\oldabs*}}
\DeclarePairedDelimiter\norm{\lVert}{\rVert}
\let\oldnorm\norm
\def\norm{\@ifstar{\oldnorm}{\oldnorm*}}
\DeclareMathOperator{\amalgprod}{\star}