I am using this code to define keywords for listings

    language = [LaTeX]TeX,

However that marks every word color as a keyword, no matter if it is preceded by a \.

I however really want only LaTeX keywords to be highlighted.

Can this somehow be achieved?


You want moretexcs, I think

    columns    = flexible,
    keepspaces = true,    
    basicstyle = \small\ttfamily,
    language   = [LaTeX]TeX,
    moretexcs  = {textwidth,color,let},
  • I switched to morekeywords for some reason I can not remember. Is there a limit on the number of codewords ? Speed of compilation does not matter. – Matthias Pospiech Jul 22 '12 at 16:50
  • @MatthiasPospiech No idea about a limit: I've certainly not found one in siunitx, where the list is pretty big. – Joseph Wright Jul 22 '12 at 16:53

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.