28

In LaTeX, if I use \verb, how can I escape |? For example, I want to display ab|bc: \verb|ab[]bc|. What should replace []?

Caramdir
  • 89,023
  • 26
  • 255
  • 291
WIZARDELF
  • 1,325
  • 3
  • 14
  • 16

1 Answers1

35
\verb=ab|cd=

you can choose any symbol as a delimiter for the verb argument, except the *, it is reserved for \verb*=a b= (\textvisiblespace)

enter image description here

  • I chose "!". Bad choice... There may be more characters which cause errors. – Blaf May 17 '18 at 08:23
  • Sure, it depends to the setting of active characters, like the one from Babel and German language, foe example. –  May 17 '18 at 14:08