Skip to main content
added 399 characters in body
Source Link
Ulrike Fischer
  • 352.2k
  • 22
  • 552
  • 1.1k

The bar is only a shorthand for \verb. So you can simply use \verb directly with as usual some delimiter which is not in the text:

\documentclass{ltxdoc} \begin{document} This is a vertical bar: \verb+|+ \end{document} 

Side remark: inside |...| formatting is the wrong concept. The shorthand is not about formatting (which can be changed), but allows verbatim typesetting. If you want to format in typewriter, use \texttt and \textbar (\| wouldn't work regardless if the bar is active or not, as \| is a math command). And if you want the bar to work like \texttt you will have to redefine it first.

The bar is only a shorthand for \verb. So you can simply use \verb directly with as usual some delimiter which is not in the text:

\documentclass{ltxdoc} \begin{document} This is a vertical bar: \verb+|+ \end{document} 

The bar is only a shorthand for \verb. So you can simply use \verb directly with as usual some delimiter which is not in the text:

\documentclass{ltxdoc} \begin{document} This is a vertical bar: \verb+|+ \end{document} 

Side remark: inside |...| formatting is the wrong concept. The shorthand is not about formatting (which can be changed), but allows verbatim typesetting. If you want to format in typewriter, use \texttt and \textbar (\| wouldn't work regardless if the bar is active or not, as \| is a math command). And if you want the bar to work like \texttt you will have to redefine it first.

Source Link
Ulrike Fischer
  • 352.2k
  • 22
  • 552
  • 1.1k

The bar is only a shorthand for \verb. So you can simply use \verb directly with as usual some delimiter which is not in the text:

\documentclass{ltxdoc} \begin{document} This is a vertical bar: \verb+|+ \end{document}