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'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.

share|improve this question
up vote 6 down vote accepted

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

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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