4

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}
1
  • 1
    never use inputenc with xelatex or luatex, they only accept utf-8 anyway so the package isn't needed (and doesn't work) Commented Mar 7, 2014 at 12:57

1 Answer 1

8

You shouldn't use inputencwith XeLaTeX : it supposes your document is in utf8 encoding. And you shouldn't use fontenc either, since it manages fonts directly. Also, it is recommended to use polyglossia rather than babel: it is tailored for XeLaTeX.

Here is a code that works:

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Minion Pro}

\usepackage{polyglossia}
\setmainlanguage{portuges}

\author{Sérgio}
\title{Há muito açafrão} 

\begin{document}
\maketitle
Words/letters with accents: Sérgio áéíóúçãõ.
\end{document} 

enter image description here

9
  • It's a pity that polyglossiadoesn't work with BibLaTeX.
    – sbac
    Commented Mar 7, 2014 at 14:26
  • You mean it doesn't work for localisation strings such as editorname? It does detect the presence of polyglossia.
    – Bernard
    Commented Mar 7, 2014 at 14:35
  • No, any simple example doesn't work: \documentclass{article} \usepackage{polyglossia} \usepackage{biblatex} \begin{document} test \end{document}
    – sbac
    Commented Mar 7, 2014 at 14:55
  • Of course, you didn't specify any language. With \setmainlanguage{english}, it works just fine.
    – Bernard
    Commented Mar 7, 2014 at 16:14
  • Not for me even after setting \setmainlanguage{english}: ! Package biblatex Error: Patching 'babel' package failed.`
    – sbac
    Commented Mar 7, 2014 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .