# \mathellipsis in XeLaTeX with mathspec

Following the solutions Punctuation marks in math mode in xetex/mathspec and XeTeX/mathspec punctuation issue, I am making adjustments to mathspec to force XeTeX to use punctuation marks of the appropriate font. However, the spacing of ellipsis cannot be done properly when it is followed by a comma. LaTeX, of course, has no problem. MWE (pdftex gives an error on ^^^^ characters, but it doesn't matter; Old Standard is a free font):

\documentclass{article}
\usepackage{amsmath}
\usepackage{iftex}
\ifXeTeX
\usepackage{mathspec}
\defaultfontfeatures{Mapping=tex-text}
\setallmainfonts{Old Standard}
\makeatletter
\def\eu@MathPunctuation@symfont{Latin:m:n}
\DeclareMathSymbol{,}{\mathpunct}{\eu@MathPunctuation@symfont}{,}
\DeclareMathSymbol{.}{\mathord}{\eu@MathPunctuation@symfont}{.}
\XeTeXDeclareMathSymbol{^^^^2026}{\mathinner}%
{\eu@MathPunctuation@symfont}{"2026}[\mathellipsis]
\makeatother
\fi
\begin{document}
$\left<i_1, i_2,\ldots,i_n\right>$
\end{document}


Does anyone have a suggestion on what to do?

Maybe this is what you're looking for:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathspec}
\usepackage{newunicodechar}

\defaultfontfeatures{Ligatures=TeX}% not needed with last version of fontspec
\setallmainfonts{Old Standard}

\makeatletter
\def\eu@MathPunctuation@symfont{Latin:m:n}
\DeclareMathSymbol{,}{\mathpunct}{\eu@MathPunctuation@symfont}{,}
\DeclareMathSymbol{.}{\mathord}{\eu@MathPunctuation@symfont}{.}
\XeTeXDeclareMathSymbol{^^^^2026}{\mathinner}%
{\eu@MathPunctuation@symfont}{"2026}[\mathellipsis]
\AtBeginDocument{\renewcommand{\mathellipsis}{\mathinner…}}
\newunicodechar{…}{\ifmmode\mathinner…\else…\fi}
\makeatother

\begin{document}
Here… again

Here\ldots{} again

$\langle i_1, i_2,\ldots,i_n\rangle$

$\langle i_1, i_2,\dots,i_n\rangle$ % better!

$\langle i_1, i_2,…,i_n\rangle$

\end{document}


Note that … is not defined as \mathinner, whereas \mathellipsis just does … (by default). So I redefine \mathellipsis and also the action of …, so it should be correct in all cases.

• Great! But since I prefer ASCII, I've modified your solution thus:<br/> \let\ellipsistmp=\mathellipsis \AtBeginDocument{\renewcommand{\mathellipsis}\mathinner\ellipsistmp}} – Jabot Apr 25 '15 at 9:59