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

Subsection 4.18 of the current listings documentation (2013/08/26 Version 1.5b) describes a key called tag. That key is used in lstdrvrs.dtx, which is a file that ships with listings and takes care of predefining languages. More specifically, the tag key is used in the definition of the HTML and XML languages , as follows:

  % ...
  % ...

Why, then, can't I use the tag key in the definition of a custom language? For instance, the code below throws the following error:

!Package keyval Error: tag undefined.

My TeX distribution is up-to-date. I don't understand...



share|improve this question
up vote 9 down vote accepted

The documentation neglects to mention that the tag key is defined (in lstmisc.sty) only within the html "aspect" (not language). Loading this aspect with


(or as package option) will place the tag key at your disposal. You could also load it in the last optional argument of \lstdefinelanguage:

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.