Feeds:
Posts
Comments

Archive for May, 2011

Two LaTeX packages are very popularly used to typeset algorithms/pseudo-code (actually one is a set of related packages). The first is the algorithms package and its related packages. The second is the algorithm2e package.

The algorithms package provides two basic environments: algorithm for creating floats that contain algorithms, and algorithmic for typesetting actual algorithms. It is very straightforward and easy to use, however it is not flexible and does not provide ways to customize the output easily. The algorithmicx package provides the same algorithmic environment, but with greater flexibility.

The algorithm2e package provides environments for typesetting algorithms with ultimate flexibility. By default, the output looks very much like actual code. It is very customizable. However, it is more difficult to use, and its syntax is not very intuitive.

My advice:

  • If you don’t need to customize the output of your algorithms too much, don’t have very special needs, or just want to typeset your algorithms quickly, go with the algorithms family.
  • If you need very professionally looking algorithms, or you want to customize the output in a very special way, then you may want to go with algorithm2e (just MAY).

P.S: google the package name on CTAN and you will find the package. I didn’t put the links here.

Read Full Post »