Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I'm trying to highlight a couple of keywords which contain non-ASCII characters using the listingsutf8 package. This is the relevant part of my document:

    keywords={Funcionalidade, Para, Como, Eu, Contexto, Cenário, Dado, Quando, Então},

The ASCII only keywords are being highlighted correctly, but the Cenário and Então keywords are not. I have also tried with emph and changing inputencoding, but it doesn't work either:

    emph={Cenário, Cen\'ario, Cenario},emphstyle={\bfseries}

If it's relevant, the listing I'm trying to highlight comes from a separate file, using the \lstinputlisting command. If I had to guess, I would say that it has something to do with the literate params.

share|improve this question

marked as duplicate by Jubobs, Sean Allred, Speravir, Jesse, ChrisS Mar 11 '14 at 2:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The highlight for Cenário will work just fine if you use XeLaTeX -- if it's suitable for your workflow, that is. – LianTze Lim Dec 9 '11 at 15:53
The detection of keywords in listings doesn't work well with UTF-8 encoded files. With latin1 encoding, specifying Cenário as keyword does what you want. Please, try providing a minimal example. – egreg Dec 9 '11 at 16:23
Unfortunately, I cannot use XeLaTeX right now. I have updated the question with a more concrete example. – Tomas Mattia Dec 10 '11 at 20:26

1 Answer 1

Try the listingsutf8 package from the oberdiek bundle. It offers a workaround exactly for the \lstinputlisting command.

share|improve this answer
I have tried (and edited the question to reflect the changes I have made), but even with the listingsutf8 package the keyword is not being highlighted. – Tomas Mattia Dec 10 '11 at 20:25
Too bad. And I have no other idea. – Thorsten Donig Dec 11 '11 at 10:44
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Masroor Jun 16 '14 at 16:16

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