I have a basic command I created, aimed to simply bold and move a text to gain time :
\newcommand*\Cote[1]{\footnotesize\emph{\textbf{#1}}}
When I want this result, I still have to use this command \Cote{My text}. I would like to automatize this, because the text I want to replace has always the same structure, which is to know a capital D with numbers next to it : D3 or D89 or D1023.
So I want a new command, which applies only when a number follows my letter D. Like this :
\newcommand*\D[1]{\footnotesize\emph{\textbf{#1}}}
but only when a number follows. Otherwise lots of my words would be replace and it would be a mess.
I tried to use a \ifnum0 command inside \newcommand, but unsuccessfully. Same failure trying to ferret around in other topics, like Conditionally replacing sequences of characters Any ideas ?
I use LuaLatex. A big thanks in advance !
Best Answer
This tokencycle seems to do the job. As you can see, intervening macros and groups in the input stream have no ill effects on the result.
SUPPLEMENT
In response to an OP comment, desiring to retain the "D" in the altered font, in the event of subsequent digits, I might do it this way: