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 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?

share|improve this question
up vote 4 down vote accepted

You want moretexcs, I think

    columns    = flexible,
    keepspaces = true,    
    basicstyle = \small\ttfamily,
    language   = [LaTeX]TeX,
    moretexcs  = {textwidth,color,let},
share|improve this answer
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 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.