use real files

This commit is contained in:
Maximilian Keßler 2021-08-26 13:41:40 +02:00
parent 6ca24d11a8
commit 12d74d299e
4 changed files with 1202 additions and 1 deletions

591
mkessler-fancythm.sty Normal file
View File

@ -0,0 +1,591 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-fancythm}[2021/04/27 - Theorem-Environment Package]
%%%%%%%%m
%Provides fancy theorem-like-environments usedd in the write-ups of my lecture nots
\newif\ifenglish\englishtrue
\newif\ifshowstars\showstarstrue
\newif\ifshowdaggers\showdaggerstrue
\newif\ifincludestars\includestarstrue
\newif\ifincludeoral\includeoraltrue
\newif\ifmarkoral\markoraltrue
\newif\iflecturenumbers\lecturenumberstrue
\newif\ifnumbersmallenvironmentswiththeorem\numbersmallenvironmentswiththeoremfalse
\newif\ifnumbersmallenvironments\numbersmallenvironmentsfalse
\newif\ifbeamer\beamerfalse
\newcommand{\fancythmlinewidth}{2pt}
\newcommand{\fancythmskipabove}{8pt}
%Sometimes lecturers don't number environments for no particular reason. For compatibility reasons, i also don't number these environments so that the numbers are the same as in the lecture to make them better referencable, but if you want to number all (theorem, lemma, corollary, definition), then use the 'truenumber' option (true because in my opinion they really should be numbered)
%Option to number ALL environments. This numbers examples, remarks, etc as well. I usually don't do that, but if you prefer it that way, use option 'numbersmallenvironments'
%Note also that if you put this option on, it does not matter wheter option 'lecturenumbers' ore 'truenumbers' was chosen, as anyway everything will be numbered. (ALL only applys to the environments that have colored boxes)
\RequirePackage{xkeyval}
%%These are two options to adjust the skipabove and the width of the left margin of theorem-like environments. Default values are 2pt and 8pt, but feel free to change them as you like.
\DeclareOptionX{linewidth}{\renewcommand\fancythmlinewidth{#1}}
\DeclareOptionX{fancythmskipabove}{\renewcommand{\fancythmskipabove}{#1}}
\define@choicekey*{mkesslerfancythm}{numbersmallenvironments}[\val\nr]{no,section,theorem}{%
\ifcase\nr\relax
\numbersmallenvironmentsfalse
\or
\numbersmallenvironmentstrue
%numbering small environments within sections is forbidden whilst using lecturenumbes
\iflecturenumbers
\numbersmallenvironmentswiththeoremtrue
\else
\numbersmallenvironmentswiththeoremfalse
\fi
\or
\numbersmallenvironmentstrue
\numbersmallenvironmentswiththeoremtrue
\fi
}
\define@choicekey*{mkesslerfancythm}{lecturenumbers}[\val\nr]{true,false}{%
\ifcase\nr\relax
\lecturenumberstrue
\else
\lecturenumbersfalse
\fi
}
\define@choicekey*{mkesslerfancythm}{showdaggers}[\val\nr]{true,false}{%
\ifcase\nr\relax
\showdaggerstrue
\else
\showdaggersfalse
\fi
}
\define@choicekey*{mkesslerfancythm}{ownenvironments}[\val\nr]{on, natural, off}{%
\ifcase\nr\relax
\includestarstrue
\showstarstrue
\or
\includestarstrue
\showstarsfalse
\or
\includestarsfalse
\showstarsfalse
\fi
}
\define@choicekey*{mkesslerfancythm}{oralremarks}[\val\nr]{on,natural,off}{%
\ifcase\nr\relax
\includeoraltrue
\markoraltrue
\or
\includeoraltrue
\markoralfalse
\or
\includeoralfalse
\fi
}
\DeclareOptionX{english}{\englishtrue}
\DeclareOptionX{german}{\englishfalse}
\DeclareOptionX{beamer}{\beamertrue}
\DeclareOptionX{showdaggers}{\setkeys{mkesslerfancythm}{showdaggers=#1}}
\DeclareOptionX{ownenvironments}{\setkeys{mkesslerfancythm}{ownenvironments=#1}}
\DeclareOptionX{oralremarks}{\setkeys{mkesslerfancythm}{oralremarks=#1}}
\DeclareOptionX{lecturenumbers}{\setkeys{mkesslerfancythm}{lecturenumbers=#1}}
\DeclareOptionX{numbersmallenvironments}{\setkeys{mkesslerfancythm}{numbersmallenvironments=#1}}
\DeclareOptionX*{\PackageWarning{mkesslerfancythm}{Unknown X \CurrentOption}}% For unknown options
\ProcessOptionsX*\relax
\RequirePackage{comment}
\begin{comment}
\DeclareOption{numbersmallenvironments}{\numbersmallenvironmentstrue\lecturenumbersfalse}
\end{comment}
%Required Packages
\RequirePackage{amsmath}
\RequirePackage{amsthm}
\RequirePackage{mdframed}
\RequirePackage{thmtools}
\RequirePackage{hyperref}
\RequirePackage[skins]{tcolorbox}
%\RequirePackage[usenames,svgnames,dvipsnames]{xcolor}
\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
%%mdframed styles
\mdfdefinestyle{mdredmarginandfill}{%
skipabove =\fancythmskipabove,
linecolor=red,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
backgroundcolor=red!8,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdorangemarginandfill}{%
skipabove =\fancythmskipabove,
linecolor=orange,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
backgroundcolor=orange!10,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdbluemarginandfill}{%
skipabove =\fancythmskipabove,
linecolor=blue,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
backgroundcolor=blue!7,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdgreenmargin}{%
skipabove =\fancythmskipabove,
linecolor=green!70!black,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdyellowmargin}{%
skipabove =\fancythmskipabove,
linecolor=yellow!80!orange,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdgraymargin}{%
skipabove =\fancythmskipabove,
linecolor=gray,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdvioletmarginandfill}{%
skipabove =\fancythmskipabove,
linecolor=violet,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
backgroundcolor=violet!7,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdvioletmargin}{%
skipabove =\fancythmskipabove,
linecolor=violet,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdredmarginbluefill}{%
skipabove =\fancythmskipabove,
linecolor=red,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
backgroundcolor=blue!7,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdredmargin}{%
skipabove =\fancythmskipabove,
linecolor=red,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdorangemarginbluefill}{%
skipabove =\fancythmskipabove,
linecolor=orange,
linewidth = \fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
backgroundcolor=blue!7,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdblackmarginandfill}{%
skipabove=\fancythmskipabove,
linecolor=black,
linewidth=\fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
backgroundcolor=violet!20!gray!20,
rightline=false,
topline=false,
bottomline=false
}
\mdfdefinestyle{mdblackmargin}{%
skipabove=\fancythmskipabove,
linecolor=black,
linewidth=\fancythmlinewidth,
leftmargin = 0cm,
rightmargin=0cm,
rightline=false,
topline=false,
bottomline=false
}
\declaretheoremstyle[
mdframed={style=mdredmarginandfill},
postheadspace={0.3em},
notefont=\mdseries
]{thmredmarginandfill}
\declaretheoremstyle[
mdframed={style=mdorangemarginbluefill},
postheadspace={0.3em},
notefont=\mdseries
]{thmorangemarginbluefill}
\declaretheoremstyle[
mdframed={style=mdorangemarginandfill},
postheadspace={0.3em},
notefont=\mdseries
]{thmorangemarginandfill}
\declaretheoremstyle[
mdframed={style=mdbluemarginandfill},
postheadspace={0.3em},
notefont=\mdseries
]{thmbluemarginandfill}
\declaretheoremstyle[
mdframed={style=mdgreenmargin},
postheadspace={0.3em},
notefont=\mdseries
]{thmgreenmargin}
\declaretheoremstyle[
mdframed={style=mdyellowmargin},
postheadspace={0.3em},
notefont=\mdseries
]{thmyellowmargin}
\declaretheoremstyle[
mdframed={style=mdgraymargin},
postheadspace={0.3em},
notefont=\mdseries
]{thmgraymargin}
\declaretheoremstyle[
mdframed={style=mdvioletmarginandfill},
postheadspace={0.3em},
notefont=\mdseries
]{thmvioletmarginandfill}
\declaretheoremstyle[
mdframed={style=mdredmargin},
postheadspace={0.3em},
notefont=\mdseries
]{thmredmargin}
\declaretheoremstyle[
mdframed={style=mdvioletmargin},
postheadspace={0.3em},
notefont=\mdseries
]{thmvioletmargin}
\declaretheoremstyle[
mdframed={style=mdredmarginbluefill},
postheadspace={0.3em},
notefont=\mdseries
]{thmredmarginbluefill}
\declaretheoremstyle[
mdframed={style=mdblackmarginandfill},
postheadspace={0.3em},
notefont=\mdseries
]{thmblackmarginandfill}
\declaretheoremstyle[
mdframed={style=mdblackmargin},
postheadspace={0.3em},
notefont=\mdseries
]{thmblackmargin}
%%Environments that are numbered by default have 3 versions:
% - the standard one, for numbering
% - one asterisk, to exclude them from numbering (because they were not numbered in the lecture) -> they will be numbered if 'truenmubers' option is set
% - two asterisks, for marking them as self-added, so they will not be numbered, but will receive a visual asterisk. -> They will be numbered if 'truenumbers' option is set
%Theorem
\RequirePackage{mfirstuc}
\RequirePackage{xifthen}
%%\makenumberedtheorem[german Name]{style}{Name}
\RequirePackage{xparse}
\declaretheorem[numberwithin=section]{dummy}
\declaretheorem[numberwithin=dummy]{smalldummy}
%\newcounter{dummy}
%\counterwithin{dummy}{section}
%\newcounter{smalldummy}
%\counterwithin{smalldummy}{dummy} % Make belowtheorem reset each time theorem resets
\NewDocumentCommand{\declarebigtheorem}{O{} O{} m m O{}}{
%First, store the name of the theorem in \theoremname
\ifenglish
\ifthenelse{\isempty{#2}}{\def\theoremname{#4}}{\def\theoremname{#2}}
\else
\ifthenelse{\isempty{#1}}{\def\theoremname{#4}}{\def\theoremname{#1}}
\fi
%Define the mane version of the theorem
\ifthenelse{\isempty{#5}}{\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, sibling = dummy]{#4}}{}
%Define the versions theorem*, theorem**, dtheorem
\iflecturenumbers
\ifnumbersmallenvironments
\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, sibling=smalldummy]{#4*}
\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifshowstars *\else\fi, sibling=smalldummy]{#4**}
\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifshowdaggers $^{\dagger}$\else\fi, sibling=smalldummy]{d#4}
\else
\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, numbered=no]{#4*}
\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifshowstars *\else\fi, numbered = no]{#4**}
\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifshowdaggers $^{\dagger}$\else\fi, numbered = no]{d#4}
\fi
\else
\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, sibling=dummy]{#4*}
\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifshowstars *\else\fi, sibling=dummy]{#4**}
\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifshowdaggers $^{\dagger}$\else\fi, sibling=dummy]{d#4}
\fi
\ifincludestars\else\renewenvironment{#4**}{\comment}{\endcomment}\fi
}
\NewDocumentCommand{\declaresmalltheorem}{O{} O{} m m}{
%Get the name of the theorem and store it in \theoremname
\ifenglish
\ifthenelse{\isempty{#2}}{\def\theoremname{#4}}{\def\theoremname{#2}}
\else
\ifthenelse{\isempty{#1}}{\def\theoremname{#4}}{\def\theoremname{#1}}
\fi
\ifnumbersmallenvironments
\ifnumbersmallenvironmentswiththeorem
\declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, sibling = smalldummy]{#4}
\declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifshowstars *\else\fi, sibling=smalldummy]{#4*}
\declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifshowdaggers $^{\dagger}$\else\fi, sibling=smalldummy]{d#4}
\else
\declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, sibling=dummy]{#4}
\declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifshowstars *\else\fi, sibling=dummy]{#4*}
\declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifshowdaggers $^{\dagger}$\else\fi, sibling=dummy]{d#4}
\fi
\else
\declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, numbered = no]{#4}
\declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifshowstars *\else\fi, numbered = no]{#4*}
\declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifshowdaggers $^{\dagger}$\else\fi, numbered = no]{d#4}
\fi
\declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, sibling=dummy]{n#4}
\ifincludestars\else\renewenvironment{#4*}{\comment}{\endcomment}\fi
}
%Theorem
\declaretheorem[style=thmredmarginandfill,name=\ifenglish Theorem\else Satz\fi, sibling=dummy, refname = {Satz,Sätze}, Refname = {Satz,Sätze}]{theorem}
\AtBeginDocument{\def\theoremautorefname{\ifenglish Theorem \else Satz\fi}} %Make referencing of theorems work properly (in german) with \autoref
\declarebigtheorem[Satz][Theorem]{thmredmarginandfill}{theorem}[nomain]
%Other
\declarebigtheorem{thmredmarginandfill}{proposition}
\declarebigtheorem[Korollar]{thmredmarginandfill}{corollary}
\declarebigtheorem{thmorangemarginandfill}{lemma}
\declarebigtheorem[Lemma und Definition][Lemma and Definition]{thmorangemarginbluefill}{lemmadef}
\declarebigtheorem{thmbluemarginandfill}{definition}
\declarebigtheorem[Satz und Definition][Theorem and Definition]{thmredmarginbluefill}{theoremdef}
\declarebigtheorem[Proposition und Definition][Proposition and Definition]{thmredmarginbluefill}{propositiondef}
\declarebigtheorem{thmvioletmarginandfill}{notation}
%%%Environments that are not numbered by default (notation, question, example, remark etc) have two forms:
% - normal form: won't be numbered unless 'numbersmallenvironments' is set
% - having an asterisk: will be displayed with an asterisk, will be numbered if 'numbersmallenvironments' is set
%Notation
\declaresmalltheorem[Notationsmissbrauch][Abuse of Notation]{thmvioletmargin}{abuse}
\declaresmalltheorem[Beispiel]{thmgreenmargin}{example}
\declaresmalltheorem[Bemerkung]{thmyellowmargin}{remark}
\declaresmalltheorem[Trivial Nonsense][Trivial Nonsense]{thmyellowmargin}{trivial}
\declaresmalltheorem[Frage]{thmblackmarginandfill}{question}
\declaresmalltheorem[Organisatorisches][Organisational stuff]{thmblackmargin}{orga}
\declaresmalltheorem[Fakt]{thmredmargin}{fact}
\newcounter{blatt}
%\RequirePackage{savesym}
%\savesymbol{aside}
%\declaresmalltheorem[Nebenbemerkung]{thmgraymargin}{aside}
%\restoresymbol{Color}{aside}
%%Aufgaben environment to include exercises at the end of the documnt
%%%This is really a UGLY hack, since autoref actlly does not work properly, so we overwrite the autoref-name of itmes (!)
\declaretheorem[style = thmgreenmargin, numberwithin = blatt, name =Aufgabe]{aufgabe}
\newcommand\blatt{\refstepcounter{blatt}\subsection*{\theblatt. Übungsblatt}\addcontentsline{toc}{subsection}{\theblatt. Übungsblatt}}
\AtEndEnvironment{aufgabe}{\label{aufgabe-\theaufgabe}}
\AtBeginDocument{\def\itemautorefname{Aufgabe}}
%Oral remarks receive their own environment
\declaresmalltheorem[\ifmarkoral Mündliche Anmerkung\else Bemerkung\fi][\ifmarkoral Oral remark\else remark\fi]{thmyellowmargin}{oral}
\ifincludeoral\else
\renewenvironment{oral}{\comment}{\endcomment}
\renewenvironment{oral*}{\comment}{\endcomment}
\renewenvironment{doral}{\comment}{\endcomment}
\fi
%Proof (with asterisk)
\newenvironment{proof*}[1][\ifenglish Proof\else Beweis\fi]{\begin{proof}[#1\emph{*}]}{\end{proof}}
\newtcolorbox{recap}{before skip = 0.5cm, after skip = 0.5cm, enhanced, sharp corners = all, colback = white, colframe = gray, toprule=0pt, bottomrule=0pt, leftrule=0pt,rightrule=0pt, overlay = {
\draw[gray, line width = 2pt] (frame.north west) -- ++(0.5cm, 0pt);
\draw[gray, line width=2pt] (frame.south east) -- ++(-0.5cm, 0pt);
\draw[gray, line width=2pt] (frame.north west) -- ++ (0pt, -0.5cm);
\draw[gray, line width=2pt] (frame.south east) -- ++(0pt, 0.5cm);
}}
\def\restatableplaceholder{
\begin{recap}
Platzhalter, um einen anderen Satz zu wiederholen, der momentan nicht kompiliert wurde
\end{recap}
}
\theoremstyle{plain}
\ifbeamer\else\newtheorem{variant}{\ifenglish Variant\else Variante\fi}
\newtheorem{assumption}{\ifenglish Assumption\else Annahme\fi}
\fi
%%Give claim an own counter and let it reset at each proof
%See also at:
%https://tex.stackexchange.com/questions/283502/reset-counter-at-beginning-of-proof
\ifbeamer\else
\newtheorem{claim}{\ifenglish Claim\else Behauptung\fi}
\AtBeginEnvironment{proof}{\setcounter{claim}{0}}
\newtheorem*{claim*}{\ifenglish Claim\else Behauptung\fi}
\fi
\theoremstyle{definition}
\ifbeamer\else\newtheorem*{note}{\ifenglish Note\else Anmerkung\fi}\fi
\newtheorem*{warning}{\color{red}\ifenglish Warning \else Warnung\fi}
\ifbeamer\else\newtheorem*{goal}{\ifenglish Goal \else Ziel\fi}\fi
\newtheorem*{strategy}{\ifenglish Proof Strategy \else Beweisstrategie\fi}
\newtheorem*{goal*}{\ifenglish Goal* \else Ziel*\fi}
\newtheorem*{problem}{Problem}
\ifbeamer\else\newtheorem*{info}{Information}\fi
\newenvironment{moral}{%
\begin{mdframed}[linecolor=green!70!black]%
\bfseries\color{green!50!black}}%
{\end{mdframed}}
\ifbeamer\else\newtheorem*{answer}{\ifenglish Answer\else Antwort\fi}\fi
\newtheorem{observe}[theorem]{\ifenglish Observe\else Beobachte\fi}
\ifbeamer\else\newtheorem*{property}{\ifenglish Property\else Eigenschaft\fi}\fi
\ifbeamer\else\newtheorem*{intuition}{Intuition}\fi
\ifbeamer\else\newtheorem*{recall}{\ifenglish Recall\else Erinnerung\fi}\fi
\newtheorem*{idea}{\ifenglish Idea\else Idee\fi}
\ifbeamer\else\newtheorem{exercise}{\ifenglish Exercise\else Aufgabe\fi}[section]\fi
\newtheorem{reminder}{\ifenglish Reminder\else Erinnerung\fi}
%Numbering of environments with a fractional environment number, see
% https://tex.stackexchange.com/questions/598076/how-to-have-a-fractional-environment-number/598080?noredirect=1#comment1499689_598080
%However, for a reason i don't understand the posted answer does not work for me, but i had to replace theorem with definition in the definition of the gag environment (so apparently, i have to do this for each environment separately). It seems that the definitions of this document do use \thedefinition and not \thetheorem, although by default this is not the case.
\newcounter{gag}
\makeatletter
\newenvironment{gag}[1]{%
\let\savedthedefinition\thedefinition
\thm@headfont{\bfseries\boldmath}%
\stepcounter{gag}%
\renewcommand{\thedefinition}{\savedthedefinition#1}%
\renewcommand{\theHdefinition}{gag\thegag}%
\addtocounter{definition}{-1}\ignorespaces
}{\ignorespacesafterend}
\makeatother
%%subproof environment - essentially copied proof environment from amsthm and modified its name + symbol
\makeatletter
\DeclareRobustCommand{\blackqed}{%
\ifmmode \mathqed
\else
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\quad\hbox{$\blacksquare$}%
\fi
}
\newenvironment{subproof}[1][\ifenglish Subproof\else Unterbeweis\fi]{\par
\pushQED{\blackqed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
#1\@addpunct{.}]\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
\makeatother
%%Solution (for exercises)
\newenvironment{solution}[1][]{\begin{proof}[\ifenglish{}Solution\else{}Lösung\fi{}#1]}{\end{proof}}
\RequirePackage[ngerman, ruled, vlined]{algorithm2e}
%Make algorithm2e numbering alike with theorems
\usepackage{aliascnt}
\makeatletter
\let\c@algocf\relax
\makeatother
\newaliascnt{algocf}{theorem}
%Taken from
% https://github.com/gillescastel/university-setup/blob/master/preamble.tex
% Make boxes breakable
\tcbuselibrary{breakable}

193
mkessler-math.sty Normal file
View File

@ -0,0 +1,193 @@
\NeedsTeXFormat{LaTeX2e}
\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}
%Options for onehalf-spacing of lines
\newif\ifonehalfspacing\onehalfspacingfalse %default is normalspace
\DeclareOption{onehalfspacing}{\onehalfspacingtrue}
\DeclareOption{normalspacing}{\onehalfspacingfalse}
%Options for utf8 or utf8x - encoding
\newif\ifutf\utftrue %by default, utf8 is not enabled
\DeclareOption{utf8x}{\utffalse}
\DeclareOption{utf8}{\utftrue}
\DeclareOption*{\PackageWarning{mkessler-math}{Unknown '\CurrentOption'}}
\ProcessOptions\relax
\RequirePackage[\ifenglish english \else ngerman\fi]{babel}
\RequirePackage[T1]{fontenc}
% When using utf8x, we have to load ucs and inputenc with utf8x option and must exclude bibtex
% When not using utf8x (plan utf8), we must NOT load ucs, and then load inputenc with utf8-option as well as bibtex
% also, when using plain utf8, we want to load the newunicodechar package
\RequirePackage[\ifutf utf8\else utf8x\fi]{inputenc}
\ifutf
\RequirePackage{newunicodechar}
\newunicodechar{α}{\ensuremath\alpha}
\newunicodechar{β}{\ensuremath\beta}
\newunicodechar{γ}{\ensuremath\gamma}
\newunicodechar{δ}{\ensuremath\delta}
\newunicodechar{ε}{\ensuremath\epsilon}
\newunicodechar{ζ}{\ensuremath\zeta}
\newunicodechar{η}{\ensuremath\eta}
\newunicodechar{θ}{\ensuremath\theta}
\newunicodechar{ι}{\ensuremath\iota}
\newunicodechar{κ}{\ensuremath\kappa}
\newunicodechar{λ}{\ensuremath\lambda}
\newunicodechar{μ}{\ensuremath\mu}
\newunicodechar{ν}{\ensuremath\nu}
\newunicodechar{ξ}{\ensuremath\xi}
\newunicodechar{π}{\ensuremath\pi}
\newunicodechar{ρ}{\ensuremath\rho}
\newunicodechar{σ}{\ensuremath\sigma}
\newunicodechar{τ}{\ensuremath\tau}
\newunicodechar{υ}{\ensuremath\upsilon}
\newunicodechar{φ}{\ensuremath\phi}
\newunicodechar{χ}{\ensuremath\chi}
\newunicodechar{ψ}{\ensuremath\psi}
\newunicodechar{ω}{\ensuremath\omega}
\RequirePackage[backend=biber,style=alphabetic]{biblatex}
\RequirePackage{csquotes}
\else
\RequirePackage[mathletters]{ucs}
\fi
\RequirePackage{anyfontsize}
\RequirePackage{lmodern}
\RequirePackage{etoolbox}
\RequirePackage{amsmath}
\RequirePackage{mathtools}
\RequirePackage{amsthm}
\RequirePackage{amssymb}
\RequirePackage{comment}
\RequirePackage{soul}
\RequirePackage{caption}
\RequirePackage{subcaption}
\RequirePackage{latexsym}
\RequirePackage{mathrsfs}
\ifbeamer\else
\RequirePackage[shortlabels]{enumitem}
\fi
\RequirePackage{wrapfig}
%Pgfplots
\RequirePackage{pgfplots}
\pgfplotsset{compat=1.7}
% TIKZ
\RequirePackage{tikz}
\usetikzlibrary{calc, intersections, through, quotes, angles, babel, positioning, snakes}
%\RequirePackage{tkz-euclide}
\RequirePackage[export]{adjustbox}
%Commutative diagrams
\RequirePackage{tikz-cd}
%%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)
% 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}
%Für Zeilenabstand 1,5
\ifonehalfspacing
\RequirePackage[onehalfspacing]{setspace} \else
\fi
%For setting counters of itemns in \enemerate
\makeatletter
\newcommand\setItemnumber[1]{\setcounter{enum\romannumeral\@enumdepth}{\numexpr#1-1\relax}}
\makeatother
%Make circled symbols
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
%Print a warning sign
\newcommand\Warning{%
\makebox[1.4em][c]{%
\makebox[0pt][c]{\raisebox{.1em}{\small!}}%
\makebox[0pt][c]{\color{red}\Large$\bigtriangleup$}}}%
% Add \contra symbol to denote contradiction (from Gilles Castell)
\usepackage{stmaryrd} % for \lightning
\newcommand\contra{\scalebox{1.5}{$\lightning$}}
%\def\thevocab{}
%\newcommand{\vocab}[2][\thevocab]{\renewcommand\thevocab{#2}\textbf{\color{blue} #2}\index{#1}}
\newcommand{\emphasize}[1]{{\color{red} #1}}
%Short commands for \mathbb{}
\newcommand{\C}{\ensuremath{\mathbb{C}}}
\newcommand{\F}{\ensuremath{\mathbb{F}}}
\newcommand{\K}{\ensuremath{\mathbb{K}}}
\newcommand{\N}{\ensuremath{\mathbb{N}}}
\newcommand{\Q}{\ensuremath{\mathbb{Q}}}
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\newcommand{\Z}{\ensuremath{\mathbb{Z}}}
%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}
\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
\renewcommand{\degree}{^\circ}
%Used to start an exercise and resetting the equation number
%\newcommand{\nr}[1]{\setcounter{equation}{0}\section*{\ifenglish Exercise \else Aufgabe \fi #1}~}
\RequirePackage{esint}
\RequirePackage{IEEEtrantools}
\RequirePackage[ngerman,ruled,vlined]{algorithm2e}
%%Load additional operators
\RequirePackage{mkessler-operators}

136
mkessler-operators.sty Normal file
View File

@ -0,0 +1,136 @@
\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}
\DeclareOption*{\PackageWarning{mkessler-operators}{Unknown '\CurrentOption'}}
\ProcessOptions\relax
%Packages
\RequirePackage{amsmath}
%%%%%%%%%%% 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
%Complex numbers
\DeclareMathOperator{\Impart}{Im}
\renewcommand\Im\Impart
\DeclareMathOperator{\Repart}{Re}
\renewcommand\Re\Repart
%Linear Algebra
\DeclareMathOperator{\Sym}{Sym}
\DeclareMathOperator{\supp}{supp}
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\coker}{coker}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\Mat}{Mat}
\DeclareMathOperator{\ev}{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}
%Analysis
\DeclareMathOperator{\dx}{dx}
\DeclareMathOperator{\dy}{dy}
\DeclareMathOperator{\dz}{dz}
\DeclareMathOperator{\dt}{dt}
%Sets
\DeclareMathOperator{\conv}{conv}
\DeclareMathOperator{\dist}{dist}
\DeclareMathOperator{\diam}{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}
%Topology
\DeclareMathOperator\pr{pr}
\def\twedge{\vee}
\def\tsmash{\wedge}
%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}}
%Categories
\newcommand\category[1]{\operatorname{\textbf{#1}}}
\newcommand\DeclareCategory[1]{\expandafter\def\csname #1\endcsname{\category{#1}}}
\DeclareCategory{Top}
\DeclareCategory{hTop}
\DeclareCategory{Set}
\DeclareCategory{CHaus}
\DeclareCategory{Grp}
\DeclareCategory{Ab}
\DeclareCategory{CRing}
\DeclareCategory{Vect}
\DeclareCategory{Fin}
\DeclareCategory{Ab}
\DeclareCategory{Cat}
\DeclareMathOperator{\colim}{colim}
% Characteristic function
\newcommand*{\cfun}{\ensuremath{\mathbbm{1}}}
\newcommand*{\One}{\ensuremath{\mathbbm{1}}}
%Set theory
\DeclareMathOperator\card{card}
\DeclareMathOperator\Cd{Cd}
\DeclareMathOperator\Ord{Ord}
\DeclareMathOperator\otp{otp}
\DeclareMathOperator\Card{Card}
%%Galoiskohomologie
\DeclareMathOperator{\Br}{Br}
\newcommand{\del}{\partial}

View File

@ -1 +0,0 @@
/home/maximilian/Uni/semester-4/.packages/mkessler-script.cls

282
mkessler-script.cls Normal file
View File

@ -0,0 +1,282 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mkessler-script}[2021/03/31 Write up lecture notes as script]
%%%%Options of the package
\newif\ifenglish\englishtrue
\DeclareOption{english}{\englishtrue}
\DeclareOption{german}{\englishfalse}
\newif\ifshowversion\showversiontrue
\DeclareOption{show version}{\showversiontrue}
\DeclareOption{hideversion}{\showversionfalse}
\ProcessOptions\relax
%%%%Define command to set metainformation of document
%Set the course
\def\@course{\ClassError{mkessler-script}{No \noexpand\course given}{See documentation for details}}%
\DeclareRobustCommand*{\course}[1]{\gdef\@course{#1}}
\def\@lecturer{\ClassError{mkessler-script}{No \noexpand\lecturer given}{See documentation for details}}%
\def\@lecturertitle{}
\DeclareRobustCommand*{\lecturer}[2][]{
\gdef\@lecturer{#2}
\gdef\@lecturertitle{\ifenglish Lecturer\else\ifthenelse{\isempty{#1}}{Dozent}{Dozentin}\fi}{}
}
%Set the assistant
\newif\ifprintassistant\printassistantfalse
\def\@assistant{}%
\def\@assistantitle{}
\DeclareRobustCommand*{\assistant}[2][]{
\printassistanttrue
\gdef\@assistant{#2}
\gdef\@assistanttitle{\ifenglish Assistant\else\ifthenelse{\isempty{#1}}{Assistent}{Assistentin}\fi}
}
%%%%Load base class article
\LoadClass{article}
%%%%Title
%Define layout of title using course, lecturer, assistant and author, and optionally the current time
\RequirePackage{xparse}
\RequirePackage{datetime}
\renewcommand\@maketitle{%
\newpage
\null
\vskip 2em%
\begin{center}%
\let \footnote \thanks
{\LARGE \@course \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\@lecturertitle \\
{\sc \@lecturer} \\
\end{tabular}\par
\ifprintassistant
\vskip 1em%
\begin{tabular}[t]{c}%
\@assistanttitle \\
{\sc \@assistant} \\
\end{tabular}\par
\fi
\vskip 1em%
\begin{tabular}[t]{c}%
\ifenglish Notes\else Mitschrift\fi \\
{\sc \@author} \\
\end{tabular}
\par}%
\ifshowversion
\vskip 3em%
\begin{tabular}[t]{c}%
{\small Version} \\
\today\,\currenttime
\end{tabular}\par
\fi
\vskip 4em%
\end{center}%
\par
\vskip 1.5em
}
%%%Document-specific features that are provided
%%%%Management of vocabulary and corresponding index
\RequirePackage{imakeidx}
\makeindex[columns=2, title=\ifenglish Index\else Stichwortverzeichnis\fi, intoc]
%Emphasize \vocabulary
\RequirePackage{xparse}
\RequirePackage{expl3}
\ExplSyntaxOn
\NewDocumentCommand{\vocab}{O{} m}{
\textbf{\color{blue} #2}
\ifthenelse{\isempty{#1}}{\index{\text_titlecase_first:n{#2}}}{\index{#1}}
}
\ExplSyntaxOff
%%%%Bibliography management
\RequirePackage[backend=biber,style=alphabetic]{biblatex}
\addbibresource{bibliography.bib}
\addbibresource{images.bib}
%Provide simpler commands to properly print image attributions and literature
\DeclareRobustCommand*{\printimageattributions}{
\def\imageattributionstitle{\ifenglish Image attributions \else Bildquellen\fi}
\phantomsection
\addcontentsline{toc}{section}{\imageattributionstitle}
\printbibliography[title={\imageattributionstitle}, type=image]
}
\DeclareRobustCommand*{\printliterature}{
\def\literaturetitle{\ifenglish Literature\else Literatur\fi}
\phantomsection
\addcontentsline{toc}{section}{\literaturetitle}
\printbibliography[title={\literaturetitle}, nottype=image]
}
%%%Hyperref and setup
\RequirePackage{hyperref} % Hyperlinks
\RequirePackage{amsmath} % Cleveref needs this
\RequirePackage{cleveref} % Better referencing
\hypersetup{colorlinks, citecolor=violet, urlcolor=blue!80!black, linkcolor=red!50!black, pdfauthor=\@author, pdftitle=\@course}
%%%The following is based on the repository
% https://github.com/gillescastel/university-setup
% but has been modified for own purposes. The original content is distributed under the following license:
%MIT License
%Copyright (c) 2019 Gilles Castel
%Permission is hereby granted, free of charge, to any person obtaining a copy
%of this software and associated documentation files (the "Software"), to deal
%in the Software without restriction, including without limitation the rights
%to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%copies of the Software, and to permit persons to whom the Software is
%furnished to do so, subject to the following conditions:
%
%The above copyright notice and this permission notice shall be included in all
%copies or substantial portions of the Software.
%
%THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%SOFTWARE.
% Some basic packages
\RequirePackage{url}
\RequirePackage{graphicx}
\RequirePackage{float}
% for wrapping text around figures
\RequirePackage{wrapfig}
%%This option is for now commented out, not sure what it does, but causes errors
%\pdfminorversion=7
% Don't indent paragraphs, leave some space between them
\RequirePackage{parskip}
% Hide page number when page is empty
\RequirePackage{emptypage}
% Put x \to \infty below \lim
\let\svlim\lim\def\lim{\svlim\limits}
%Make implies and impliedby shorter
\let\implies\Rightarrow
\let\impliedby\Leftarrow
\let\iff\Leftrightarrow
\let\epsilon\varepsilon
% Fix some spacing
% http://tex.stackexchange.com/questions/22119/how-can-i-change-the-spacing-before-theorems-with-amsthm
\def\thm@space@setup{%
\thm@preskip=\parskip \thm@postskip=0pt
}
%%%%%%%Setup of lectures and their summary
%Tocloft package for making a list of lectures
\RequirePackage{tocloft}
%Store name of the summary in a command to use it multiple times
\newcommand\listlecturename{\ifenglish Summary of lectures\else Übersicht der Vorlesungen\fi}
\newlistof{lecture}{lec}{\listlecturename} % Declare new list of lectures
%Settings how to print the summary
\renewcommand{\cftdot}{}
\renewcommand\cftlecturefont{\normalfont\bfseries}
\renewcommand\cftlecturepagefont{\normalfont\bfseries}
\renewcommand\cftlectitlefont{\Large\bfseries}
\renewcommand\cftbeforelectureskip{1em}
%Command to parse the date
\RequirePackage{xifthen}
\def\testdateparts#1{\dateparts#1\relax}
\def\dateparts#1 #2 #3 #4 #5\relax{
\marginpar{\small\textsf{\mbox{#1 #2 #3 #5}}}
}
%Define the main lecture command to start a new lecture
\def\@lectureprefix{\ifenglish Lecture\else Vorlesung\fi}
\def\@lecture{}%
\newcommand{\lecture}[3][]{
\refstepcounter{lecture}
%Store lecture name in the macro \@lecture
\ifthenelse{\isempty{#3}}{%
\def\@lecture{\@lectureprefix\, \thelecture}%
}{%
\def\@lecture{\@lectureprefix\, \thelecture: #3}%
}%
\marginpar{\small\textsf{\parbox{10em}{\@lectureprefix\, \thelecture \\#2}}}
%Add lecture as an entry to the lectures file
\addcontentsline{lec}{lecture}{\@lectureprefix\,\thelecture\,(#2)}
%If key words are provided, add the key words of the lecture below the entry
\ifthenelse{\isempty{#1}}{}{\addtocontents{lec}{\smallskip\hspace{1.5em}\protect\parbox{\dimexpr\textwidth-\@pnumwidth - 2em}{#1}}}
}
%Provide a command to show the summary of lectures
\DeclareRobustCommand*{\summaryoflectures}{
\phantomsection
\addcontentsline{toc}{section}{\listlecturename}
\thispagestyle{plain}
\listoflecture
}
%%%% These are the fancy headers
\RequirePackage{fancyhdr}
\pagestyle{fancy}
% LE: left even
% RO: right odd
% CE, CO: center even, center odd
% My name for when I print my lecture notes to use for an open book exam.
% \fancyhead[LE,RO]{Gilles Castel}
\fancyhead[RO,LE]{\@lecture} % Right odd, Left even
\fancyhead[RE,LO]{} % Right even, Left odd
\fancyfoot[RO,LE]{\thepage} % Right odd, Left even
\fancyfoot[RE,LO]{} % Right even, Left odd
\fancyfoot[C]{\leftmark} % Center
\makeatother
%%No fancy headers in the appendix (as there is no lecture)
\let\oldappendix\appendix
\renewcommand\appendix{
\oldappendix
\fancyhead[RO,LE]{}
\renewcommand{\headrulewidth}{0pt}
}
% Todonotes and inline notes in fancy boxes
\RequirePackage{todonotes}
% Figure support as explained in my blog post.
\RequirePackage{import}
\RequirePackage{xifthen}
\RequirePackage{pdfpages}
\RequirePackage{transparent}
\newcommand{\incfig}[1]{%
\def\svgwidth{\columnwidth}
\import{./figures/}{#1.pdf_tex}
}
% Fix some stuff
% %http://tex.stackexchange.com/questions/76273/multiple-pdfs-with-page-group-included-in-a-single-page-warning
\pdfsuppresswarningpagegroup=1