Added script front-end for primer-design code
[htsworkflow.git] / htswanalysis / MACS / lib / gsl / gsl-1.11 / doc / algorithmic.sty
1 % ALGORITHMIC STYLE -- Released 8 APRIL 1996
2 %    for LaTeX version 2e
3 % Copyright -- 1994 Peter Williams
4 % E-mail PeterWilliams@dsto.defence.gov.au
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{algorithmic}
7 \typeout{Document Style `algorithmic' - environment}
8 %
9 \RequirePackage{ifthen}
10 \RequirePackage{calc}
11 \newboolean{ALC@noend}
12 \setboolean{ALC@noend}{false}
13 \newcounter{ALC@line}
14 \newcounter{ALC@rem}
15 \newlength{\ALC@tlm}
16 %
17 \DeclareOption{noend}{\setboolean{ALC@noend}{true}}
18 %
19 \ProcessOptions
20 %
21 % ALGORITHMIC
22 \newcommand{\algorithmicrequire}{\textbf{Require:}}
23 \newcommand{\algorithmicensure}{\textbf{Ensure:}}
24 \newcommand{\algorithmiccomment}[1]{\{#1\}}
25 \newcommand{\algorithmicend}{\textbf{end}}
26 \newcommand{\algorithmicif}{\textbf{if}}
27 \newcommand{\algorithmicthen}{\textbf{then}}
28 \newcommand{\algorithmicelse}{\textbf{else}}
29 \newcommand{\algorithmicelsif}{\algorithmicelse\ \algorithmicif}
30 \newcommand{\algorithmicendif}{\algorithmicend\ \algorithmicif}
31 \newcommand{\algorithmicfor}{\textbf{for}}
32 \newcommand{\algorithmicforall}{\textbf{for all}}
33 \newcommand{\algorithmicdo}{\textbf{do}}
34 \newcommand{\algorithmicendfor}{\algorithmicend\ \algorithmicfor}
35 \newcommand{\algorithmicwhile}{\textbf{while}}
36 \newcommand{\algorithmicendwhile}{\algorithmicend\ \algorithmicwhile}
37 \newcommand{\algorithmicloop}{\textbf{loop}}
38 \newcommand{\algorithmicendloop}{\algorithmicend\ \algorithmicloop}
39 \newcommand{\algorithmicrepeat}{\textbf{repeat}}
40 \newcommand{\algorithmicuntil}{\textbf{until}}
41 \def\ALC@item[#1]{%
42 \if@noparitem \@donoparitem
43   \else \if@inlabel \indent \par \fi
44          \ifhmode \unskip\unskip \par \fi
45          \if@newlist \if@nobreak \@nbitem \else
46                         \addpenalty\@beginparpenalty
47                         \addvspace\@topsep \addvspace{-\parskip}\fi
48            \else \addpenalty\@itempenalty \addvspace\itemsep
49           \fi
50     \global\@inlabeltrue
51 \fi
52 \everypar{\global\@minipagefalse\global\@newlistfalse
53           \if@inlabel\global\@inlabelfalse \hskip -\parindent \box\@labels
54              \penalty\z@ \fi
55           \everypar{}}\global\@nobreakfalse
56 \if@noitemarg \@noitemargfalse \if@nmbrlist \refstepcounter{\@listctr}\fi \fi
57 \sbox\@tempboxa{\makelabel{#1}}%
58 \global\setbox\@labels
59  \hbox{\unhbox\@labels \hskip \itemindent
60        \hskip -\labelwidth \hskip -\ALC@tlm
61        \ifdim \wd\@tempboxa >\labelwidth
62                 \box\@tempboxa
63           \else \hbox to\labelwidth {\unhbox\@tempboxa}\fi
64        \hskip \ALC@tlm}\ignorespaces}
65 %
66 \newenvironment{algorithmic}[1][0]{
67 \let\@item\ALC@item
68   \newcommand{\ALC@lno}{%
69 \ifthenelse{\equal{\arabic{ALC@rem}}{0}}
70 {{\footnotesize \arabic{ALC@line}:}}{}%
71 }
72 \let\@listii\@listi
73 \let\@listiii\@listi
74 \let\@listiv\@listi
75 \let\@listv\@listi
76 \let\@listvi\@listi
77 \let\@listvii\@listi
78   \newenvironment{ALC@g}{
79     \begin{list}{\ALC@lno}{ \itemsep\z@ \itemindent\z@
80     \listparindent\z@ \rightmargin\z@ 
81     \topsep\z@ \partopsep\z@ \parskip\z@\parsep\z@
82     \leftmargin 1em
83     \addtolength{\ALC@tlm}{\leftmargin}
84     }
85   }
86   {\end{list}}
87   \newcommand{\ALC@it}{\addtocounter{ALC@line}{1}\addtocounter{ALC@rem}{1}\ifthenelse{\equal{\arabic{ALC@rem}}{#1}}{\setcounter{ALC@rem}{0}}{}\item}
88   \newcommand{\ALC@com}[1]{\ifthenelse{\equal{##1}{default}}%
89 {}{\ \algorithmiccomment{##1}}}
90   \newcommand{\REQUIRE}{\item[\algorithmicrequire]}
91   \newcommand{\ENSURE}{\item[\algorithmicensure]}
92   \newcommand{\STATE}{\ALC@it}
93   \newcommand{\COMMENT}[1]{\algorithmiccomment{##1}}
94   \newenvironment{ALC@if}{\begin{ALC@g}}{\end{ALC@g}}
95   \newenvironment{ALC@for}{\begin{ALC@g}}{\end{ALC@g}}
96   \newenvironment{ALC@whl}{\begin{ALC@g}}{\end{ALC@g}}
97   \newenvironment{ALC@loop}{\begin{ALC@g}}{\end{ALC@g}}
98   \newenvironment{ALC@rpt}{\begin{ALC@g}}{\end{ALC@g}}
99   \renewcommand{\\}{\@centercr}
100   \newcommand{\IF}[2][default]{\ALC@it\algorithmicif\ ##2\ \algorithmicthen%
101 \ALC@com{##1}\begin{ALC@if}}
102   \newcommand{\ELSE}[1][default]{\end{ALC@if}\ALC@it\algorithmicelse%
103 \ALC@com{##1}\begin{ALC@if}}
104   \newcommand{\ELSIF}[2][default]%
105 {\end{ALC@if}\ALC@it\algorithmicelsif\ ##2\ \algorithmicthen%
106 \ALC@com{##1}\begin{ALC@if}}
107   \newcommand{\FOR}[2][default]{\ALC@it\algorithmicfor\ ##2\ \algorithmicdo%
108 \ALC@com{##1}\begin{ALC@for}}
109   \newcommand{\FORALL}[2][default]{\ALC@it\algorithmicforall\ ##2\ %
110 \algorithmicdo%
111 \ALC@com{##1}\begin{ALC@for}}
112   \newcommand{\WHILE}[2][default]{\ALC@it\algorithmicwhile\ ##2\ %
113 \algorithmicdo%
114 \ALC@com{##1}\begin{ALC@whl}}
115   \newcommand{\LOOP}[1][default]{\ALC@it\algorithmicloop%
116 \ALC@com{##1}\begin{ALC@loop}}
117   \newcommand{\REPEAT}[1][default]{\ALC@it\algorithmicrepeat%
118 \ALC@com{##1}\begin{ALC@rpt}}
119   \newcommand{\UNTIL}[1]{\end{ALC@rpt}\ALC@it\algorithmicuntil\ ##1}
120   \ifthenelse{\boolean{ALC@noend}}{
121     \newcommand{\ENDIF}{\end{ALC@if}}
122     \newcommand{\ENDFOR}{\end{ALC@for}}
123     \newcommand{\ENDWHILE}{\end{ALC@whl}}
124     \newcommand{\ENDLOOP}{\end{ALC@loop}}
125   }{
126     \newcommand{\ENDIF}{\end{ALC@if}\ALC@it\algorithmicendif}
127     \newcommand{\ENDFOR}{\end{ALC@for}\ALC@it\algorithmicendfor}
128     \newcommand{\ENDWHILE}{\end{ALC@whl}\ALC@it\algorithmicendwhile}
129     \newcommand{\ENDLOOP}{\end{ALC@loop}\ALC@it\algorithmicendloop}
130   } 
131   \renewcommand{\@toodeep}{}
132   \begin{list}{\ALC@lno}{\setcounter{ALC@line}{0}\setcounter{ALC@rem}{0}%
133     \itemsep\z@ \itemindent\z@ \listparindent\z@%
134     \partopsep\z@ \parskip\z@ \parsep\z@%
135     \labelsep 0.5em \topsep 0.2em%
136 \ifthenelse{\equal{#1}{0}}
137   {\labelwidth 0.5em }
138   {\labelwidth  1.2em }
139 \leftmargin\labelwidth \addtolength{\leftmargin}{\labelsep}
140     \ALC@tlm\labelsep
141   }
142 }
143 {\end{list}}
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158