From 04a322a54cd1b37c0f59d785a688db9c3f4dfe75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 9 Sep 2021 18:15:10 +0200 Subject: [PATCH] first restructuring approach: sorted packages --- lang-input.sty | 10 ++ mkessler-math.sty | 67 +++++--------- mkessler-operators.sty | 204 +++++++++++++++++++++++------------------ removed.sty | 16 +++- 4 files changed, 160 insertions(+), 137 deletions(-) diff --git a/lang-input.sty b/lang-input.sty index 4ee0ff6..db1d407 100644 --- a/lang-input.sty +++ b/lang-input.sty @@ -6,7 +6,17 @@ \RequirePackage{lmodern} % Use latin modern font \RequirePackage{anyfontsize} % Provides \fontsize{...}{...}\selectfont \RequirePackage{soul} % Hyphenation, crossing \ldots +\RequirePackage{microtype} % Hyphenation, character protrusion, font expansion + +% Layout +\RequirePackage{parskip} % Leave blank line instead of indenting paragraphs +\RequirePackage{onehalfspacing} +\RequirePackage{changepage} % Change page layout in middle of document + +\RequirePackage{tabto} % Tabulators % Language support \RequirePackage[\ifenglish english \else ngerman\fi]{babel} +%Referencation +\RequirePackage{lastpage} %\pageref{LastPage} for reference on the last page diff --git a/mkessler-math.sty b/mkessler-math.sty index 49170fd..722fa40 100644 --- a/mkessler-math.sty +++ b/mkessler-math.sty @@ -2,15 +2,10 @@ \ProvidesPackage{mkessler-math}[2021/03/31 - Math package] %%%%%%Provides the basic math packages used for my lecture-note write-ups -%The language to pass to babel -\newif\ifenglish\englishtrue -\DeclareOption{german}{\englishfalse} -\DeclareOption{english}{\englishtrue} - -%If beamer shall be activated -\newif\ifbeamer\beamerfalse -\DeclareOption{beamer}{\beamertrue} -\DeclareOption{nobeamer}{\beamerfalse} +\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 @@ -40,7 +35,6 @@ \newunicodechar{ψ}{\ensuremath\psi} \newunicodechar{ω}{\ensuremath\omega} -\RequirePackage{etoolbox} \RequirePackage{amsmath} \RequirePackage{mathtools} \RequirePackage{amsthm} @@ -48,9 +42,6 @@ \RequirePackage{latexsym} \RequirePackage{mathrsfs} -\ifbeamer\else -\RequirePackage[shortlabels]{enumitem} -\fi \RequirePackage{pgfplots} % Plots \pgfplotsset{compat=1.7} @@ -60,45 +51,30 @@ \RequirePackage{tikz-cd} %Commutative diagrams + %%for small diagrams, similar to tikz-cd -\usepackage{xy} % for small diagrams, e.g. arrows -\xyoption{all} - - - - -%%Theorems needed in any case (fancy or not fancy theorems) +\usepackage[all]{xy} % for small diagrams, e.g. arrows +%%% In older versions, you found +% \usepackage{xy} +% \xyoption{all} +% here, but this messes with the catcode of the @ sign (which no package should do!) +% so that further parts in this package would get broken % Für Formeln \RequirePackage{mathabx} \RequirePackage{faktor} -\RequirePackage[mathscr]{eucal} - -\RequirePackage{blindtext} -\RequirePackage{tabto} -\RequirePackage{lastpage} %\pageref{LastPage} for reference on the last page - -% Für Tabulatoren - -\RequirePackage{pdfpages} % PDF-Dateien einbinden - -% Für Zeilenumbruch -\RequirePackage{microtype} -\RequirePackage{changepage} - +\RequirePackage[mathscr]{eucal} % \mathscr for another calligraphic alphabet \RequirePackage{esint} \RequirePackage{IEEEtrantools} + \RequirePackage[ngerman,ruled,vlined]{algorithm2e} %%% Custom commands -%%Load additional operators -\RequirePackage{mkessler-operators} - %Short commands for \mathbb{} \newcommand{\C}{\ensuremath{\mathbb{C}}} \newcommand{\F}{\ensuremath{\mathbb{F}}} @@ -115,14 +91,12 @@ %Norm and absolute value %Make them scaling by default and have \abs*{} as the non-scaling version of the command \DeclarePairedDelimiter\abs{\lvert}{\rvert} -\makeatletter \let\oldabs\abs \def\abs{\@ifstar{\oldabs}{\oldabs*}} \DeclarePairedDelimiter\norm{\lVert}{\rVert} \let\oldnorm\norm \def\norm{\@ifstar{\oldnorm}{\oldnorm*}} -\makeatother %%%Fixes of common misbehaviour @@ -132,14 +106,15 @@ % Always put limits under \limit \let\oldlim\lim\def\lim{\oldlim\limits} -\newcommand{\emphasize}[1]{{\color{red} #1}} - -%For setting counters of itemns in \enemerate -\makeatletter -\newcommand\setItemnumber[1]{\setcounter{enum\romannumeral\@enumdepth}{\numexpr#1-1\relax}} -\makeatother - +\RequirePackage[mathscr]{eucal} % \mathscr alphabet +\newcommand{\cat}[1]{ \mathscr{#1} } +\if@mkessler@math@english + \RequirePackage[english]{mkessler-operators} +\else + \RequirePackage[german]{mkessler-operators} +\fi + diff --git a/mkessler-operators.sty b/mkessler-operators.sty index 16540a4..7ea5070 100644 --- a/mkessler-operators.sty +++ b/mkessler-operators.sty @@ -1,104 +1,133 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mkessler-operators}[2021-04-27 - Operator Package] -%%%%%%%%%%%%%%%%%%mmmm +%%%%%%%%%%%%%%%%% %Provides some commonly used Operators used in the write-ups of my lecture notes - -\newif\ifenglish\englishtrue -\DeclareOption{german}{\englishfalse} -\DeclareOption{english}{\englishtrue} +\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 -%Packages +%%%%%Package dependencies \RequirePackage{amsmath} +\RequirePackage{bbm} + + +%%%%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}}} + %%%%%%%%%%% Operators %Basic commands -\renewcommand\subset\subseteq -\renewcommand\supset\supseteq -\DeclareMathOperator{\id}{id} -\DeclareMathOperator{\im}{im} -\DeclareMathOperator{\Bild}{Bild} -\DeclareMathOperator{\dom}{dom} -\DeclareMathOperator{\Span}{Span} -\DeclareMathOperator{\Aut}{Aut} -\let\ggT\relax\DeclareMathOperator{\ggT}{\ifenglish gcd \else ggT\fi} -\let\kgV\relax\DeclareMathOperator{\kgV}{\ifenglish lcm \elese kgV\fi} -\DeclareMathOperator{\rhs}{RHS} %Right hand side -\DeclareMathOperator{\lhs}{LHS} %Left hand side +\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} %Complex numbers -\DeclareMathOperator{\Impart}{Im} -\renewcommand\Im\Impart -\DeclareMathOperator{\Repart}{Re} -\renewcommand\Re\Repart +\DeclareMathOperator{\mkessler@impart}{Im} +\renewcommand\Im\mkessler@impart +\DeclareMathOperator{\mkessler@repart}{Re} +\renewcommand\Re\mkessler@impart %Linear Algebra -\DeclareMathOperator{\Sym}{Sym} -\DeclareMathOperator{\supp}{supp} -\DeclareMathOperator{\sgn}{sgn} -\DeclareMathOperator{\coker}{coker} -\DeclareMathOperator{\rank}{rank} -\DeclareMathOperator{\Mat}{Mat} -\DeclareMathOperator{\ev}{ev} +\DeclareSimpleMathOperator{Sym} +\DeclareSimpleMathOperator{supp} +\DeclareSimpleMathOperator{sgn} +\DeclareSimpleMathOperator{coker} +\DeclareSimpleMathOperator{rank} +\DeclareSimpleMathOperator{Mat} +\DeclareSimpleMathOperator{ev} %Algebra -\DeclareMathOperator{\Quot}{Quot} -\DeclareMathOperator{\Gal}{Gal} -\DeclareMathOperator{\Ext}{Ext} -\DeclareMathOperator{\Tor}{Tor} -\DeclareMathOperator{\Mspec}{MaxSpec} -\DeclareMathOperator{\Sh}{Sh} -\DeclareMathOperator{\Proj}{Proj} -\DeclareMathOperator{\QCoh}{QCoh} -\DeclareMathOperator{\MaxSpec}{MaxSpec} -\DeclareMathOperator{\Presh}{Pre-Sh} -\DeclareMathOperator{\Fun}{Fun} -\newcommand{\tensor}{\otimes} +\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 %Analysis -\DeclareMathOperator{\dx}{dx} -\DeclareMathOperator{\dy}{dy} -\DeclareMathOperator{\dz}{dz} -\DeclareMathOperator{\dt}{dt} +\DeclareSimpleMathOperator{dx} +\DeclareSimpleMathOperator{dy} +\DeclareSimpleMathOperator{dz} +\DeclareSimpleMathOperator{dt} %Sets -\DeclareMathOperator{\conv}{conv} -\DeclareMathOperator{\dist}{dist} -\DeclareMathOperator{\diam}{diam} +\DeclareSimpleMathOperator{conv} +\DeclareSimpleMathOperator{dist} +\DeclareSimpleMathOperator{diam} %%Stochastic (Algorithmische Mathematik II) -\newcommand\distribution[1]{\operatorname{#1}} -\newcommand\DeclareDistribution[1]{\expandafter\def\csname #1\endcsname{\distribution{#1}}} \DeclareDistribution{Bin} \DeclareDistribution{Ber} \DeclareDistribution{Geo} \DeclareDistribution{Poi} \DeclareDistribution{Unif} -\DeclareMathOperator{\Var}{Var} -\DeclareMathOperator{\Cov}{Cov} +\DeclareDistribution{Var} +\DeclareDistribution{Cov} %Topology -\DeclareMathOperator\pr{pr} -\def\twedge{\vee} -\def\tsmash{\wedge} +\DeclareSimpleMathOperator{pr} +\def\twedge{\vee} % Semantically correct macros for wedge product +\def\tsmash{\wedge} % Semantically correct macro for smash product %Category Theory -\DeclareMathOperator{\Ob}{Ob} -\newcommand{\cat}[1]{ \mathscr{#1} } -\DeclareMathOperator{\Hom}{Hom} -\DeclareMathOperator{\Mor}{Mor} -\DeclareMathOperator{\End}{End} -\DeclareMathOperator{\opposite}{\textbf{opp}} -\DeclareMathOperator{\abelian}{\textbf{ab}} -\newcommand{\ab}{^{\abelian}} -\newcommand\opp{^{\opposite}} -\newcommand\op{^{\opposite}} +\DeclareSimpleMathOperator{Ob} +\DeclareSimpleMathOperator{Hom} +\DeclareSimpleMathOperator{Mor} +\DeclareSimpleMathOperator{End} %Categories -\newcommand\category[1]{\operatorname{\textbf{#1}}} -\newcommand\DeclareCategory[1]{\expandafter\def\csname #1\endcsname{\category{#1}}} \DeclareCategory{Top} \DeclareCategory{hTop} \DeclareCategory{Set} @@ -110,31 +139,28 @@ \DeclareCategory{Fin} \DeclareCategory{Ab} \DeclareCategory{Cat} -\DeclareMathOperator{\colim}{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 % Characteristic function \newcommand*{\cfun}{\ensuremath{\mathbbm{1}}} -\newcommand*{\One}{\ensuremath{\mathbbm{1}}} +\newcommand*{\One}{\cfun} - -%Set theory -\DeclareMathOperator\card{card} -\DeclareMathOperator\Cd{Cd} -\DeclareMathOperator\Ord{Ord} -\DeclareMathOperator\otp{otp} -\DeclareMathOperator\Card{Card} - - - - -%%Galoiskohomologie -\DeclareMathOperator{\Br}{Br} -\newcommand{\del}{\partial} -\DeclareMathOperator{\EXT}{EXT} -\DeclareMathOperator{\Ind}{Ind} -\DeclareMathOperator{\Char}{char} -\DeclareMathOperator{\res}{res} -\DeclareMathOperator{\infl}{inf} -\DeclareMathOperator{\cov}{cov} +%Possibly destructive commands +\renewcommand\subset\subseteq +\renewcommand\supset\supseteq diff --git a/removed.sty b/removed.sty index 1419492..0ffdf56 100644 --- a/removed.sty +++ b/removed.sty @@ -1,5 +1,3 @@ - - %%%% Bibliography \RequirePackage[backend=biber,style=alphabetic]{biblatex} @@ -10,8 +8,22 @@ %%%% Utilities \RequirePackage{comment} %comments \RequirePackage{todo} % todo notes +\RequirePackage{blindtext} % \blindtext filling \RequirePackage[export]{adjustbox} % +\RequirePackage{pdfpages} % Include external PDF files easily + +% only load enumitem if beamer class has not been loaded +% This is based on the internal command beamer@tempdim that beamer.sty defines +\RequirePackage{etoolbox} +\ifdef{\beamer@tempdim}{}{ + \RequirePackage[shortlabels]{enumitem} +} +\RequirePackage[mathscr]{eucal} % \mathscr alphabet +\newcommand{\cat}[1]{ \mathscr{#1} } + +\newcommand{\emphasize}[1]{{\color{red} #1}} + %%% Figures \RequirePackage{caption} % Caption in minipages