![XeLaTeX interchartoks 中莫名其妙地出现了额外的 \endgroup](https://linux22.com/image/435480/XeLaTeX%20interchartoks%20%E4%B8%AD%E8%8E%AB%E5%90%8D%E5%85%B6%E5%A6%99%E5%9C%B0%E5%87%BA%E7%8E%B0%E4%BA%86%E9%A2%9D%E5%A4%96%E7%9A%84%20%5Cendgroup.png)
这段最小的代码在 XeLaTeX 中引发了一个extra \endgroup
错误,我无论如何也想不明白为什么!有人能解决这个错误吗?
\documentclass{article}
\usepackage{xcolor}
\XeTeXinterchartokenstate = 1
\newXeTeXintercharclass \mydigitsclass
\XeTeXcharclass `\Q \mydigitsclass
\XeTeXinterchartoks 0 \mydigitsclass = {\begingroup\color{green}}
\XeTeXinterchartoks \mydigitsclass 0 = {\endgroup}
\XeTeXinterchartoks 255 \mydigitsclass = {\begingroup\color{green}}
\XeTeXinterchartoks \mydigitsclass 255 = {\endgroup}
\begin{document}
Qa a Q
\end{document}
答案1
答案2
多年来,边界类别一直是 4095,而不是 255:
\documentclass{article}
\usepackage{xcolor}
\XeTeXinterchartokenstate = 1
\newXeTeXintercharclass \mydigitsclass
\XeTeXcharclass `\Q \mydigitsclass
\XeTeXinterchartoks 0 \mydigitsclass = {1\begingroup\color{green}}
\XeTeXinterchartoks \mydigitsclass 0 = {2\endgroup}
\XeTeXinterchartoks 4095 \mydigitsclass = {3\begingroup\color{green}}
\XeTeXinterchartoks \mydigitsclass 4095 = {4\endgroup}
\begin{document}
Qa a Q
\end{document}
这些数字只是为了让我们更容易看到标记被添加到了哪里。