The accented Portuguese characters work well when compiled with pdflatex but not with xelatex giving an inputenc error. Why?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}
\author{Sérgio}
\title{Há muito açafrão}
\begin{document}
\maketitle
Words/letters with accents: Sérgio áéíóúçãõ.
\end{document}
Best Answer
You shouldn't use
inputenc
with XeLaTeX : it supposes your document is in utf8 encoding. And you shouldn't usefontenc
either, since it manages fonts directly. Also, it is recommended to usepolyglossia
rather than babel: it is tailored for XeLaTeX.Here is a code that works: