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

exotic unicode characters within a comment are not colorized

This is a minimal working example:



    \setmainfont{Linux Libertine}


        // Comments are green, yet ‘•’ and ‘≤’ are not.

Colorizing these characters generally works within listing environments:

unicode characters colorized by basicstyle


      Everything is green, even ‘•’ and ‘≤’.

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
  • 2
    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
  • 1
    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
  • 1
    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}

 \lst@CCECUse \lst@ProcessLetter
  ^^^^2022^^^^2264% add more codes here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.