Typesetting algorithms in pseudo-code. It is the equivalent of the algorithmicx package in LaTeX.
You can try this library on the web using Gitpod. Click the button below to start a new environment:
Use Satyrographos to install this library.
opam install satysfi-algorithm
satyrographos install
To use this library, simply load these packages:
@require: algorithm/algorithm
@require: algorithm/style/default
then you can write
+algorithmic<
+Procedure{Euclid}{${a, b}}<
+State{${r \gets a \bmod b}}
+While{${r \neq 0}}<
+State{${a \gets b}}
+State{${b \gets r}}
+State{${r \gets a \bmod b}}
>
+State{\Return{${b}}}
>
>
The command names (+Procedure
, +State
, +While
, ...) are roughly the same as in LaTeX's algorithmicx package.
A few things to note:
- Blocks other than
+If
,+ElsIf
,+Else
are automatically closed. (No need to write+EndWhile
, etc.) - Use
\Comment
or+Comment
for comment
There are three built-in styles: default
, python
, and c
. They can be switched by changing the file loaded with @require
.
default | python | c |
---|---|---|
See the manual for details.
MIT, See LICENSE for more information.