Special character \oe and BiblateX with XeLateX

I use a Tufte-book documentclass and BiblateX. This is an example of my sample-handout.bib file :

@BOOK{Buchet,
author = {Buchet, Edmond},
title = {Jean-S\'{e}bastien Bach. L'\oe uvre et la vie. Deux si\{e}cles d'\'{e}tudes et de t\'{e}moignages},
year = {1963},
publisher = {\'{E}ditions Les Libraires Associ\'{e}s},
place = {Saverne},
pagetotal = {267}
}


When I compile my document with XeLateX (with ifetex.sty in my folder), special character \oe is not recognize and the word "oeuvre" is replaced by "uvre" (the special character is missing) in the footnote reference. This is my code (a large part concerns the creation of referencing in sidenote via BiblateX, sorry...):

\RequirePackage{luatex85}
\documentclass[nobib,symmetric,justified,marginals=raggedouter]{tufte-book}
\usepackage{fontspec}
%\setmainfont{fbb}

\ifx\ifxetex\ifluatex\else
%\ifxetex
\newcommand{\textls}[2][5]{%
}
\renewcommand{\allcapsspacing}[1]{\textls[15]{#1}}
\renewcommand{\smallcapsspacing}[1]{\textls[10]{#1}}
\renewcommand{\allcaps}[1]{\textls[15]{\MakeTextUppercase{#1}}}
\renewcommand{\smallcaps}[1]
{\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}
\setsansfont{TeX Gyre Heros}[Scale=MatchUppercase]
\fi

\usepackage{microtype}
\usepackage{fancyvrb}

\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear-icomp]{biblatex}
\makeatletter
\iffieldundef{shorthand}
{\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}}
{\iffieldequals{namehash}{\cbx@lasthash}
{\setunit{\compcitedelim}}
{\printnames{labelname}%
\setunit*{\printdelim{nameyeardelim}}%
\printlabeldateextra
\setunit*{\printdelim{nametitledelim}}%
\savefield{namehash}{\cbx@lasthash}}%
\usebibmacro{cite:title}}}%
{\usebibmacro{cite:shorthand}%
\usebibmacro{cite:reinit}}%
\setunit{\multicitedelim}}
\makeatother
\newbibmacro*{cite:title}{%
\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
{}
{\usebibmacro{cite:postnote}}
\usepackage{mdframed}
\newmdenv[skipabove=3.5ex plus 1ex minus .2ex,% Equal to section title spacing
innerleftmargin=0pt,innerrightmargin=0pt,%
innerbottommargin=0pt,innertopmargin=0pt,linewidth=0pt,innermargin=0pt,%
outermargin=\dimexpr-\marginparwidth-\marginparsep\relax]{mdfullwidth}
\defbibenvironment{bibliography}
{\list{}{\parsep\bibparsep}}
{\endlist}
{\item}
\AtEveryBibitem{\hskip-\bibhang}

\begin{document}
How to fix the problem with "\oe uvre"\autocite[p.~42]{Buchet}?

\begin{fullwidth}
\bibhang=0pt
\printbibliography
\end{fullwidth}
\end{document}


I think the problem is with fontspec or inputec, but I don't know where. How can I fix the problem?

• You shouldn't have \usepackage{fbb}, remove it: you don't get the requested font, otherwise; on the other hand “L’œuvre” appears (in Latin Modern). After the removal I get “L’œuvre” in the fbb font. Remove also inputenc (although it does nothing at all). – egreg Jun 10 at 9:40
• I remove the to packages in the example. But in my document the removal of the \usepackage{fbb} changes the formatting of the start of my chapters, so I don't want to delete it. – Phil8544 Jun 10 at 10:04
• I don't understand: with \usepackage{fbb} and xelatex/lualatex, all the document is typeset with Latin Modern. The package must not be used with those engines. But of course you need \setmainfont{fbb}, if you want that font. – egreg Jun 10 at 10:07
• This picture (click) shows what I get without \usepackage{fbb}, but with \setmainfont{fbb}. I added \chapter{Test} and a \newthought command. The “œ” character appears in the side note, as you can see. – egreg Jun 10 at 10:18
• I still get “œ” also with the updated example (with the error mentioned by @moewe). You opened a chat, but never answered. – egreg Jun 12 at 14:26

If I compile the MWE as posted I get the error

("C:\Program Files\MiKTeX 2.9\tex/latex/microtype\microtype.sty"

! LaTeX Error: Command \textls already defined.
Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.


That is because you the block of code

\ifx\ifxetex\ifluatex\else
%\ifxetex
\newcommand{\textls}[2][5]{%
}
\renewcommand{\allcapsspacing}[1]{\textls[15]{#1}}
\renewcommand{\smallcapsspacing}[1]{\textls[10]{#1}}
\renewcommand{\allcaps}[1]{\textls[15]{\MakeTextUppercase{#1}}}
\renewcommand{\smallcaps}[1]
{\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}
\setsansfont{TeX Gyre Heros}[Scale=MatchUppercase]
\fi


defines \textls, which microtype wants to define.

The test \ifx\ifxetex\ifluatex\else <stuff> \fi looks a bit odd to me. I'm not quite sure I understand what that test is supposed to do, but if I guessed right, then \iftutex <stuff> \fi would be the more canonical to do this with a modern iftex.

In any case that block causes loading issues with microtype. Furthermore, it loads a different font than the one you specify (it says \setmainfont{TeX Gyre Pagella} overriding your \setmainfont{fbb}).

Unless you have a good reason to keep this block of code around I'd just completely get rid of it. With the code block gone there is no error and \oe (œ) shows as expected in citations and the bibliography

\RequirePackage{luatex85}
\documentclass[nobib,symmetric,justified,marginals=raggedouter]{tufte-book}
\usepackage{fontspec}
\setmainfont{fbb}

\usepackage{microtype}
\usepackage{fancyvrb}

\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear-icomp]{biblatex}
\makeatletter
\iffieldundef{shorthand}
{\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}}
{\iffieldequals{namehash}{\cbx@lasthash}
{\setunit{\compcitedelim}}
{\printnames{labelname}%
\setunit*{\printdelim{nameyeardelim}}%
\printlabeldateextra
\setunit*{\printdelim{nametitledelim}}%
\savefield{namehash}{\cbx@lasthash}}%
\usebibmacro{cite:title}}}%
{\usebibmacro{cite:shorthand}%
\usebibmacro{cite:reinit}}%
\setunit{\multicitedelim}}
\makeatother
\newbibmacro*{cite:title}{%
\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
{}
{\usebibmacro{cite:postnote}}
\usepackage{mdframed}
\newmdenv[skipabove=3.5ex plus 1ex minus .2ex,% Equal to section title spacing
innerleftmargin=0pt,innerrightmargin=0pt,%
innerbottommargin=0pt,innertopmargin=0pt,linewidth=0pt,innermargin=0pt,%
outermargin=\dimexpr-\marginparwidth-\marginparsep\relax]{mdfullwidth}
\defbibenvironment{bibliography}
{\list{}{\parsep\bibparsep}}
{\endlist}
{\item}
\AtEveryBibitem{\hskip-\bibhang}

\begin{filecontents}{\jobname.bib}
@BOOK{Buchet,
author    = {Buchet, Edmond},
title     = {Jean-S\'{e}bastien Bach. L'\oe uvre et la vie.
Deux si\{e}cles d'\'{e}tudes et de t\'{e}moignages},
year      = {1963},
publisher = {\'{E}ditions Les Libraires Associ\'{e}s},
place     = {Saverne},
pagetotal = {267},
}
\end{filecontents}

\begin{document}
How to fix the problem with "\oe uvre"\autocite[42]{Buchet}?

\begin{fullwidth}
\bibhang=0pt
\printbibliography
\end{fullwidth}
\end{document}


Note that for BibTeX LaTeX-macro-escapes like \oe and \{e} must be encased in an additional pair of curly braces for correct sorting. This is not necessary with Biber because Biber converts everything to Unicode internally anyway, but if you use Biber it is preferable to use Unicode input directly.

@BOOK{Buchet:bibtex,
author    = {Buchet, Edmond},
title     = {Jean-S{\'{e}}bastien Bach. L'{\oe}uvre et la vie.
Deux si{\{e}}cles d'{\'{e}}tudes et de t{\'{e}}moignages},
year      = {1963},
publisher = {{\'{E}}ditions Les Libraires Associ{\'{e}}s},
place     = {Saverne},
pagetotal = {267},
}

@BOOK{Buchet:biber,
author    = {Buchet, Edmond},
title     = {Jean-Sébastien Bach. L'œuvre et la vie.
Deux siècles d'études et de témoignages},
year      = {1963},
publisher = {Éditions Les Libraires Associés},
place     = {Saverne},
pagetotal = {267},
}


The fact that Biber converts to Unicode was quite probably the issue with your initial code: The messed up font setup would not accept œ and only accept \oe, since Biber converts \oe to œ you'd get the issue. The same issue is explained in Biblatex + Xelatex does not display accents.

• I have a file ifetex.sty in my folder in order to avoid your first error. – Phil8544 Jun 11 at 16:09
• I try all your suggestions, but none works for the previous problem: I have always "uvre" and not "oeuvre"... – Phil8544 Jun 11 at 16:10
• @Phil8544 You'll have to be a bit more specific than nothing works. Did you try the full MWE I posted (the second code block)? Did you get any errors? Does the output not look like expected? If so, what specifically is wrong? – moewe Jun 11 at 16:11
• @Phil8544 The absence of presence of ifetex was never an immediate problem. If you have a ifetex.sty in your folder, it could be outdated or contain different definitions than the one that is on CTAN at the moment (which could be an issue). But there were no immediate issues with ifetex in the MWE. – moewe Jun 11 at 16:16
• @Phil8544 Sorry, I don't understand your question about œ. You can say {\oe} or you can just write œ (I can't easily do that on my keyboard, so I usually copy-and-paste the character either from Wikipedia or from other text on the page). I assumed you were French (from the way you left a space in front of the question mark in one of your earlier questions) and I also assumed French keyboards have a key for œ. – moewe Jun 11 at 16:21