/Publications/MScThesis/algorithm.sty

http://phd-workspace.googlecode.com/ · TeX · 96 lines · 65 code · 5 blank · 26 comment · 0 complexity · a7c3da45bdc852f53db3d2b02f2c1a1c MD5 · raw file

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