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 am using listings-ext on Ubuntu 11.10 (with LyX) and listings.cfg defines the style colored-code - which I also use in the LaTeX preamble:


But whenever I try to compile the document - into DVI or PDF I get this:

The following styles weren't loadable:
This may cause errors in the sequel.

And a message saying "Package Listings Error: style colored-code undefined".

How can I fix this?

This is what listings.cfg has:

share|improve this question

closed as too localized by Werner, Seamus, percusse, Marco Daniel, Claudio Fiandrino Aug 18 '12 at 13:11

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Is it possible to edit your post and include listings.cfg? Or at least just the part where it defines colored-code? – Werner Jan 4 '12 at 18:39
Have done so now – adrianmcmenamin Jan 4 '12 at 18:49
Is your listings.cfg any different from what is posted in @someonr's "answer"? – Werner Jan 4 '12 at 18:56
Since you've solved your problem which stemmed from two different listings.cfg, I think this may be too localized. – Werner Jan 4 '12 at 19:08

I just tried:

\documentclass[a4paper, 11pt]{article}



with the example listings.cfg:

  [2009/08/23 v1.0 listings configuration of listings-ext]


  % instead of lmtt one should use ul9 (luximono) for boldface characters


and it is all compiling without errors. I think your listings.cfg is wrong.

share|improve this answer
Yeah this is no real answer, but it would be too long for a comment, and should be able to help the question author to find the error. – someonr Jan 4 '12 at 18:45
I think I have the answer - seems to be a packaging error with Ubuntu: two conflicting listings.cfg files are supplied - one is an unadorned one, which doesn't have the colored-code style and one is supplied by listings-ext which does. I edited the unadorned one to add in the additional styles and it works now. I will try to find out where the conflict is in Ubuntu (if that is where it comes from) and post a bug on their bugzilla. Thanks for the help and time though - it's when you suggested I post the contents of the listings.cfg that I noticed their appeared to be two of them. – adrianmcmenamin Jan 4 '12 at 18:58

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