1 % ALGORITHM STYLE -- Released 8 April 1996
3 % Copyright -- 1994 Peter Williams
4 % E-mail Peter.Williams@dsto.defence.gov.au
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{algorithm}
7 \typeout{Document Style `algorithm' - floating environment}
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}
20 \DeclareOption{plain}{
21 \renewcommand{\ALG@floatstyle}{plain}
23 \DeclareOption{ruled}{
24 \renewcommand{\ALG@floatstyle}{ruled}
26 \DeclareOption{boxed}{
27 \renewcommand{\ALG@floatstyle}{boxed}
29 % then numbering convention
31 \renewcommand{\ALG@within}{part}
32 \setboolean{ALG@within}{true}
34 \DeclareOption{chapter}{
35 \renewcommand{\ALG@within}{chapter}
36 \setboolean{ALG@within}{true}
38 \DeclareOption{section}{
39 \renewcommand{\ALG@within}{section}
40 \setboolean{ALG@within}{true}
42 \DeclareOption{subsection}{
43 \renewcommand{\ALG@within}{subsection}
44 \setboolean{ALG@within}{true}
46 \DeclareOption{subsubsection}{
47 \renewcommand{\ALG@within}{subsubsection}
48 \setboolean{ALG@within}{true}
50 \DeclareOption{nothing}{
51 \renewcommand{\ALG@within}{nothing}
52 \setboolean{ALG@within}{true}
54 \DeclareOption*{\edef\ALG@name{\CurrentOption}}
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}}{}
74 \newfloat{algorithm}{htbp}{loa}
76 \floatname{algorithm}{\ALG@name}
78 \newcommand{\listofalgorithms}{\listof{algorithm}{\listalgorithmname}}