I need to highlight syntax in my LaTeX presentation, so I've found this answer:
XML syntax highlighting
\lstdefinelanguage{XML}
{
morestring=[b]",
morestring=[s]{>}{<},
morecomment=[s]{<?}{?>},
stringstyle=\color{black},
identifierstyle=\color{darkblue},
keywordstyle=\color{cyan},
morekeywords={xmlns,version,type},
backgroundcolor=\color{lightgray},
numbers=left,
numberstyle=\footnotesize\ttfamily\color{gray},
numbersep=0.5pt
}
Unfortunately I didn't find any way, how to specify extra style for text in attributes.
For example:
<xml>
<person age="22" sex="female">Ann</person>
</xml>
It the case above, Ann
and 22
, female
would have the same style… How to separate styles for those two things?
Best Answer
When you add the color package and change
into
the attributes will color red.
This will color the attributes red in your xml listings.