3 ms·
Also, a LaTeX macro will grab the first token as it's argument if there are no curly brackets which the regex doesn't support ... Not entirely surprised as that
by gavinsyancey 4y ago
Also, a LaTeX macro will grab the first token as it's argument if there are no curly brackets which the regex doesn't support ... Not entirely surprised as that's hard (impossible if you don't assume default catcodes) to get right and probably not worth it for most usecases but worth keeping in mind.
- jw1224 4y agoFor context, this is for a pretty strange use case — I was trying to preprocess user-submitted LaTeX with PHP, by replacing occurrences of a specific macro with simply the value of its first argument. The macro just colour-codes its first parameter presentationally, whilst the rest of the LaTeX needs to be passed to a compute engine for solving. The compute engine doesn't know how to "solve" a colour, hence why I'm trying to strip them out beforehand.