在 XeLaTeX 中使用 mathspec 进行 \mathellipsis

在 XeLaTeX 中使用 mathspec 进行 \mathellipsis

遵循解决方案xetex/mathspec 中数学模式中的标点符号XeTeX/mathspec 标点符号问题,我正在对 mathspec 进行调整,以强制 XeTeX 使用适当字体的标点符号。但是,当省略号后面跟着逗号时,省略号的间距无法正确完成。当然,LaTeX 没有问题。MWE(pdftex 在 ^^^^ 字符上给出错误,但没关系;旧标准是一种免费字体):

\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}

有人对该怎么做有什么建议吗?

答案1

也许这就是你正在寻找的:

\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}

请注意,没有定义为\mathinner,而\mathellipsis只是定义为(默认情况下)。所以我重新定义了\mathellipsis和的动作,所以它在所有情况下都应该是正确的。

在此处输入图片描述

相关内容