I found this page with some examples:
http://en.wikibooks.org/wiki/LaTeX/Algorithms_and_Pseudocode
I'm wondering which one to use. Any suggestions? I'm using other packages too so whichever is less likely to interfere with them is better for me.
algorithmspackagespseudocode
I found this page with some examples:
http://en.wikibooks.org/wiki/LaTeX/Algorithms_and_Pseudocode
I'm wondering which one to use. Any suggestions? I'm using other packages too so whichever is less likely to interfere with them is better for me.
Best Answer
Personally, I favour
algpseudocode
from thealgorithmicx
(note the trailingx
!) package. With a bit of setup, this can be harnessed to create beautiful pseudocode.This was produced by the following code:
And used the following setup (this is just an example to replicate the above; you can of course use your own setup):
To get the
end
-less pseudocodes, I included the package as follows:The above pseudo code is nested inside an
algorithm
float environment. This environment isn’t part ofalgorithmicx
. Instead, you need to load the packagealgorithm
to get it. To produce a list of all algorithms, you can useFor further information, see the section “The
algorithm
Environment” in the documentation of thealgorithms
package. But I want to stress again that (except for the float environment) thealgorithmicx
package is superior toalgorithms
.