# Problem with listings-ext [closed]

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:

\usepackage[style=colored-code]{listings-ext}


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

 \newcommand
{\lstdef}[3]{%
,colored-code\$
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:

\lstdefinestyle{colored-code}{
backgroundcolor=\color{yellow!10},%
basicstyle=\footnotesize\ttfamily,%
identifierstyle=\color{black},%
keywordstyle=\color{blue},%
stringstyle=\color{teal},%
}

-

## closed as too localized by Werner, Seamus, percusse, Marco Daniel, Claudio FiandrinoAug 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}

\usepackage[style=colored-code]{listings-ext}

\begin{document}
test
\end{document}


with the example listings.cfg:

\ProvidesFile{listings.cfg}%
[2009/08/23 v1.0 listings configuration of listings-ext]

\RequirePackage{xcolor}

\def\lstlanguagefiles{lstlang1.sty,lstlang2.sty,lstlang3.sty}
\lstset{defaultdialect=[ANSI]C,
defaultdialect=[ISO]C++,
defaultdialect=[95]Fortran,
defaultdialect=Java,
defaultdialect=[LaTeX]TeX,
frame=tlb,
resetmargins=false,
}
\lstdefinestyle{colored-code}{
backgroundcolor=\color{yellow!10},%
basicstyle=\footnotesize\ttfamily,%
identifierstyle=\color{black},%
keywordstyle=\color{blue},%
stringstyle=\color{teal},%
}
\lstdefinestyle{bw-code}{
basicstyle=\small\fontfamily{lmtt}\fontseries{m}\fontshape{n}\selectfont,
% instead of lmtt one should use ul9 (luximono) for boldface characters
keywordstyle=\small\fontfamily{lmtt}\fontseries{b}\fontshape{n}\selectfont,
stringstyle

=\small\fontfamily{lmtt}\fontseries{m}\fontshape{it}\selectfont,
}


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

-
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