`\futurelet` 如何获取 `\UTFviii@three@octets` 的替换宏?

`\futurelet` 如何获取 `\UTFviii@three@octets` 的替换宏?

我想用它\futurelet来测试以下令牌。为此,我有一个如下所示的设置:

\makeatletter
\def\@ExpandSub{%
    \typeout{Given Input: \meaning\@input}%
    \typeout{Followup command: \meaning\@following}%

    \ifx\@following\UTFviii@three@octets%  <--- doesn't work!
        \typeout{>>> That's unicode!}%
    \else%
        \typeout{>>> That's NOT unicode...}%
    \fi%
}

\protected\def\sub#1{%
    \let\@input#1%
    \futurelet\@following\@ExpandSub%
}
\makeatother
  1. 我如何测试下一个标记是否为 Unicode 字符\ifx\@following\UTFviii@three@octets不起作用,我认为是因为\@following保存了一个受保护的宏,\UTFviii@three@octets而不是\UTFviii@three@octets它本身。日志显示:Followup command: \protected macro:->\UTFviii@three@octets �,但我想要替换宏,因为它是在里面指定的\newunicodechar
  2. 如果是这种情况,我如何才能获得定义的替代宏\newunicodechar

这是尝试实现自动将 unicode 双下标 aᵢⱼ = a_{i}_{j} 合并为 a_{ij}

完整演示
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{etoolbox}
\usepackage{newunicodechar}


\makeatletter
\newtoggle{insub}
\def\@ExpandSub{%
    \typeout{Given Input: \meaning\@input}%
    \typeout{Followup command: \meaning\@following}%

    % if \@following is \UTFviii@three@octets, get the replacement text
    \ifx\@following\UTFviii@three@octets%  <--- doesn't work!
        \typeout{>>> That's unicode!}%
    \else%
        \typeout{>>> That's NOT unicode...}%
        \let\@actual\@following
    \fi%

    \iftoggle{insub}{
        \@input%
    }{
        \toggletrue{insub}%
        \sb\bgroup\@input%
    }%
    \ifx\@actual\sub%
        \typeout{keep going!}%
    \else%
        \typeout{Stop!}%
        \egroup\togglefalse{insub}%
    \fi%
}

% \DeclareRobustCommand*{\sub}[1]{\futurelet\@following\@ExpandSub{#1}}
\protected\def\sub#1{%
    \let\@input#1%
    \futurelet\@following\@ExpandSub%
}
\makeatother


\AtBeginDocument{
\newunicodechar{ᵢ}{\sub{i}}
\newunicodechar{ⱼ}{\sub{j}}
\newunicodechar{ₖ}{\sub{k}}
\newunicodechar{ₗ}{\sub{l}}
\newunicodechar{ₘ}{\sub{m}}
\newunicodechar{ₙ}{\sub{n}}
}

\begin{document}

\begin{tabular}{l}
$a_{ijklmn}$ \\
%$a\chain{i}\chain{j}\chain{k}\chain{l}\chain{m}\chain{n}$ \\
$a\sub{i}\sub{j}\sub{k}\sub{l}\sub{m}\sub{n}$ \\
% $a\sub[i]\sub[j]\sub[k]\sub[l]\sub[m]\sub[n]$ \\
$aᵢⱼₖₗₘₙ$
\end{tabular}
\end{document}

有关的:

相关内容