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