# Unicode characters in a listing environment are not colorized!

When using the package listing, colorized comments will not yield colorized exotic unicode characters.

This is a minimal working example:

\documentclass{minimal}

\usepackage{
listings,
color,
fontspec
}

\setmainfont{Linux Libertine}

\lstset{
}

\begin{document}
\begin{lstlisting}[language=Java,showtabs=false]
// Comments are green, yet ‘•’ and ‘≤’ are not.
\end{lstlisting}
\end{document}


Colorizing these characters generally works within listing environments:

    \lstset{
basicstyle=\color{green},
}

\begin{document}
\begin{lstlisting}[showtabs=false]
Everything is green, even ‘•’ and ‘≤’.
\end{lstlisting}
\end{document}


Is this a bug? How can I colorize the unicode characters within comments? I’m using TeXLive 2013 and lualatex.

• Are you using XeLaTeX or LuaLaTeX? – egreg Oct 22 '13 at 8:18
• You will have to add the non-ascii letters (this includes the quote characters to \lst@ProcessLetter first. See e.g. tex.stackexchange.com/a/25396/2388. – Ulrike Fischer Oct 22 '13 at 8:22
• @egreg I’m using LuaLaTeX. – k.stm Oct 22 '13 at 9:10
• Add more chars in the line starting with ^^^^20ac. This is the input for the euro sign and reflects it unicode (U+20AC). – Ulrike Fischer Oct 22 '13 at 9:17
• I tested it: I added ^^^^2022^^^^2264 to the list and it worked fine. The symbols are now green. – Ulrike Fischer Oct 22 '13 at 12:12

You have to add the the non-ascii letters (this includes the quote characters) to \lst@ProcessLetter (see https://tex.stackexchange.com/a/25396/2388}

\makeatletter
\lst@InputCatcodes
\def\lst@DefEC{%
\lst@CCECUse \lst@ProcessLetter
^^80^^81^^82^^83^^84^^85^^86^^87^^88^^89^^8a^^8b^^8c^^8d^^8e^^8f%
^^90^^91^^92^^93^^94^^95^^96^^97^^98^^99^^9a^^9b^^9c^^9d^^9e^^9f%