made alg, set and interval nicer
This commit is contained in:
parent
615d146c20
commit
af15fec3f8
2 changed files with 41 additions and 13 deletions
|
|
@ -1,5 +1,5 @@
|
|||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{ngutils}[2025/12/24 Never's LaTeX utils]
|
||||
\ProvidesPackage{ngutils}[2026/06/05 Never's LaTeX utils]
|
||||
|
||||
\RequirePackage[ngerman]{babel}
|
||||
\RequirePackage{graphicx}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
basicstyle=\normalfont,
|
||||
identifierstyle=\scshape,
|
||||
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,
|
||||
comment=[l]//,
|
||||
delim=[is][\normalfont]{|}{|},
|
||||
|
|
@ -54,17 +54,45 @@
|
|||
\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{\suchthat}{\;\middle\vert\;}
|
||||
|
||||
\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&
|
||||
\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}}
|
||||
|
||||
\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]{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue