Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

1 Answer 1

up vote 6 down vote accepted

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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