# How to use empheq with unicode-math?

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}}}}
Extended mathchar used as mathchar (4203026) \mathchardef\std@minus\mathcode\-\relax

• load empheq first, just after \documentclass then let the xetex packages do their stuff – David Carlisle Nov 27 '13 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 Nov 27 '13 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. – David Carlisle Nov 27 '13 at 17:05
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.