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

Using the listings package, I can use deletekeywords to remove keywords, and so the keyword is not rendered in bold. For example, the for from the following is not in bold font:

for (int i = 0; i < 8; i++) {}

This is useful as I like to use the same font for small code snippets within the main body of my text, but don't always want it to appear with keywords in bold. I came up with two commands for convenience:


However, with Fortran it doesn't work. The do in the following is still in bold.

do i = 1,8
end do

Is there a way to do this? To locally override the keyword/language highlighting settings more generally?

share|improve this question
up vote 6 down vote accepted

The keyword "DO" is defined as uppercase in lstlang1.sty and the code for Fortran says sensitive=f; so


does the trick.

share|improve this answer
Thanks. I wonder why none of the following work: deletekeywords={\uppercase{do}} or deletekeywords={\MakeUppercase{do}} or deletekeywords={\MakeTextUppercase{do}}. – user4417 Jul 26 '11 at 12:52
Anyway, I noticed that keywordstyle= is also very useful: \newcommand{\code}[1]{\lstinline[keywordstyle=]{#1}} \newcommand{\codeb}[1]{\lstinline[morekeywords=#1]{#1}} – user4417 Jul 26 '11 at 13:01
\uppercase{do} can't work: it transforms "do" into "DO" only at processing time of the string and the string isn't processed at that time. Actually it's more complex than this, marginis exiguitas non caperet. :) Or commenti exiguitas non caperet, more properly. – egreg Jul 26 '11 at 13:06

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.