2

I have this problem, it seems I'm doing something wrong while writing letters with accents like è, on that line the compiler says: package inputenc Error: unicode char \u8:èun not set up for use. This happens when I use my LaTeX editor, compiling the same code with an R sweave file on Rstudio it works normally and I got my accents on letters.

The code used is:

\documentclass[12pt,a4paper,oneside,openright]{book} %oneside versione segreteria \usepackage[a4paper,top=2cm,bottom=2cm,left=3cm,right=2.5cm]{geometry} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[english,italian]{babel} \usepackage{bm} \usepackage{amsmath} \usepackage{mathrsfs} %\uspackage{graphicx} \usepackage{hyperref} \begin{document} %________________________________________________________________ \frontmatter %space for abstract \pagestyle{plain} \tableofcontents %_______________________________________________ \mainmatter \pagestyle{plain} %Primo Capitolo %\addcontentsline{toc}{chapter}{Introduzione} \chapter*{Introduzione} L'accrescimento è \end{document} 
8
  • 4
    Are you sure the file is UTF-8 encoded? Commented Jun 1, 2016 at 14:36
  • what do you mean? sorry i'm not an expert on LaTeX. It's that i always put that kind of preamble and it always worked. Commented Jun 1, 2016 at 14:50
  • What editor are you using? Commented Jun 1, 2016 at 14:53
  • TeXShop, always used it Commented Jun 1, 2016 at 14:57
  • 2
    If you haven't changed its preferences, TeXShop doesn't save in UTF-8. Remember to add % !TEX encoding = UTF-8 Unicode at the start of your files. Do it and save the file; close and reopen it, then try running LaTeX on it. Commented Jun 1, 2016 at 14:59

1 Answer 1

4

Very likely your file ended up not being saved as UTF-8.

If you didn't change the default settings in the preferences, TeXShop saves files as Latin-1 (older versions use MacRoman).

Remember to add

% !TEX encoding = UTF-8 Unicode 

at the start of your files. Do it and save the file; close and reopen it, then try running LaTeX on it.

In any case, it's better if you also go to the preferences and change the default encoding to UTF-8.

1
  • Adding the "magic comment" % !TEX encoding = UTF-8 Unicode at the top the file is fantastic. Thank you! Commented Jan 25, 2023 at 22:53

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.