如何获取用 \let (或 \def)定义的名称的 catcode?

如何获取用 \let (或 \def)定义的名称的 catcode?

如何获取\tmpA和的 catcode \tmpB

\documentclass[margin=5mm,varwidth]{standalone}
\begin{document}
  \let\tmpA=a
  \def\tmpB{b}
  \the\catcode`a % 11, FINE; BUT WHAT ABOUT \tmpA AND \tmpA?
\end{document}

答案1

至于你之前的问题,\meaning你的朋友在这里吗?

\documentclass[margin=5mm,varwidth]{standalone}
\begin{document}
  \let\tmpA=a
  \def\tmpB{b}

1  \the\catcode`a % 11, FINE; BUT WHAT ABOUT \tmpA AND \tmpA?

  \def\zzz#1 #2 #3\relax{#1 #2}
  \edef\zz{\expandafter\zzz\meaning\tmpA. . \relax}
   \let\tmpknownletter=z
  \edef\zzletter{\expandafter\zzz\meaning\tmpknownletter. . \relax}


2   \ifx\zz\zzletter 11\else 0\fi % could test for other cases

3  \the\catcode\expandafter`\tmpB

\end{document}

在此处输入图片描述

相关内容