-
Notifications
You must be signed in to change notification settings - Fork 0
/
salgorithm.sty
54 lines (45 loc) · 1.79 KB
/
salgorithm.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% %%%%%%%%%%%%%%%%%%%% program macros %%%%%%%%%%%%%%%%%
\usepackage{color}
\newcommand{\Do}{{\small\bf do}\ }
\newcommand{\End}{{\small\bf end}\ }
\newcommand{\Return}{{\small\bf return\ }}
\newcommand{\Proc}[1]{#1\+}
\newcommand{\Returns}{{\small\bf returns}}
\newcommand{\Procbegin}{{\small\bf begin}}
\newcommand{\If}{{\small\bf if}\ }
\newcommand{\Then}{{\small\bf then}\ }
\newcommand{\Else}{{\small\bf else}\ }
\newcommand{\rElse}{{\small\bf else}\ }
\newcommand{\Elseif}{{\small\bf elseif}\ }
\newcommand{\Foreach}{{\small\bf for each}\ }
\newcommand{\Endif}{{\small\bf end\ if\ }}
\newcommand{\Break}{{\small\bf break }}
\newcommand{\Endproc}[1]{{\small\bf end} #1}
\newcommand{\For}{{\small\bf for}\ }
\newcommand{\Endfor}{{\small\bf end\ for}}
\newcommand{\While}{{\small\bf while}\ }
\newcommand{\Endwhile}{{\small\bf end\ while}}
\newcommand{\LogAnd}{{\small\bf and}}
\newcommand{\Repeat}{{\small\bf repeat}\ }
\newcommand{\Until}{{\small\bf Until}}
\newcommand{\Loop}{{\bf loop}\ }
\newcommand{\Endloop}{{\bf end\ loop}\ }
\newcommand{\xbeginlgox}{\begin{minipage}{1in}\begin{tabbing}
\quad\=\qquad\=\qquad\=\qquad\=\qquad\=\qquad\=\qquad\=\kill}
\newcommand{\xendlgox}{\end{tabbing}\end{minipage}}
\newenvironment{algorithm}{\begin{tabular}{l}\xbeginlgox}
{\xendlgox\end{tabular}}
\newenvironment{program}{
\begin{minipage}{4.0in}
\begin{tabbing}
\= \ \ \ \= \ \ \ \ \= \ \ \ \ \= \ \ \ \ \=
\ \ \ \ \= \ \ \ \ \= \ \ \ \ \= \ \ \ \ \=
\ \ \ \ \= \ \ \ \ \= \ \ \ \ \= \ \ \ \ \= \kill
}{
\end{tabbing}
\end{minipage}
}
\DefineNamedColor{named}{RedViolet} {cmyk}{0.07,0.90,0,0.34}
\newcommand{\AlgorithmI}[1]{{\textcolor[named]{RedViolet}{\texttt{\bf{#1}}}}}
\newcommand{\Algorithm}[1]{{\AlgorithmI{#1}\index{#1@{\AlgorithmI{#1}}}}}
\newcommand{\Graph}{\mathsf{G}}