This commit is contained in:
Never Gude 2026-06-29 22:45:15 +02:00
parent 8b10c04ab2
commit 1da8b21a53
12 changed files with 391 additions and 0 deletions

109
übung_10/ngutils.sty Normal file
View file

@ -0,0 +1,109 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ngutils}[2026/06/05 Never's LaTeX utils]
\RequirePackage[ngerman]{babel}
\RequirePackage{graphicx}
\RequirePackage{tabularx}
\RequirePackage{booktabs}
\RequirePackage{listings}
\lstnewenvironment{pseudocode}[1][] %defines the algorithm listing environment
{
\renewcommand{\lstlistingname}{Algorithmus}
\lstset{ %this is the stype
mathescape=true,
columns=fullflexible,
basicstyle=\normalfont,
identifierstyle=\scshape,
keywordstyle=\bfseries,
keywords={, and, or, not, new, if, then, else, while, for, in, to, up, down, foreach, do, return},
commentstyle=\itshape,
comment=[l]//,
delim=[is][\normalfont]{|}{|},
tabsize=3,
frame=tb,
framerule=1pt,
#1 % this is to add specific settings to an usage of this environment (for instnce, the caption and referable label)
}
}
{}
\newcommand{\argmax}{\mathop{\mathrm{arg\,max}}}
\newcommand{\argmin}{\mathop{\mathrm{arg\,min}}}
\newcommand{\seilpmi}{\Longleftarrow}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\CC}{\mathbb{C}}
\newcommand{\PP}{\mathbb{P}}
\newcommand{\pot}{\mathcal{P}}
\newcommand{\REC}{\mathrm{REC}}
\newcommand{\RE}{\mathrm{RE}}
\newcommand{\EA}{\mathrm{EA}}
\newcommand{\DEA}{\mathrm{DEA}}
\newcommand{\NEA}{\mathrm{DEA}}
\newcommand{\Pe}{\mathrm{P}}
\newcommand{\NPe}{\mathrm{NP}}
\newcommand{\Oh}{\mathcal{O}}
\newcommand{\oh}{\mathcal{o}}
\newcommand{\indeg}{\mathrm{indeg}}
\newcommand{\outdeg}{\mathrm{outdeg}}
\newcommand{\Eh}{\mathrm{E}}
\newcommand{\Var}{\mathrm{Var}}
\newcommand{\parens}[1]{\left(#1\right)}
\newcommand{\brackets}[1]{\left[#1\right]}
\newcommand{\braces}[1]{\left\{#1\right\}}
\newcommand{\angled}[1]{\left\langle#1\right\rangle}
\newcommand{\suchthat}{\;\middle\vert\;}
\newcommand{\set}[1]{\braces{#1}}
\newcommand{\tup}[1]{\parens{#1}}
\newcommand{\interval}[2][b]{
\if\detokenize{a}\detokenize{#1}%
\left[#2\right[
\fi
\if\detokenize{b}\detokenize{#1}%
\left[#2\right]
\fi
\if\detokenize{c}\detokenize{#1}%
\left]#2\right[
\fi
\if\detokenize{d}\detokenize{#1}%
\left]#2\right]
\fi
}
\newcommand{\arr}[1]{\angled{#1}}
\newcommand{\abs}[1]{\left\vert#1\right\vert}
\newcommand{\norm}[1]{\left\Vert#1\right\Vert}
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\algt}[1]{{\normalfont\scshape#1}}
\makeatletter
\newcommand*{\alg@unstarred}[2]{{\normalfont\scshape#1}{\normalfont(#2)}}
\newcommand*{\alg@starred}[1]{{\normalfont\scshape#1}}
\newcommand*{\alg}{\@ifstar{\alg@starred}{\alg@unstarred}}
\makeatother
\newcommand{\com}[1]{{\normalfont\itshape/\!\!/ #1}}
\newenvironment{algorithmic}[1][1em]{
\begin{minipage}[t]{\dimexpr\linewidth}
\bfseries
\begin{tabbing}
\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\kill
}{%
\end{tabbing}
\end{minipage}
}