0

This question already has an answer here:

Could you please help me find a way to insert Latin accents in the lstlistings environment? I've tried the direct way and also the indirect way, i.e using ç and \c{c}. However, when using ç, this error appers:

Package inpuntec Error: Unicode char ...\lst@EC ... (U+9EA7)(inpuntec) not set up for use with LaTeX.

Replacing the ç for the \c{c} gets rid of the error, but when the pdf is generated, the output is not converted to ç, but instead, it stays as \c{c}.

marked as duplicate by CarLaTeX, ChrisS, Troy, Stefan Pinnow, Schweinebacke Nov 4 '17 at 7:34

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.

  • Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See minimal working example (MWE). – Henri Menke Nov 4 '17 at 3:53
1
\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{listings}

\begin{document}

\begin{lstlisting}[literate={ç}{{\c{c}}}1]
ç
\end{lstlisting}

\end{document}

enter image description here

It's probably easier to just use LuaLaTeX and the following setup. Note also how ç is actually a single character here (U+00E7 LATIN SMALL LETTER C WITH CEDILLA to be precise).

\documentclass{article}

\usepackage{fontspec}
\usepackage{listings}

\begin{document}

\begin{lstlisting}
ç
\end{lstlisting}

\end{document}

enter image description here

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