TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to write an algorithm in LaTeX. It's not any programming language, it is pseudocode with a very mathematical style. Furthermore it is divided in a main function and some subfunctions. I also would like to be able to comment (almost) every line to describe what it is used for.

As an example, you may want to take a look at this link: http://citeseerx.ist.psu.edu/viewdoc/download?doi=

See page 10 for the code. I would like to write it in the very same style if this is somehow possible.

Any help is appreciated :)

share|improve this question

closed as not a real question by lockstep, egreg, Joseph Wright Dec 3 '11 at 22:23

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Welcome to TeX.sx! Can you show us some attempt you've made in achieving this layout? Is there something in particular you're struggling with? Some popular packages for code formatting are listings, fancyvrb and minted. There are plenty of questions about them on tex.sx that you can check out. – doncherry Aug 22 '11 at 15:22
So far, I have only used listings. The main problem is the structure of the example, how it is split up in the different (sub)functions in one table – chris Aug 22 '11 at 15:33
There are many options that vary across styles and ease-of-use. Here is a list of options in terms of typesetting algorithms in pseudocode that may be of interest: Print programs with its proper syntax – Werner Aug 22 '11 at 15:50
Have you read tex.ac.uk/cgi-bin/texfaq2html?label=algorithms ? – ā„¯aphink Aug 23 '11 at 6:04