made alg, set and interval nicer

This commit is contained in:
Never Gude 2026-06-05 19:54:37 +02:00
parent 615d146c20
commit af15fec3f8
2 changed files with 41 additions and 13 deletions

View file

@ -29,7 +29,7 @@
% Use sansfont for all title elements % Use sansfont for all title elements
\addtokomafont{titlehead}{\sffamily} \addtokomafont{titlehead}{\sffamily}
\addtokomafont{subject}{\normalfont \sffamily \itshape} \addtokomafont{subject}{\sffamily}
\addtokomafont{title}{\sffamily} \addtokomafont{title}{\sffamily}
\addtokomafont{subtitle}{\sffamily} \addtokomafont{subtitle}{\sffamily}
\addtokomafont{author}{\sffamily} \addtokomafont{author}{\sffamily}
@ -44,7 +44,7 @@
% Let points of an exercise be printed as in: [__ / 2] % Let points of an exercise be printed as in: [__ / 2]
\newkomafont{points}{\sffamily} \newkomafont{points}{\sffamily}
\newcommand\points[2][\quad]{\marginline{\framebox{{\usekomafont{points}#1 \textbf{/} #2}}}} \newcommand\points[2][1em]{\marginline{\framebox{{\usekomafont{points} \hspace{#1} \textbf{/} #2}}}}
\newcounter{task} \newcounter{task}
\renewcommand{\thetask}{\@alph\c@task)} \renewcommand{\thetask}{\@alph\c@task)}

View file

@ -1,5 +1,5 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ngutils}[2025/12/24 Never's LaTeX utils] \ProvidesPackage{ngutils}[2026/06/05 Never's LaTeX utils]
\RequirePackage[ngerman]{babel} \RequirePackage[ngerman]{babel}
\RequirePackage{graphicx} \RequirePackage{graphicx}
@ -16,7 +16,7 @@
basicstyle=\normalfont, basicstyle=\normalfont,
identifierstyle=\scshape, identifierstyle=\scshape,
keywordstyle=\bfseries, keywordstyle=\bfseries,
keywords={, new, if, then, else, while, for, in, to, up, down, foreach, do, return}, keywords={, and, or, not, new, if, then, else, while, for, in, to, up, down, foreach, do, return},
commentstyle=\itshape, commentstyle=\itshape,
comment=[l]//, comment=[l]//,
delim=[is][\normalfont]{|}{|}, delim=[is][\normalfont]{|}{|},
@ -54,17 +54,45 @@
\newcommand{\braces}[1]{\left\{#1\right\}} \newcommand{\braces}[1]{\left\{#1\right\}}
\newcommand{\angled}[1]{\left\langle#1\right\rangle} \newcommand{\angled}[1]{\left\langle#1\right\rangle}
\newcommand{\tup}[1]{\parens{#1}} \newcommand{\suchthat}{\;\middle\vert\;}
\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{\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{\set}[2][]{
\ifx&#1&
\braces{#2}
\else
\braces{#1 \suchthat #2}
\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{\alg}[2]{{\normalfont\scshape#1}{\normalfont(#2)}}
\newcommand{\algt}[1]{{\normalfont\scshape#1}} \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}} \newcommand{\com}[1]{{\normalfont\itshape/\!\!/ #1}}
\newenvironment{algorithmic}[1][1em]{ \newenvironment{algorithmic}[1][1em]{