Due to a solution found with the help of @David Carlisle, I would like to conclude this post.
It was actually a simple addition of the command. Nothing more. No idea why it works, but it does. Thanks!
Enclosed is the full solution to the problem. The two definitions are triggered at a delimiter start and a delimiter end. Accordingly, everything between the two definitions, i.e. between \bgroup
and \egroup
, is now blacked out and replaced by 'YOUR_PATH'
:
\definecolor{mylilas}{RGB}{170,55,241}
\makeatletter
\def\formatPATH{}
\def\formatPATH@start{{\color{mylilas} \textquotesingle C:\textbackslash... }{\bfseries\color{black} YOUR\_PATH}\setbox0\vbox\bgroup}
\def\formatPATH@end{\egroup{\color{mylilas} \textquotesingle}}
\makeatother
A complete solution including the triggering of both definitions can be found in the following original post: Substitute text between delimiters (listings)
\setbox0\vbox
before the\bgroup
most likely.\bgroup
and\egroup
are part of a lot of macros. You cannot simply re-define it. This is possible only in OpTeX where\_broup
and\_egroup
are used internally in macros and you can declare\def\bgroup{\setbox0=\_vbox\_broup}
if you want to remove texts from\bgroup
...\egroup
used in your document.