Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132928 views
License: OTHER
1
% ALGORITHM STYLE -- Released 8 April 1996
2
% for LaTeX-2e
3
% Copyright -- 1994 Peter Williams
4
% E-mail [email protected]
5
\NeedsTeXFormat{LaTeX2e}
6
\ProvidesPackage{algorithm}
7
\typeout{Document Style `algorithm' - floating environment}
8
9
\RequirePackage{float}
10
\RequirePackage{ifthen}
11
\newcommand{\ALG@within}{nothing}
12
\newboolean{ALG@within}
13
\setboolean{ALG@within}{false}
14
\newcommand{\ALG@floatstyle}{ruled}
15
\newcommand{\ALG@name}{Algorithm}
16
\newcommand{\listalgorithmname}{List of \ALG@name s}
17
18
% Declare Options
19
% first appearance
20
\DeclareOption{plain}{
21
\renewcommand{\ALG@floatstyle}{plain}
22
}
23
\DeclareOption{ruled}{
24
\renewcommand{\ALG@floatstyle}{ruled}
25
}
26
\DeclareOption{boxed}{
27
\renewcommand{\ALG@floatstyle}{boxed}
28
}
29
% then numbering convention
30
\DeclareOption{part}{
31
\renewcommand{\ALG@within}{part}
32
\setboolean{ALG@within}{true}
33
}
34
\DeclareOption{chapter}{
35
\renewcommand{\ALG@within}{chapter}
36
\setboolean{ALG@within}{true}
37
}
38
\DeclareOption{section}{
39
\renewcommand{\ALG@within}{section}
40
\setboolean{ALG@within}{true}
41
}
42
\DeclareOption{subsection}{
43
\renewcommand{\ALG@within}{subsection}
44
\setboolean{ALG@within}{true}
45
}
46
\DeclareOption{subsubsection}{
47
\renewcommand{\ALG@within}{subsubsection}
48
\setboolean{ALG@within}{true}
49
}
50
\DeclareOption{nothing}{
51
\renewcommand{\ALG@within}{nothing}
52
\setboolean{ALG@within}{true}
53
}
54
\DeclareOption*{\edef\ALG@name{\CurrentOption}}
55
56
% ALGORITHM
57
%
58
\ProcessOptions
59
\floatstyle{\ALG@floatstyle}
60
\ifthenelse{\boolean{ALG@within}}{
61
\ifthenelse{\equal{\ALG@within}{part}}
62
{\newfloat{algorithm}{htbp}{loa}[part]}{}
63
\ifthenelse{\equal{\ALG@within}{chapter}}
64
{\newfloat{algorithm}{htbp}{loa}[chapter]}{}
65
\ifthenelse{\equal{\ALG@within}{section}}
66
{\newfloat{algorithm}{htbp}{loa}[section]}{}
67
\ifthenelse{\equal{\ALG@within}{subsection}}
68
{\newfloat{algorithm}{htbp}{loa}[subsection]}{}
69
\ifthenelse{\equal{\ALG@within}{subsubsection}}
70
{\newfloat{algorithm}{htbp}{loa}[subsubsection]}{}
71
\ifthenelse{\equal{\ALG@within}{nothing}}
72
{\newfloat{algorithm}{htbp}{loa}}{}
73
}{
74
\newfloat{algorithm}{htbp}{loa}
75
}
76
\floatname{algorithm}{\ALG@name}
77
78
\newcommand{\listofalgorithms}{\listof{algorithm}{\listalgorithmname}}
79
80
81