[Tex/LaTex] What characters can delimit the argument of \verb

delimitersverbatim

I have seen \verb's argument delimited by many characters. I started out with " ", then I saw it done with # # and verified it worked, and I just saw it done with | | right here in egreg's answer. So I was wondering: what other characters can be used? Is there any difference in using one delimiter or another? In fact, seeing this makes me wonder: is there any symbol I can't use with \verb?

Best Answer

* makes \verb* so can't be used for the non-star form without hacking internals, but apart from that any character may be used, the reason is that you need to choose a character that is not in the string that is being set verbatim.

Note that latex doesn't make all symbols safe in verbatim (or for the verb delimiter) If you try to use an ascii null (byte 0) as the delimiter you get

! Text line contains an invalid character.
l.6 \verb^^@
Related Question