| 1 |
\AddToHook{env/syntax/begin}{\let\prefixes\prefixline} |
| 2 |
\newcount\prefixes@num |
| 3 |
\newcommand\enfprefix{\textcolor{black}} |
| 4 |
\newcommand\allprefix{\textcolor{gray}} |
| 5 |
\newcommand\notprefix{\textcolor{red!80!black}} |
| 6 |
\@ifdefinable\prefixline |
| 7 |
{\protected\def\prefixline{\hfill\afterassignment\prefixes@\prefixes@num=}} |
| 8 |
\ExplSyntaxOn |
| 9 |
\newcommand\prefixes@place[1] |
| 10 |
{% |
| 11 |
\numexpr |
| 12 |
\int_mod:nn { \int_div_truncate:nn \prefixes@num {#1} } { 10 } |
| 13 |
\relax |
| 14 |
} |
| 15 |
\ExplSyntaxOff |
| 16 |
\newcommand\printprefix[2] |
| 17 |
{% |
| 18 |
\ifcase\prefixes@place{#1}\or |
| 19 |
\enfprefix{#2}\or |
| 20 |
\allprefix{#2}\or |
| 21 |
\notprefix{#2}\fi |
| 22 |
} |
| 23 |
\protected\def\prefixes@ |
| 24 |
{% |
| 25 |
\ifnum\prefixes@num>10 |
| 26 |
\printprefix{1000}{new} |
| 27 |
\printprefix {100}{also} |
| 28 |
\printprefix {10}{protected} |
| 29 |
\printprefix {1}{long}% |
| 30 |
\else |
| 31 |
\ifcase\prefixes@num\or |
| 32 |
\enfprefix{long}\or |
| 33 |
\allprefix{long}\or |
| 34 |
\notprefix{long}\fi |
| 35 |
\fi |
| 36 |
} |