The code below doesn't compile logically:
Verbatim-like command '\test' illegal in argument...
Is there a way to "fix" this? If not, can I at least use a m
parameter, and then replace all the underscores by ::
for example, like if the user has typed \section{\test{txt::example}}
?
\documentclass[12pt]{article}
\usepackage{color}
\NewDocumentCommand{\test}{v}{%
\textcolor{red}{\fbox{\texttt{#1}}}%
}
\begin{document}
\section{\test{txt_example}}
The smallest \test{txt_example} in the world.
\end{document}
\test
that way and then asking to replace_
with::
as a fallback possibility? My impression is that you want to do something else.\test{txt_example}
in a template file such as to build a new one from data. During the templating phase, it is not a problem to seetxt::example
instead oftxt_example
. One short use case here.