Joey McCollum via ntg-context schrieb am 10.10.2021 um 05:42: > The test using \removepunctuation that you provided does what it > should be doing (it produces 6 instances of "test-test" with the > intervening punctuation mark in each case removed), but it doesn't do > what I'm trying to do in the MWE above. I'm trying to take certain > punctuation marks that follow the \autopuncttest macro and place them > before it instead. Looking at the typo-chr .lua and .mkiv files, I see > that there are \pushpunctuation and \poppunctuationmethods in addition > to the \removepunctuation method. These might be useful for this > purpose, but in any case, I still have to check if the trailing > character is one of the characters in a specified set/string, and this > is where the error is arising. Add \protected (or \unexpanded) to your command definition. \startbtxrenderingdefinitions[myspec] \protected\def\autopuncttest#1#2%   {\removeunwantedspaces%    \doifinstring{#2}{,.!?;:}{#2}%    \footnote{#1}%    \doifnotinstring{#2}{,.!?;:}{#2}} \stopbtxrenderingdefinitions Wolfgang