# Override properties of a predefined listing style

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:

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


Does anyone know how I can only override ndkeywords?

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

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[variablett]{lmodern}
\usepackage{color}
\usepackage{listings}
\lstset{
columns=fullflexible,
basicstyle=\ttfamily,
}
\lstdefinestyle{myHTML}{
language=HTML,
keywordstyle=\color{blue},
deletekeywords={charset, document, window},
morekeywords={[2]{charset, document, window}},
keywordstyle={[2]{\color{red}}},
}

\begin{document}
\begin{lstlisting}[style=myHTML]
<HTML>
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5391352772712708, "perplexity": 1986.4329242919407}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-23/segments/1405997894250.40/warc/CC-MAIN-20140722025814-00098-ip-10-33-131-23.ec2.internal.warc.gz"}