# XeLaTeX: How to get rid of extra space added before closing parenthesis of \binom

Code:

\documentclass[border=1mm]{standalone}
\usepackage[alignedleftspaceno]{amsmath}

\begin{document}
\begin{aligned}\binom{1}{2}\end{aligned}
$\binom{1}{2}$
\end{document}


Output (red line is where leftmost edges of closing parenthesis should be):

• Are you using lualatex? This is a bug which has just been discussed yesterday in the chat. It will be fixed in the future. Here a link to the fix: chat.stackexchange.com/transcript/41?m=39784868#39784868 – Ulrike Fischer Sep 3 '17 at 18:18
• with pgflatex i can't reproduce your image of binom. – Zarko Sep 3 '17 at 18:20
• xelatex is affected by the same bug, but the fix doesn't address it already. You need to expand it to the xelatex case. – Ulrike Fischer Sep 3 '17 at 18:25
• In the sources of amsmath the code has already been corrected for both engines by @DavidCarlisle, so with the next amsmath update the problem should be gone. – Ulrike Fischer Sep 3 '17 at 19:15
• I have no idea, ask David. – Ulrike Fischer Sep 3 '17 at 20:47

Update

This has been fixed (using the code below) in release 2.17a of amsmath (August 2017).

A fix for this was checked in just yesterday (coincidence?) meanwhile you can use the following that fixes it in both xetex and luatex cases:

\documentclass[border=1mm]{standalone}
\usepackage[alignedleftspaceno]{amsmath}

\makeatletter
\ifx\XeTeXcharclass\@undefined
\ifx\directlua\@undefined\else
\def\genfrac@choice#1#2{%
\ifx @#2@\else
%    \end{macrocode}
% \changes{v2.17a}{2017/09/02}{move \cs{nulldelimiterspace} correction}
%    \begin{macrocode}
\ifx c#1\kern-\nulldelimiterspace\fi
{\delimitershortfall\z@\delimiterfactor\@m
\mathsurround\z@\nulldelimiterspace\z@
\mathchoice
{\genfrac@rule{#2}\displaystyle{2.39}}%
{\genfrac@rule{#2}\textstyle{1}}%
{\genfrac@rule{#2}\scriptstyle{1.45}}%
{\genfrac@rule{#2}\scriptscriptstyle{1.35}}%
}%
\ifx o#1\kern-\nulldelimiterspace\fi
\fi
}
\fi
\else
%    \begin{macrocode}
\def\genfrac@choice#1#2{%
\ifx @#2@\else
%    \end{macrocode}
% \changes{v2.17a}{2017/09/02}{move \cs{nulldelimiterspace} correction}
%    \begin{macrocode}
\ifx c#1\kern-\nulldelimiterspace\fi
{\delimitershortfall\z@\delimiterfactor\@m
\mathsurround\z@\nulldelimiterspace\z@
\mathchoice
{\genfrac@rule{#2}{20}\textfont{2.39}}%
{\genfrac@rule{#2}{21}\textfont{1}}%
{\genfrac@rule{#2}{21}\scriptfont{1.45}}%
{\genfrac@rule{#2}{21}\scriptscriptfont{1.35}}%
}%
\ifx o#1\kern-\nulldelimiterspace\fi
\fi
}
\fi
\begin{document}
\begin{aligned}\binom{1}{2}\end{aligned}
$\binom{1}{2}$
\end{document}

• Why are there two \ifx at the begin? – Ulrike Fischer Sep 3 '17 at 19:26
• @UlrikeFischer interesting question:-) – David Carlisle Sep 3 '17 at 19:27
• polite question ;-). – Ulrike Fischer Sep 3 '17 at 19:29
• @bp2017 when i get a minute. this weekend perhaps. – David Carlisle Sep 7 '17 at 17:57
• @bp2017 gone to ctan, it'll take a day or two to reach distribution updates. – David Carlisle Sep 7 '17 at 21:21