summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/algorithmicx/algcompatible.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/algorithmicx/algcompatible.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/algorithmicx/algcompatible.sty')
-rw-r--r--macros/latex/contrib/algorithmicx/algcompatible.sty89
1 files changed, 89 insertions, 0 deletions
diff --git a/macros/latex/contrib/algorithmicx/algcompatible.sty b/macros/latex/contrib/algorithmicx/algcompatible.sty
new file mode 100644
index 0000000000..075f8512e2
--- /dev/null
+++ b/macros/latex/contrib/algorithmicx/algcompatible.sty
@@ -0,0 +1,89 @@
+% ALGORITHMIC STYLE -- Released 27 APR 2005
+% for LaTeX version 2e
+%
+% Copyright Szasz Janos
+% E-mail szaszjanos@users.sourceforge.net
+% Based on Peter Williams's algorithmic.sty
+%
+\NeedsTeXFormat{LaTeX2e}%
+\ProvidesPackage{algcompatible}%
+\RequirePackage{ifthen}%
+\RequirePackage{algorithmicx}%
+\typeout{Document Style - algorithmic compatible environments for the `algorithmicx' style}%
+%
+\def\ALG@noend{f}%
+%
+\DeclareOption{noend}{\def\ALG@noend{t}}%
+\DeclareOption{end}{\def\ALG@noend{f}}%
+\ProcessOptions%
+%
+% *** DECLARATIONS ***
+%
+\algnewlanguage{algorithmic}%
+\alglanguage{algorithmic}%
+%
+% *** KEYWORDS ***
+%
+\algnewcommand\algorithmicend{\textbf{end}}
+\algnewcommand\algorithmicdo{\textbf{do}}
+\algnewcommand\algorithmicwhile{\textbf{while}}
+\algnewcommand\algorithmicfor{\textbf{for}}
+\algnewcommand\algorithmicforall{\textbf{for all}}
+\algnewcommand\algorithmicloop{\textbf{loop}}
+\algnewcommand\algorithmicrepeat{\textbf{repeat}}
+\algnewcommand\algorithmicuntil{\textbf{until}}
+\algnewcommand\algorithmicif{\textbf{if}}
+\algnewcommand\algorithmicthen{\textbf{then}}
+\algnewcommand\algorithmicelse{\textbf{else}}
+\algnewcommand\algorithmicrequire{\textbf{Require:}}
+\algnewcommand\algorithmicensure{\textbf{Ensure:}}
+%
+% *** DECLARED LOOPS ***
+%
+% lines...
+\let\ALG@loopmark\ALG@x@nomark%
+% default line and marks
+\def\ALG@startmark{nomark}%
+\def\ALG@blockline{noline}%
+\def\ALG@continuemark{nomark}%
+\def\ALG@endmark{nomark}%
+%
+\newcommand\ALG@compatcomm[1]{\ifthenelse{\equal{#1}{default}}{}{\ \algorithmiccomment{#1}}}%
+\algrenewcomment[1]{\{#1\}}%
+\algdef{SE}[WHILE]{WHILE}{ENDWHILE}%
+ [2][default]{\algorithmicwhile\ #2\ \algorithmicdo\ALG@compatcomm{#1}}%
+ {\algorithmicend\ \algorithmicwhile}%
+\algdef{SE}[FOR]{FOR}{ENDFOR}%
+ [2][default]{\algorithmicfor\ #2\ \algorithmicdo\ALG@compatcomm{#1}}%
+ {\algorithmicend\ \algorithmicfor}%
+\algdef{S}[FOR]{FORALL}%
+ [2][default]{\algorithmicforall\ #2\ \algorithmicdo\ALG@compatcomm{#1}}%
+\algdef{SE}[LOOP]{LOOP}{ENDLOOP}%
+ [1][default]{\algorithmicloop\ALG@compatcomm{#1}}%
+ {\algorithmicend\ \algorithmicloop}%
+\algdef{SE}[REPEAT]{REPEAT}{UNTIL}%
+ [1][default]{\algorithmicrepeat\ALG@compatcomm{#1}}%
+ [1]{\algorithmicuntil\ #1}%
+\algdef{SE}[IF]{IF}{ENDIF}%
+ [2][default]{\algorithmicif\ #2\ \algorithmicthen\ALG@compatcomm{#1}}%
+ {\algorithmicend\ \algorithmicif}%
+\algdef{C}[IF]{IF}{ELSIF}%
+ [2][default]{\algorithmicelse\ \algorithmicif\ #2\ \algorithmicthen\ALG@compatcomm{#1}}%
+\algdef{Ce}[ELSE]{IF}{ELSE}{ENDIF}%
+ [1][default]{\algorithmicelse\ALG@compatcomm{#1}}%
+\algnewcommand\REQUIRE{\item[\algorithmicrequire]}%
+\algnewcommand\ENSURE{\item[\algorithmicensure]}%
+\algnewcommand\STATE{\State}%
+\algnewcommand\STATEx{\Statex}%
+\algnewcommand\COMMENT{\Comment}%
+%
+\ifthenelse{\equal{\ALG@noend}{t}}%
+ {%
+ \algtext*{ENDWHILE}%
+ \algtext*{ENDFOR}%
+ \algtext*{ENDLOOP}%
+ \algtext*{ENDIF}%
+ }{}%
+%
+\algrenewcommand\algorithmicindent{1em}%
+%