I'm using amsthm and clrscode to typeset algorithms. I'd like to have my algorithms numbered, so I do this:


The folowing algorithm does something. This text should stay in italics.

\li \Return $0$ \Comment{here italics should be disabled}


The plain theorem style has theorem name and number in bold, which I like, and the theorem statement in italic, which I also like. Unfortunately, in the case of an algorithm, the whole algorithm is typeset in italics and that looks very bad. So, for algorithms I'd like to turn off italics.

How do I do that? Is there any environment that I could use to temporarily disable italics only in codebox? If possible, I'd like to not create any new theorem style.


The macro \code@init is run at the beginning of a codebox environment. You can add \normalfont to it, which disables also the italic mode set before:


\normalfont resp. \code@init works locally here, so after the codebox ended the italic shape will be restored.

algorithm example

  • Wow, great, thank's for a super-quick response! Could you explain where exactly I should put the code snippet you wrote? – Jasiu Jun 24 '11 at 19:48
  • @Jasiu: in the preamble of your document, after loading clrscode. – Gonzalo Medina Jun 24 '11 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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