I'm not quite sure how to describe this, but I want to create a custom command that treats its input as verbatim and allows some control of the output.
In pseudocode, I want:
\newcommand{\code}[1]{\verb{!#1!}}
\newcommand{\samp}[1]{{\normalfont\textsl{\verb!#1!}}}
(But that obviously doesn't work)
newverbs gets me close to what I need, but e.g.
\RequirePackage{newverbs}
\newverbcommand{\code}{}{}
requires \code!~! rather than \code{~}


\verbcan never be used in the argument to another command. – egreg May 18 '13 at 20:57\verb|something|instead of\code|something|? Can you make some examples of usage of your command? Maybe there's a different way to accomplish the task. – egreg May 18 '13 at 21:19\let\code\verbwill do, of course. But with the same syntax as\verband not as the argument of another command. In generalnewverbsis the way to go, if you want to change formatting. – egreg May 18 '13 at 21:25urlpackage, you'll find the needed code but I'm not experienced enough to extract it from there: url.sty – Albert Jun 06 '13 at 18:59