From e2267929c2057c6c6bc367f0e73a27284cc7dc27 Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Sun, 9 Apr 2023 18:06:28 +0200 Subject: [PATCH] Changed genericAlgorithm definition to make it usable outside figures --- latex/thesis/common.tex | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/latex/thesis/common.tex b/latex/thesis/common.tex index 857c79b..45694be 100644 --- a/latex/thesis/common.tex +++ b/latex/thesis/common.tex @@ -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 } }