4

How can I have an word with accented latter that is also a keyword using listings? I found a solution to have accented letters here, but if the keyword contains an accent, it is not recognized as a keyword.

\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{listingsutf8}
\lstdefinelanguage{mylang}{morekeywords={normal, accentué}}
\usepackage{listings}
\lstset{
    basicstyle=\small,
    inputencoding=utf8/latin1,
    literate={é}{{\'e}}1
}

\begin{document} \begin{lstlisting}[language=mylang] notakeyword normal accentué \end{lstlisting}

\end{document}

results in this, where accentué is not in bold:

enter image description here

sayanel
  • 141

0 Answers0