Changed genericAlgorithm definition to make it usable outside figures

This commit is contained in:
Andreas Tsouchlos 2023-04-09 18:06:28 +02:00
parent 3b4e0e885f
commit e2267929c2

View File

@ -154,7 +154,13 @@
% Generic algorithm environment allowing for pseudocode and mathematical expressions
% Source: https://tex.stackexchange.com/a/218450 (taken from source and modified)
%
% defines algorithm counter for chapter-level
\newcounter{nalg}
\let\OldChapter\chapter
\renewcommand{\chapter}{\setcounter{nalg}{1}\OldChapter}
%defines appearance of the algorithm counter
\renewcommand{\thenalg}{\thechapter .\arabic{nalg}}
% defines a new caption label as Algorithm x.y
\DeclareCaptionLabelFormat{algocaption}{Algorithm \thenalg}
@ -170,10 +176,12 @@
basicstyle=\normalfont,
columns=fullflexible,
keywordstyle=\color{black}\bfseries,
% For some reason the first and last entries seem to be ingored
keywords={a, for, while, end, do, nd, or, return, if, b}
keywords={,for, while, end, do, nd, or, return, if,}
numbers=left,
xleftmargin=.04\textwidth,
captionpos=b,
belowskip=1.5em,
aboveskip=1.5em,
#1 % This is to add custom settings
}
}