0

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}.

Chronus
  • 103
  • 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 04 '17 at 03:53

1 Answers1

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

Henri Menke
  • 109,596