1 % ALGORITHM STYLE -- Released 8 April 1996
3 % Copyright -- 1994 Peter Williams
5 % E-mail pwil3058@bigpond.net.au
7 % This style file is free software; you can redistribute it and/or
8 % modify it under the terms of the GNU Lesser General Public
9 % License as published by the Free Software Foundation; either
10 % version 2 of the License, or (at your option) any later version.
12 % This style file is distributed in the hope that it will be useful,
13 % but WITHOUT ANY WARRANTY; without even the implied warranty of
14 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 % Lesser General Public License for more details.
17 % You should have received a copy of the GNU Lesser General Public
18 % License along with this style file; if not, write to the
19 % Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 % Boston, MA 02111-1307, USA.
22 \NeedsTeXFormat{LaTeX2e}
23 \ProvidesPackage{algorithm}
24 \typeout{Document Style `algorithm' - floating environment}
26 \RequirePackage{float}
27 \RequirePackage{ifthen}
28 \newcommand{\ALG@within}{nothing}
29 \newboolean{ALG@within}
30 \setboolean{ALG@within}{false}
31 \newcommand{\ALG@floatstyle}{ruled}
32 \newcommand{\ALG@name}{Algorithm}
33 \newcommand{\listalgorithmname}{List of \ALG@name s}
37 \DeclareOption{plain}{
38 \renewcommand{\ALG@floatstyle}{plain}
40 \DeclareOption{ruled}{
41 \renewcommand{\ALG@floatstyle}{ruled}
43 \DeclareOption{boxed}{
44 \renewcommand{\ALG@floatstyle}{boxed}
46 % then numbering convention
48 \renewcommand{\ALG@within}{part}
49 \setboolean{ALG@within}{true}
51 \DeclareOption{chapter}{
52 \renewcommand{\ALG@within}{chapter}
53 \setboolean{ALG@within}{true}
55 \DeclareOption{section}{
56 \renewcommand{\ALG@within}{section}
57 \setboolean{ALG@within}{true}
59 \DeclareOption{subsection}{
60 \renewcommand{\ALG@within}{subsection}
61 \setboolean{ALG@within}{true}
63 \DeclareOption{subsubsection}{
64 \renewcommand{\ALG@within}{subsubsection}
65 \setboolean{ALG@within}{true}
67 \DeclareOption{nothing}{
68 \renewcommand{\ALG@within}{nothing}
69 \setboolean{ALG@within}{true}
71 \DeclareOption*{\edef\ALG@name{\CurrentOption}}
76 \floatstyle{\ALG@floatstyle}
77 \ifthenelse{\boolean{ALG@within}}{
78 \ifthenelse{\equal{\ALG@within}{part}}
79 {\newfloat{algorithm}{htbp}{loa}[part]}{}
80 \ifthenelse{\equal{\ALG@within}{chapter}}
81 {\newfloat{algorithm}{htbp}{loa}[chapter]}{}
82 \ifthenelse{\equal{\ALG@within}{section}}
83 {\newfloat{algorithm}{htbp}{loa}[section]}{}
84 \ifthenelse{\equal{\ALG@within}{subsection}}
85 {\newfloat{algorithm}{htbp}{loa}[subsection]}{}
86 \ifthenelse{\equal{\ALG@within}{subsubsection}}
87 {\newfloat{algorithm}{htbp}{loa}[subsubsection]}{}
88 \ifthenelse{\equal{\ALG@within}{nothing}}
89 {\newfloat{algorithm}{htbp}{loa}}{}
91 \newfloat{algorithm}{htbp}{loa}
93 \floatname{algorithm}{\ALG@name}
95 \newcommand{\listofalgorithms}{\listof{algorithm}{\listalgorithmname}}