3

I tried to change the engine from pdfLaTeX to XeLaTeX, but I can't compile a simple project:

\documentclass[10pt]{article}

\usepackage{polyglossia}
    \setdefaultlanguage{english}

\usepackage{unicode-math}
\usepackage{fontspec}
\setmainfont[
    Ligatures=TeX,
    Extension=.otf,
    UprightFont= *-regular,
    BoldFont=*-bold,
    ItalicFont=*-italic,
    BoldItalicFont=*-bolditalic]{texgyrepagella}
\setmathfont[Extension=.otf]{texgyrepagella-math}

\usepackage{empheq}

\author{}
\title{}
\date{}

\begin{document}
    \maketitle
\end{document}

But it produces error:

Command \dddot already defined. \hbox{\normalfont ...}\vss}}}}
Command \ddddot already defined. \hbox{\normalfont....}\vss}}}}
Extended mathchar used as mathchar (4203026) \mathchardef\std@minus\mathcode`\-\relax
Command \overleftrightarrow already defined. ...palette{\overarrow@\leftrightarrowfill@}}
Command \underrightarrow already defined. ...athpalette{\underarrow@\rightarrowfill@}}
Command \underleftarrow already defined. \mathpalette{\underarrow@\leftarrowfill@}}
Command \underleftrightarrow already defined. ...alette{\underarrow@\leftrightarrowfill@}}
3
  • load empheq first, just after \documentclass then let the xetex packages do their stuff Commented Nov 27, 2013 at 13:27
  • @DavidCarlisle: That's work, I haven't yet met the errors, that can be fixed by simply rearranging the usepackage's...
    – m0nhawk
    Commented Nov 27, 2013 at 15:32
  • Oh its very common see frequent answers telling to put hyperref last. Here both packages are defining several names of math commands, empheq is expecting them to be new so uses \newcommand so you get an error if they are already defined, unicode-math and friends are expecting to redefine things to work in xetex so makes a gentle warning but redefines commands quite happily. So if you use empheq first it is happy and then unicode-math changes stuff. Commented Nov 27, 2013 at 17:05

1 Answer 1

3

You need to load empheq before unicode-math so that it can define these commands and then unicode-math change them to work in xetex. Rather than the other way round where you get the error you show as empheq gives up as unicode-math has already defined things.

You must log in to answer this question.

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