I am converting my codes from pdflatex to XeLaTeX
Minimal case
\documentclass{article}
\usepackage{polyglossia} % also loads package fontspec
\setmainfont{Minion Pro} % or whatever OTF you have on your system
\setmainlanguage{english} % loads language hyphenation rules and such
\usepackage{unicode-math} % if you also need maths
\setmathfont{Cambria Math} % or whatever math OTF you have on your
% Problem with these declarations which I like to use
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\begin{document}
\begin{equation}
\norm{x} + \abs{y} = 1
\end{equation}
\end{document}
where I had previously
% \usepackage{amsmath, amsfonts, amssymb, textcomp, mathtools, xparse}
% \usepackage[T4, OT1]{fontenc}
What is the correct way of having these declarations in XeLaTeX?
Some challenges with Egreg's approach
Example data
\begin{equation}
\norm{x} + \abs{y} = 1 is \norm{x} + \abs{y} = 1 \square.
\end{equation}
I can resolve these errors by this
\usepackage{mathtools, xparse} % load mathtools before loading fontspec
% amsmath never needed with mathtools
\usepackage{amsfonts, amssymb, textcomp} % not sure if these are necessary
% https://tex.stackexchange.com/a/213430/13173
\usepackage{polyglossia} % also loads package fontspec
\setmainfont{Minion Pro} % or whatever OTF you have on your system
\setmainlanguage{english} % loads language hyphenation rules and such
\usepackage{unicode-math} % if you also need maths
\setmathfont{Cambria Math} % or whatever math OTF you have on your system
where I cannot understand which is the critical package.
I think xparse is needed but it does not solve the square-symbol -challenge when used this package with Egreg's code.
\DeclarePairedDelimiteris provided bymathtools, you have to load it. Put it before loadingfontspec. But, please, do some research before asking questions. – egreg Nov 22 '14 at 17:53