这段最小的代码在 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}
这些数字只是为了让我们更容易看到标记被添加到了哪里。