agt_exercise/übung_5/ngutils.sty
2026-05-23 23:08:56 +02:00

124 lines
3 KiB
TeX

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ngutils}[2025/12/24 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={, 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{\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{\Pe}{\mathrm{P}}
\newcommand{\NPe}{\mathrm{NP}}
\newcommand{\Oh}{\mathcal{O}}
\newcommand{\oh}{\scriptstyle{\mathcal{O}}}
\newcommand{\Eh}{\mathop{\mathrm{E}}}
\newcommand{\Var}{\mathop{\mathrm{Var}}}
\newcommand{\pot}{\mathop{\mathcal{P}}}
\newcommand{\argmax}{\mathop{\mathrm{arg\,max}}}
\newcommand{\argmin}{\mathop{\mathrm{arg\,min}}}
\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{\tup}[1]{\parens{#1}}
\newcommand{\ivl}[1]{\brackets{#1}}
\newcommand{\set}[1]{\braces{#1}}
\newcommand{\arr}[1]{\angled{#1}}
\newcommand{\abs}[1]{\lvert#1\rvert}
\newcommand{\norm}[1]{\lVert#1\rVert}
\newcommand{\ceil}[1]{\lceil#1\rceil}
\newcommand{\floor}[1]{\lfloor#1\rfloor}
\newcommand{\alg}[2]{{\normalfont\scshape#1}{\normalfont(#2)}}
\newcommand{\algt}[1]{{\normalfont\scshape#1}}
\newcommand{\com}[1]{{\normalfont\itshape/\!\!/ #1}}
\newenvironment{algorithmic}[1][1em]{
\begin{minipage}[t]{\textwidth}
\bfseries
\begin{tabbing}
\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\kill
}{%
\end{tabbing}
\end{minipage}
}
\newlength{\theoremskip}
\setlength{\theoremskip}{6em}
\newcommand{\theoremfont}{\normalfont\bfseries}
\newcommand{\definitionfont}{\normalfont\bfseries}
\newenvironment{theoremic}[2][\theoremfont]{
{#1 #2}
\hfill
\begin{minipage}[t]{\the\dimexpr\linewidth-\theoremskip\relax}
}{
\end{minipage}
}
\newenvironment{theorem}{
\begin{theoremic}{Satz.}
}{
\end{theoremic}
}
\newenvironment{lemma}{
\begin{theoremic}{Lemma.}
}{
\end{theoremic}
}
\newenvironment{proof}{
\begin{theoremic}{Beweis.}
}{
\end{theoremic}
}
\newenvironment{definition}{
\begin{theoremic}[\definitionfont]{Definition.}
}{
\end{theoremic}
}
\newenvironment{example}{
\begin{theoremic}[\definitionfont]{Beispiel.}
}{
\end{theoremic}
}