0

I use a package to right Latex code on Latex, but when I used special caracters I got this error

Package inputenc Error: Unicode char ...

this is a sample of code

\documentclass[12pt,a4paper,twoside,openright]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english,francais]{babel}
\usepackage{listings}
\lstset
      {
      language=[LaTeX]TeX,
      breaklines=true,
      basicstyle=\tt\scriptsize,
      keywordstyle=\color{blue},
      identifierstyle=\color{black},
      }
\begin{document}
\begin{lstlisting}
    Ceci est un nom composé en fin de ligne du mathématicien Albert~EINSTEIN.
\end{lstlisting}
\end{document}

like you see, the phrase on the listing bloc contain special caracters, I tried utf8x instead of utf8, it doesn't work, so how can I solve this, please ?

1

Listings doesn't work with utf8. Add this option to \lstset:

  literate={é}{{\'e}}1 

and similarly for other non-ascii characters (separate all such specifications with space).

  • it works for é, but how can I found the others symbols like è, ê ... – Hind Dev Aug 22 '16 at 14:57
  • 1
    Add the prehistoric code for accented letters: {è}{{`e}}1 {ê}{{\ˆe}}1 {à}{{`a}}1 , &c (don't forget accented capital letters). – Bernard Aug 22 '16 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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