MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

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

What is the recommended way to typeset algorithms?

For example, I have a question about an algorithm related to automata theory, and I would like to render the algorithm in my question.

In Latex I would use the algorithmic package and then get on with STATE and WHILE, etc. This does not seem to work here however, so is it recommended that I format the algorithm in html, with a numbered, ordered list and the individual details in jsmath/latex or is there some other tacitly agreed upon protocol?

share|cite|improve this question

closed as off topic by Loop Space, Scott Morrison Jun 25 '10 at 15:50

Questions on MathOverflow are expected to relate to research level mathematics within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

This type of question is more appropriate over at the meta site. – Loop Space Jun 25 '10 at 8:48
Closed: this is for meta. – Scott Morrison Jun 25 '10 at 15:50

To display code, indent it four spaces -- this is the markdown syntax for code blocks. For example:

factorial :: Integer -> Integer
factorial 0 = 1 
factorial n = n * factorial (n - 1)

If you need to put some code inline, then put it in backticks -- "Integer is a type". Unfortunately the code block code seems to suppress jsMath, however.

share|cite|improve this answer
thanks for the tip, but definitely need a solution that supports both the algorithm notation and mathjs style markup. I guess html is the way to go? – blackkettle Jun 25 '10 at 12:43
sadly, no. The formatter allows very little by way of actual HTML. I recommend that you search on meta as there are several discussions with links there that may help you. – Loop Space Jun 25 '10 at 13:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.