Changed genericAlgorithm definition to make it usable outside figures
This commit is contained in:
parent
3b4e0e885f
commit
e2267929c2
@ -154,7 +154,13 @@
|
|||||||
% Generic algorithm environment allowing for pseudocode and mathematical expressions
|
% Generic algorithm environment allowing for pseudocode and mathematical expressions
|
||||||
% Source: https://tex.stackexchange.com/a/218450 (taken from source and modified)
|
% 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
|
% defines a new caption label as Algorithm x.y
|
||||||
\DeclareCaptionLabelFormat{algocaption}{Algorithm \thenalg}
|
\DeclareCaptionLabelFormat{algocaption}{Algorithm \thenalg}
|
||||||
|
|
||||||
@ -170,10 +176,12 @@
|
|||||||
basicstyle=\normalfont,
|
basicstyle=\normalfont,
|
||||||
columns=fullflexible,
|
columns=fullflexible,
|
||||||
keywordstyle=\color{black}\bfseries,
|
keywordstyle=\color{black}\bfseries,
|
||||||
% For some reason the first and last entries seem to be ingored
|
keywords={,for, while, end, do, nd, or, return, if,}
|
||||||
keywords={a, for, while, end, do, nd, or, return, if, b}
|
|
||||||
numbers=left,
|
numbers=left,
|
||||||
xleftmargin=.04\textwidth,
|
xleftmargin=.04\textwidth,
|
||||||
|
captionpos=b,
|
||||||
|
belowskip=1.5em,
|
||||||
|
aboveskip=1.5em,
|
||||||
#1 % This is to add custom settings
|
#1 % This is to add custom settings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user