%% 
%% This is file `alg.sty',
%% generated with the docstrip utility.
%% 
%% The original source files were:
%% 
%% alg.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% You are *not* allowed to modify this file.
%% 
%% You are *not* allowed to distribute this file.
%% For distribution of the original source see
%% the terms for copying and modification in the file  alg.dtx.
%% 
\def\filedate{18 August 1995}
%% File: alg.dtx  Copyright (c) 1995 Staffan Ulfberg
%% You may use this package freely, and also distribute it
%% provided that you don't change it, make any money off
%% it or pretend that you wrote it.
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{alg}
         [1995/06/19]
\RequirePackage{float, ifthen}
\newlength{\algmarginwidth}\setlength{\algmarginwidth}{.5in}
\newlength{\alglinenowidth}\setlength{\alglinenowidth}{1.2cm}
\newlength{\algtabwidth}\setlength{\algtabwidth}{.5cm}
\newlength{\alg@fromleft}
\newlength{\alg@tmplen}
\newsavebox{\alg@tmpbox}
\newcounter{alg@inmargin}\setcounter{alg@inmargin}{0}
\newcounter{algline}
\newboolean{alg@linenums}
\DeclareOption{english}{\def\alg@floatname{Algorithm}
                        \def\alg@listname{List of Algorithms}
                        \def\alg@descname{Description}
                        \def\alg@inputname{Input}
                        \def\alg@outputname{Output}}
\DeclareOption{american}{\def\alg@floatname{Algorithm}
                        \def\alg@listname{List of Algorithms}
                        \def\alg@descname{Description}
                        \def\alg@inputname{Input}
                        \def\alg@outputname{Output}}
\DeclareOption{swedish}{\def\alg@floatname{Algoritm}
                        \def\alg@listname{Algoritmer}
                        \def\alg@descname{Beskrivning}
                        \def\alg@inputname{Input}
                        \def\alg@outputname{Output}}
\ExecuteOptions{english}
\ProcessOptions
\newcommand\floatc@alg[2]{{\bfseries\rmfamily
   \hspace{\algmarginwidth}#1:} #2\par}
\newcommand\fs@alg{
   \let\@fs@capt\floatc@alg
   \def\@fs@pre{}\def\@fs@post{}\def\@fs@mid{\vspace{3pt}}
   \let\@fs@iftopcapt\iftrue}
\floatstyle{alg}
\newfloat{algorithmfloat}{h}{loa}
\floatname{algorithmfloat}{\alg@floatname}
\newcommand{\listofalgorithms}{\listof{algorithmfloat}{\alg@listname}}
\newenvironment{alg@margin} {
   \ifthenelse{\value{alg@inmargin}=0} {
       \advance\leftskip\algmarginwidth
       \advance\rightskip\algmarginwidth
       \alg@fromleft=\leftskip
   } {}
   \stepcounter{alg@inmargin}
   \parskip=0cm\parindent=0cm
} {%
   \addtocounter{alg@inmargin}{-1}%
   \ifthenelse{\value{alg@inmargin}=0} {%
      \advance\leftskip-\algmarginwidth%
      \advance\rightskip-\algmarginwidth%
   } {}%
}
\newenvironment{algorithm}[1][H] {
   \begin{algorithmfloat}[#1]\begin{alg@margin}
} {
   \end{alg@margin}\end{algorithmfloat}
}
\newenvironment{alg@tab}[1] {
   \ifthenelse{\value{alg@inmargin}=0} {\vskip\baselineskip}{}
   \begin{alg@margin}
   \let\\=\alg@cr
   \catcode`\^^M=10
   \setcounter{algline}{1}
   \advance\leftskip#1
   \alg@putlineno\ignorespaces
} {
   \setbox\alg@tmpbox=\lastbox
   \ifhbox\alg@tmpbox{\vskip-\baselineskip}\else\par\fi
   \end{alg@margin}
   \ifthenelse{\value{alg@inmargin}=0}{\vskip\baselineskip}{}
}
\newenvironment{algtab}[0][\alglinenowidth] {
   \setboolean{alg@linenums}{true}\begin{alg@tab}{#1}
} {\end{alg@tab}}
\newenvironment{algtab*}[0][0cm] {
   \setboolean{alg@linenums}{false}\begin{alg@tab}{#1}
} {\end{alg@tab}}
\newcommand{\alg@kill}{\setbox\alg@tmpbox=\lastbox%
   \ifvoid\alg@tmpbox\PackageError{alg}{Attempt to remove label
      in middle of line}\fi}
\newcommand{\algbegin}[0][\algtabwidth]{\advance\leftskip#1%
   \alg@kill\alg@putlineno\ignorespaces}
\newcommand{\algend}[0][\algtabwidth]{\advance\leftskip-1#1%
   \alg@kill\alg@putlineno\ignorespaces}
\newcommand{\alg@cr}{\par\refstepcounter{algline}\alg@putlineno%
   \ignorespaces}
\newcommand{\alg@putlineno}{%
   \ifthenelse{\boolean{alg@linenums}} {%
      \alg@putlabel{(\arabic{algline})}} {\alg@putlabel{}}}
\newcommand{\alg@putlabel}[1]{{%
      \alg@tmplen=\leftskip \advance\alg@tmplen-\alg@fromleft%
      \makebox[0cm][r]{\makebox[\alg@tmplen][l]{#1}}}}
\newcommand{\algdescript}[1]{\textbf{\alg@descname: }#1\par}
\newcommand{\alginout}[2]{\textbf{\alg@inputname: }#1\par
   \textbf{\alg@outputname: }#2\par}
\newcommand{\algname}[2]{\textsc{#1}(#2)\par}
\newcommand{\alglabel}[1]{%
   \ifthenelse{\boolean{alg@linenums}}{%
      \label{#1}}{\alg@kill\alg@putlabel{#1}}\ignorespaces}
\newcommand{\algref}[1]{\ifthenelse{\boolean{alg@linenums}}%
   {\ref{#1}}{#1}}
\newcommand{\algand}{\mbox{\textbf{and }}}
\newcommand{\algcall}[2]{\textsc{#1}(#2)}
\newcommand{\algcase}[1]{\algend\textbf{case} #1\\\algbegin}
\newcommand{\algdefault}{\algend\textbf{default}\\\algbegin}
\newcommand{\algelse}{\algend\textbf{else}\\\algbegin}
\newcommand{\algelsif}[1]{\algend\textbf{else if} #1\\\algbegin}
\newcommand{\algerror}{\textbf{error }}
\newcommand{\algfalse}{\mbox{\textbf{false }}}
\newcommand{\algforto}[2]{\textbf{for} #1 \textbf{to} #2\\\algbegin}
\newcommand{\algforeach}[1]{\textbf{foreach} #1\\\algbegin}
\newcommand{\alggoto}{\textbf{goto~}}
\newcommand{\algif}[1]{\textbf{if} #1\\\algbegin}
\newcommand{\algifthen}[2]{\textbf{if} #1 \textbf{then} #2\\}
\newcommand{\algifthenelse}[3]{\setbox\alg@tmpbox=
   \hbox{\textbf{if} #1 }\copy\alg@tmpbox\textbf{then} #2\\
   \settowidth{\alg@tmplen}{\box\alg@tmpbox}%
   \algbegin[\alg@tmplen]\textbf{else} #3\\ \algend[\alg@tmplen]}
\newcommand{\algnot}{\mbox{\textbf{not }}}
\newcommand{\algor}{\mbox{\textbf{or }}}
\newcommand{\algpardo}{\mbox{\textbf{pardo}}}
\newcommand{\algprint}{\textbf{print }}
\newcommand{\algrepeat}{\textbf{repeat}\\\algbegin}
\newcommand{\algreturn}{\textbf{return~}}
\newcommand{\algswitch}[1]{\textbf{switch} #1\\\algbegin}
\newcommand{\algtrue}{\mbox{\textbf{true }}}
\newcommand{\alguntil}[1]{\algend\textbf{until} #1\ \\}
\newcommand{\algwhile}[1]{\textbf{while} #1\\\algbegin}
\endinput
%% 
%% End of file `alg.sty'.