[Tex/LaTex] escape `|’ in \verb

verbatim

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

Best Answer

\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