latex-packages-build/math/mathop/mkessler-mathop.sty
Maximilian Keßler (via gitlab runner) 75bf09228d add set
Build branch master (8583c50) from kesslermaximilian/LatexPackages
2022-04-24 19:20:42 +00:00

271 lines
8.7 KiB
TeX

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright © 2022 Maximilian Keßler
%
% This work may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU General Public License
%
% Distribution under conditions of the LaTeX Project Public License,
% requires 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 Maximilian Keßler.
%
%
% Distribution under the GNU General Public License requires either
% version 3 or (at your opinion) any later version.
%
% This package has been generated by PyTeX, available at
% https://github.com/kesslermaximilian/PyTeX
% and built from source file 'mathop.pysty'.
% It is STRONGLY DISCOURAGED to edit this source file directly, since local
% changes will not be versioned by Git and overwritten by the next build. Always
% edit the source file and build the package again.
%
% Build details:
% PyTeX version: v1.2.0-31-gc9bb0e8 (commit c9bb0e8)
% Source code version: v2.9-12-g8583c50 (commit 8583c50)
%
% This LaTeX package is free software and is dual-licensed
% under the LPPLv1.3c and the GPLv3 licenses.
% You may use it freely for your purposes.
% The latest version of the package sources can be obtained
% via GitLab under
% https://gitlab.com/latexci/packages/LatexPackages
% The latest version of the built packages can be obtained via GitLab under
% https://gitlab.com/latexci/packages/LatexPackagesBuild
% For further information see the urls above.
% Reportings of bugs, suggestions and improvements are welcome, see the README
% at the Git repository for further information.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-mathop}[2022/04/24 - Math Operator Package]
%Provides some commonly used Operators used in the write-ups of my lecture notes
\RequirePackage{xkeyval}
\newif\ifmkessler@mathop@english\mkessler@mathop@englishtrue
\DeclareOptionX{german}{\mkessler@mathop@englishfalse}
\DeclareOptionX{ngerman}{\mkessler@mathop@englishfalse}
\DeclareOptionX{english}{\mkessler@mathop@englishtrue}
\DeclareOptionX*{\PackageWarning{mkessler-mathop}{Unknown '\CurrentOption'}}
\ProcessOptionsX*\relax
%%%%%Package dependencies
\RequirePackage{amsmath}
\RequirePackage{bbm}
\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@mathop@distribution[1]{\operatorname{#1}}
%Easily declare new distributions
\newcommand\DeclareDistribution[1]{\expandafter\def\csname #1\endcsname{\mkessler@mathop@distribution{#1}}}
%%%%%%%%%%% 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@mathop@ggT}{ggT}
\DeclareMathOperator{\@@mkessler@mathop@ggT}{\ifmkessler@mathop@english gcd\else ggT\fi}
\def\ggT{\@ifstar\@mkessler@mathop@ggT\@@mkessler@mathop@ggT}
\DeclareMathOperator{\@mkessler@mathop@gcd}{gcd}
\DeclareMathOperator{\@@mkessler@mathop@gcd}{\ifmkessler@mathop@english gcd\else ggT\fi}
\def\gcd{\@ifstar\@mkessler@mathop@gcd\@@mkessler@mathop@gcd}
\DeclareMathOperator{\@mkessler@mathop@kgV}{kgV}
\DeclareMathOperator{\@@mkessler@mathop@kgV}{\ifmkessler@mathop@english lcm\else kgV\fi}
\def\kgV{\@ifstar\@mkessler@mathop@kgV\@@mkessler@mathop@kgV}
\DeclareMathOperator{\@mkessler@mathop@lcm}{lcm}
\DeclareMathOperator{\@@mkessler@mathop@lcm}{\ifmkessler@mathop@english lcm\else kgV\fi}
\def\lcm{\@ifstar\@mkessler@mathop@lcm\@@mkessler@mathop@lcm}
%Complex numbers
\DeclareMathOperator{\mkessler@mathop@impart}{Im}
\renewcommand\Im\mkessler@mathop@impart
\DeclareMathOperator{\mkessler@mathop@repart}{Re}
\renewcommand\Re\mkessler@mathop@repart
%Linear Algebra
\DeclareSimpleMathOperator{Sym}
\DeclareSimpleMathOperator{supp}
\DeclareSimpleMathOperator{sgn}
\DeclareSimpleMathOperator{coker}
\DeclareSimpleMathOperator{rank}
\DeclareSimpleMathOperator{rk}
\DeclareSimpleMathOperator{Mat}
\DeclareSimpleMathOperator{ev}
\DeclareSimpleMathOperator{tr}
\DeclareSimpleMathOperator{GL}
\DeclareSimpleMathOperator{PGL}
%Algebra
\DeclareSimpleMathOperator{Quot}
\DeclareSimpleMathOperator{rad}
\DeclareSimpleMathOperator{Spec}
\DeclareSimpleMathOperator{Frac}
\DeclareSimpleMathOperator{Gal}
\DeclareSimpleMathOperator{Ext}
\DeclareSimpleMathOperator{Tor}
\DeclareSimpleMathOperator{MaxSpec}
\DeclareSimpleMathOperator{Sh}
\DeclareSimpleMathOperator{Proj}
\DeclareSimpleMathOperator{QCoh}
\DeclareSimpleMathOperator{Fun}
\DeclareSimpleMathOperator{ord}
\DeclareMathOperator{\Nil}{\mathcal{N}il}
\DeclareMathOperator{\Ouv}{\mathcal{O}uv}
\DeclareMathOperator{\PreSh}{Pre-Sh}
\newcommand{\tensor}{\otimes} %Synonym for tensoring
%Analysis
\DeclareSimpleMathOperator{dx}
\DeclareSimpleMathOperator{dy}
\DeclareSimpleMathOperator{dz}
\DeclareSimpleMathOperator{dt}
%Sets
\DeclareSimpleMathOperator{conv}
\DeclareSimpleMathOperator{dist}
\DeclareSimpleMathOperator{diam}
%%Stochastic (Algorithmische Mathematik II)
\DeclareDistribution{Bin}
\DeclareDistribution{Ber}
\DeclareDistribution{Geo}
\DeclareDistribution{Poi}
\DeclareDistribution{Unif}
\DeclareDistribution{Var}
\DeclareDistribution{Cov}
%Topology
\DeclareSimpleMathOperator{pr}
\def\twedge{\vee} % Semantically correct macros for wedge product
\def\tsmash{\wedge} % Semantically correct macro for smash product
\DeclareSimpleMathOperator{sing}
\DeclareSimpleMathOperator{cell}
%Category Theory
\DeclareSimpleMathOperator{Ob}
\DeclareSimpleMathOperator{Hom}
\DeclareSimpleMathOperator{Mor}
\DeclareSimpleMathOperator{End}
\DeclareSimpleMathOperator{colim}
%Set theory
\DeclareSimpleMathOperator{card}
\DeclareSimpleMathOperator{Cd}
\DeclareSimpleMathOperator{Ord}
\DeclareSimpleMathOperator{otp}
\DeclareSimpleMathOperator{Card}
%%Galoiskohomologie
\DeclareSimpleMathOperator{Br}
\DeclareSimpleMathOperator{EXT}
\DeclareSimpleMathOperator{Ind}
\DeclareSimpleMathOperator{Char}
\DeclareSimpleMathOperator{res}
\DeclareSimpleMathOperator{inf}
\DeclareSimpleMathOperator{cov}
\newcommand{\del}{\partial} % Semantically correct operator for boundary maps
%% Algebraic geometry
\DeclareSimpleMathOperator{eq}
\DeclareSimpleMathOperator{Idem}
\DeclareSimpleMathOperator{Supp}
\DeclareSimpleMathOperator{Ann}
\DeclareSimpleMathOperator{OC}
\DeclareSimpleMathOperator{red}
\DeclareSimpleMathOperator{can}
\DeclareSimpleMathOperator{Pic}
\newcommand\leftadjoint\vdash
\newcommand\rightadjoint\dashv
% Characteristic function
\newcommand*{\cfun}{\ensuremath{\mathbbm{1}}}
\newcommand*{\One}{\cfun}
%% such that in set declarations
\newcommand{\suchthat}{\;\middle|\;}
%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}
\newcommand\op{\text{op}}
\newcommand\opposite{^{\op}}
\newcommand\ab{\text{ab}}
\newcommand\abelianization{^{\ab}}
\NewDocumentCommand\set{m}
{
\left\{ #1 \right\}
}
%Taken from user egreg on
% https://tex.stackexchange.com/a/22255
\newcommand\frestriction[2]{{% we make the whole thing an ordinary symbol
\left.\kern-\nulldelimiterspace % automatically resize the bar with \right
#1 % the function
\vphantom{\big|} % pretend it's a little taller at normal size
\right|_{#2} % this is the delimiter
}}
\newcommand\directlimit{\varinjlim}
\newcommand\inverselimit{\varprojlim}
\DeclareMathOperator*{\freeproduct}{\raisebox{-0.5ex}{\scalebox{2}{$\ast$}}}