Please, do you know if there's any possibility how to use the listings
package together with XeLaTeX? I have to use XelaTeX and therefore I have UTF-8 encoded files. This is not compatible with listings which allows one-byte encoding. (I know there is listingsutf8
package, but it converts files from UTF-8 which I don't need.)
The listings package works somehow, bu I only can use English letters. I've fond some solution like a list of special characters ( Having problems with listings and UTF-8. Can it be fixed? ) but it seems it works only for some letters. It there anything that would support UTF-8 in listing 'naturally'?
Best Answer
The link you are mentioning is for 8-bit engines like pdflatex, it will not work with xetex or luatex.
With xelatex + lualatex chars with unicode positions below 256 will work out of the box:
Things get more complicated if you want to use chars above 256. E.g. an € or the french "oe" or greek etc. In this case you will have to add them to the processing list of listings first and use
extendedchars=true
. Here an example which adds the euro and the french oe and Oe (the middle listings shows the problems without the extended definitions):Output: