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 use the listings package and I want to override an attribute of the HTML style.

Unfortunately my code overrides the whole HTML style and not just a single property:

\lstdefinelanguage{HTML}{ndkeywords={charset, window, document}}

Does anyone know how I can only override ndkeywords?

share|improve this question
how about (for example) \lstset{emph={charset,window,document},emphstyle={\color{green!50!black}}} (for reference see page 17 of the documentation) – cmhughes Feb 6 '13 at 2:03
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Jubobs Mar 1 '14 at 22:29

Package listings allows the definition of styles, there you can put the options to format the special HTML code listings. Also the keywords, which should be displayed differently, needs to be removed from the default class first. Then the example adds these keywords to class 2 and avoids the use of ndkeywords, because this is marked deprecated in the documentation of listings.

  deletekeywords={charset, document, window},
  morekeywords={[2]{charset, document, window}},

    <A href="http://tex.stackexchange.com"


share|improve this answer

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.